ほつた@はてな

ほつたが技術的な事や個人的な出来事を中心に投稿します。

gem install pgでbrew install postgresqlしてARCHFLAGS="-arch x86_64"指定しても全く解決せず数時間も悪戦苦闘した

HerokuでデプロイするとなるとSQLiteが使えず、PostgreSQLを使わなければならなくなる。 Cloud9ではなく、そろそろRubymineで本格的に開発しようとしていてbundle installをしたところ、pgで数時間もハマったのである。

結論

sudoでARCHFLAGを指定してさらに場所を指定すると成功する。

sudo ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.5.3/bin/pg_config

bundle installでコケる

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-pg-config=/usr/local/Cellar/postgresql/9.5.3/bin/pg_configARCHFLAGS=-arch x86_64 bundle installz
Using config values from /usr/local/Cellar/postgresql/9.5.3/bin/pg_configARCHFLAGS=-arch
sh: /usr/local/Cellar/postgresql/9.5.3/bin/pg_configARCHFLAGS=-arch: No such file or directory
sh: /usr/local/Cellar/postgresql/9.5.3/bin/pg_configARCHFLAGS=-arch: No such file or directory
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
        --with-pg
        --without-pg
        --enable-windows-cross
        --disable-windows-cross
        --with-pg-config
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/


Gem files will remain installed in /var/folders/vf/tbdkk_nx5wq0889j7_pdc_pw0000gn/T/bundler20160818-22367-jz3gq8pg-0.18.4/gems/pg-0.18.4 for inspection.
Results logged to /var/folders/vf/tbdkk_nx5wq0889j7_pdc_pw0000gn/T/bundler20160818-22367-jz3gq8pg-0.18.4/gems/pg-0.18.4/ext/gem_make.out

sudo gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.5.3/bin/pg_configでもコケる

sudo gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.5.3/bin/pg_config
Password:
Building native extensions with: '--with-pg-config=/usr/local/Cellar/postgresql/9.5.3/bin/pg_config'
This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-pg-config=/usr/local/Cellar/postgresql/9.5.3/bin/pg_config
Using config values from /usr/local/Cellar/postgresql/9.5.3/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
        --with-pg
        --without-pg
        --enable-windows-cross
        --disable-windows-cross
        --with-pg-config
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/
        --with-pqlib
        --without-pqlib
        --with-libpqlib
        --without-libpqlib
        --with-ms/libpqlib
        --without-ms/libpqlib


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/pg-0.18.4 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/pg-0.18.4/ext/gem_make.out

sudo ARCHFLAGS="-arch x86_64" gem install pgでもコケる

sudo env ARCHFLAGS="-arch x86_64" gem install pg 
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
        --with-pg
        --without-pg
        --enable-windows-cross
        --disable-windows-cross
        --with-pg-config
        --without-pg-config
        --with-pg_config
        --without-pg_config
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/pg-0.18.4 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/pg-0.18.4/ext/gem_make.out

分けわからないので両方やってみたところ成功

結論を参照

参考

qiita.com

まとめ

Railsは環境構築のだるさが物凄い

やっと自分のホームページが完成した

精神的にやや落ち着いてきたた(?)ので久々にブログを更新する。
授業以外にやらなければならない事はなくなり最近はスクレイピングで図書館の貸出期限やらカーリルの読みたいリストをスクレイピングしまくるだとかスクレイピングづくしの日々を送ってる。 プログラミングを本気で学ぶきっかけもスクレイピングだったしやっぱりスクレイピングが1番好きだ。 スクレイピングに関してはまた後日オープンソースにして記事を書きたい。

ホームページ完成

今日はやっと自分のホームページが完成したぞというお話。 ホームページを作ろう作ろうと言って中々作ることが出来なかったが、ついに完成した。

ほつた

使ったツールなど

GitHub Pagesという静的なWebページを無料で公開できる機能を活用し、去年の12月頃に勢いで取ってしまった独自ドメインDNSを設定した。

github.com

