andrewray / iocaml

An OCaml kernel for the IPython notebook
MIT License
193 stars 20 forks source link

Problem installing on OS X 10.9 "zmq.h not found" #26

Open wtyneb opened 10 years ago

wtyneb commented 10 years ago

sudo opam install iocaml fails with the following:

The following actions will be performed:

=-=-= Installing iocaml-kernel.0.4.6 =-=-= Applying 4.00.1.patch. Building iocaml-kernel.0.4.6: make all make install [ERROR] The compilation of iocaml-kernel.0.4.6 failed. Removing iocaml-kernel.0.4.6. make uninstall

[ERROR] Due to some errors while processing iocaml-kernel.0.4.6, the following actions will NOT proceed:

===== ERROR while installing iocaml-kernel.0.4.6 =====

opam-version 1.1.2

os darwin

command make all

path /Users/wtnebel/.opam/system/build/iocaml-kernel.0.4.6

compiler system (4.01.0)

exit-code 2

env-file /Users/wtnebel/.opam/system/build/iocaml-kernel.0.4.6/iocaml-kernel-78019-c61e7b.env

stdout-file /Users/wtnebel/.opam/system/build/iocaml-kernel.0.4.6/iocaml-kernel-78019-c61e7b.out

stderr-file /Users/wtnebel/.opam/system/build/iocaml-kernel.0.4.6/iocaml-kernel-78019-c61e7b.err

stdout

atdgen -t Ipython_json.atd

atdgen -j Ipython_json.atd

ocamlfind c iocaml_zmq_stubs.c

stderr

iocaml_zmq_stubs.c:1:10: fatal error: 'zmq.h' file not found

include

^

1 error generated.

make: *\ [stub] Error 2

'opam install iocaml' failed.

I tried to use homebrew to install zeromq/libzmq but that didn't help. Any suggestions on how I might resolve this?

Also, apologies for the poor markdown usage, I'm not entirely familiar with it's syntax.

andrewray commented 10 years ago

It certainly seems as if zeromq is missing here.

A while ago @avsm posted these instructions https://gist.github.com/avsm/9041133

Note sure they still work - I thought just brew install zeromq did the job these days.

wtyneb commented 10 years ago

Unfortunately that's not doing the trick! Is there a specific location where it's attempting to find zmq.h ?

Also, `opam install zmq' is encountering the same error, "unable to find zmq"

Would you have any advice on installing zmq properly? I've looked into building it from source, but I'm not sure how to proceed with it.

andrewray commented 10 years ago

The only advice I can find on google is to add --universal to the brew command to possibly work round any 32/64 bit issues.

Is it possible to check if zmq.h is anywhere on your system?

wtyneb commented 10 years ago

Yes, I did find zmq.h in my python installation (Anaconda), the /anaconda/pkgs/zeromq-4.0.4-0/include directory.

There's another where brew installed it: /usr/local/Cellar/zeromq32/3.2.4/include

Is there some way I can direct opam to this file?

andrewray commented 10 years ago

The one in brew looks about right. I believe symlinks should be set up pointing into /usr/local/Cellar so that they appear in the correct paths (here, in particular, so the include directory is available in C so you can do #include <zmq.h>.

I suspect something to do with your homebrew installation is a bit iffy.

Perhaps try homebrew doctor and see if it complains about anything. Sorry - don't use OSX much but I will try and have a look at how homebrew sets stuff up tomorrow.

andrewray commented 10 years ago

I had a bit of a look round on my mac. Homebrew should have set up /usr/local/include to include a link to zmq.h. This is where the c/ocaml compiler expects to find the header file.

unknown-c4-2c-03-10-8d-87:temp andyray$ ls -la /usr/local/include/ 
total 24
drwxr-xr-x   5 andyray  admin  170 21 Mar  2014 .
drwxrwxr-x  16 root     admin  544 21 Mar  2014 ..
lrwxr-xr-x   1 andyray  admin   38 21 Mar  2014 boost -> ../Cellar/boost/1.55.0_1/include/boost
lrwxr-xr-x   1 andyray  admin   38 21 Mar  2014 zmq.h -> ../Cellar/zeromq32/3.2.4/include/zmq.h
lrwxr-xr-x   1 andyray  admin   44 21 Mar  2014 zmq_utils.h -> ../Cellar/zeromq32/3.2.4/include/zmq_utils.h
brabalan commented 9 years ago

I just gave this a try and brew install zeromq allows me to install iocaml-kernel.

I have had similar issues with gmp before, so I now have the following in my .zshrc. Maybe this is the reason this works for me:

# for gmp to be found by cc (hence opam)
export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/include
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
CBothwell commented 9 years ago

I had this problem with several libraries. Yes, the /usr/local/include headers aren't part of the C_INCLUDE_PATH. You'll want to install the command line dev tools from xcode.

$ xcode-select --install

greensam commented 8 years ago

Had the same issue, and re-running an xcode-select --install resolved for me.