デザインスキルほぼ0でHTMLやCSSが全く分かってない自分でもBootstrapの力でいい感じのサイトが何とか作れたのでホームページくらい誰でも作ることが出来ると言って過言ではないだろう。

だからと言ってブログ見たいに簡単に作れるかと言ったらそういう訳ではないと思う。*1
嵌まった点などをいつか暇が出来れば軽く書いていきたい。

ホームページはまだまだ作成途中

まだまだホームページは作成途中だと思っていて、ブログのリンクなどをヘッダー*2に設置して目次として下の方に一発で飛べるよう早急にコミットしたい。

そしてなにより、やっとホームページがまあまあ出来たのだから随分と長い間切らしている名刺の発注をかけてしまうぞ。

*1:Bootstrapそのままならまあ速攻作れるだろう。

*2:上のバー

東海大学ユニークプロジェクトICTRATが自然消滅するまでの軌跡

高輪キャンパスで活動していた、東海大学ユニークプロジェクトの情報通信研究プロジェクト(ICTRAT)が先日*1を持ちまして、活動終了となりました。 まだ心の中が非常にもやもやした感じなので、この件や関連することについて思う存分、書きたいと思います。 ちなみにICTRATに、2015年度春に入った新米なので本当の詳しい事や昔のことは、ほとんど知りません。色々と不明確なところや間違いがあったり、読みにくい文章なのはお許し下さい。

  • ICTRATとは?
  • 時はさかのぼり、2015年春
  • 唯一の希望とも言える、ハッカソンに参加
  • リーダー音信不通へ
  • 春~Minecraft×Education2016時代
  • その頃の自分は、一体何をやっていたんだ
  • ICTRAT末期時代の活動状況
  • ドココン(where.conf)を企画
  • ICTRAT、自然消滅が確定する
  • そんな中、ハッカソンで悲願の入賞を果たす
  • ICTRATがなくなってから
  • ICTRAT難民が現れる
  • ドココン(where.conf)はどうなる?
  • 新プロジェクト設立を視野に模索中
  • 新プロジェクトでやりたいこと
  • 結局は、自分がどうするか
  • 最後に

*1:2016年3月末

続きを読む

東海大学ICTRATチームとしてサバフェス!2016に参加して学生賞をもらいました

サバフェス!2016について

IDCフロンティアさんのところで、2013年から毎年サーバーのチューニング大会として開かれてるサバフェス!。今年のサバフェス!2016は、チューニング大会ではなく、健康をテーマとしたIoTのハッカソンでしたので参加して見事に学生賞を貰うことが出来ました。自分は当日、実際にお見せできなかったRuby on Railsを使ったサイトの開発を担当しました。

2016.serverfesta.info

  • サバフェス!2016について
  • 開発するまでの経緯
  • 同学部の先輩(@dwight_1011)の凄さ
  • 脳波(necomimi)の不可解な壁
  • 自分は何をしていたんだ
  • 迫り来る時間
  • 当日、最悪の事態を迎える
  • 悔やまれた展示時間
  • 学生賞に見事選ばれる
  • チームとしての課題
  • 開発を通して感じた個人的な課題
  • 自分としてこれから
  • ハッカソンについて
  • 最後に
続きを読む

格安SIMを契約したければ DTI SIM 半年間無料キャンペーンで試してみるべき

色々な会社があって格安SIMの契約をどうしようか迷ってる。
そんな人にとっておきのキャンペーンがあります。

DTI SIM 半年間無料キャンペーン

サイトは胡散臭いですが、6ヶ月間契約手数料3240円のみで試せるのでおすすめです。

『DTI SIM』半年タダでお試し!キャンペーン!

DTI SIM 半年間無料キャンペーン

まずはキャンペーンで試してから

MVNOの感触を掴まずに、いきなり契約するのはあまりおすすめしません。
mineoなど色々な格安SIM会社がお試しキャンペーンをしているので積極的に試してみてから耐えられそうであれば他の良さそうなMVNOを探してみるといのが一番だと思います。