Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't play well with homebrew not in /usr/local #27

Open
frankcarey opened this issue Oct 24, 2014 · 11 comments
Open

Doesn't play well with homebrew not in /usr/local #27

frankcarey opened this issue Oct 24, 2014 · 11 comments

Comments

@frankcarey
Copy link

Boxen puts homebrew in /opt/boxen/homebrew (don't get me started on why :/ ) but I think you should use the ENV VAR $HOMEBREW_ROOT instead of assuming /usr/local ?

@frankcarey
Copy link
Author

there is also
$ brew --prefix

@soumith
Copy link
Member

soumith commented Oct 24, 2014

oh ha! can you patch it with a PR?

@frankcarey
Copy link
Author

Sure thing, but still having issues locally getting issues at the luajit step:

$ curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-luajit+torch | PREFIX=$HOMEBREW_ROOT bash
Installing Torch into: /opt/boxen/homebrew
Cloning into 'luajit-rocks'...
remote: Counting objects: 1330, done.
remote: Total 1330 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (1330/1330), 5.50 MiB | 3.88 MiB/s, done.
Resolving deltas: 100% (673/673), done.
Already on 'master'
Already up-to-date.
-- The C compiler identification is AppleClang 6.0.0.6000051
-- The CXX compiler identification is AppleClang 6.0.0.6000051
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- The ASM compiler identification is Clang
-- Found assembler: /usr/bin/cc
-- Found readline library
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for sin in m
-- Looking for sin in m - found
-- Performing Test LJ_TARGET_X64
-- Performing Test LJ_TARGET_X64 - Success
-- LuaJIT Target: x64
-- LuaJIT target x64
-- Performing Test LJ_ARCH_BITS_64
-- Performing Test LJ_ARCH_BITS_64 - Success
-- Performing Test LJ_HASJIT_1
-- Performing Test LJ_HASJIT_1 - Success
-- Performing Test LJ_HASFFI_1
-- Performing Test LJ_HASFFI_1 - Success
-- Performing Test LJ_DUALNUM_1
-- Performing Test LJ_DUALNUM_1 - Failed
-- Performing Test LJ_ARCH_HASFPU_1
-- Performing Test LJ_ARCH_HASFPU_1 - Success
-- Performing Test LJ_ABI_SOFTFP_1
-- Performing Test LJ_ABI_SOFTFP_1 - Failed
-- Looking for sin in m
-- Looking for sin in m - found
-- Found Wget: /opt/boxen/homebrew/bin/wget
-- Found MD5: /sbin/md5
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   libluajit

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /tmp/luajit-rocks/build
Scanning dependencies of target minilua
[  3%] Building C object luajit/CMakeFiles/minilua.dir/src/host/minilua.c.o
Linking C executable minilua
[  3%] Built target minilua
[  7%] Generating buildvm_arch.h
Scanning dependencies of target buildvm
[ 11%] Building C object luajit/CMakeFiles/buildvm.dir/src/host/buildvm.c.o
[ 15%] Building C object luajit/CMakeFiles/buildvm.dir/src/host/buildvm_asm.c.o
[ 19%] Building C object luajit/CMakeFiles/buildvm.dir/src/host/buildvm_peobj.c.o
[ 23%] Building C object luajit/CMakeFiles/buildvm.dir/src/host/buildvm_lib.c.o
[ 26%] Building C object luajit/CMakeFiles/buildvm.dir/src/host/buildvm_fold.c.o
Linking C executable buildvm
[ 26%] Built target buildvm
[ 30%] Generating vmdef.lua
[ 34%] Generating lj_vm.s
[ 38%] Generating lj_ffdef.h
[ 42%] Generating lj_bcdef.h
[ 46%] Generating lj_libdef.h
[ 50%] Generating lj_recdef.h
[ 53%] Generating lj_folddef.h
Scanning dependencies of target libluajit
[ 57%] Building C object luajit/CMakeFiles/libluajit.dir/src/ljamalg.c.o
[ 61%] Building ASM object luajit/CMakeFiles/libluajit.dir/lj_vm.s.o
Linking C shared library libluajit.dylib
[ 61%] Built target libluajit
Scanning dependencies of target luajit
[ 65%] Building C object luajit/CMakeFiles/luajit.dir/src/luajit.c.o
[ 69%] Building C object luajit/CMakeFiles/luajit.dir/src/ljamalg.c.o
[ 73%] Building ASM object luajit/CMakeFiles/luajit.dir/lj_vm.s.o
Linking C executable luajit
Undefined symbols for architecture x86_64:
  "_rl_completion_suppress_append", referenced from:
      _lua_rl_complete in luajit.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [luajit/luajit] Error 1
make[1]: *** [luajit/CMakeFiles/luajit.dir/all] Error 2
make: *** [all] Error 2
Error. Exiting.

IF I look into /tmp/luajit-rocks/build at the CMakeCache.txt, I see the following settings:

//ASM compiler.
CMAKE_ASM_COMPILER:FILEPATH=/usr/bin/cc
This points to /usr/bin/cc -> clang

cc --version
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

//CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++

@soumith
Copy link
Member

soumith commented Oct 24, 2014

poof! you likely have two different readline installed and it's hooking up to the wrong one for linking. :-/
I have a proof-of-concept OSX binaries (basically a Torch.app) I can send you if you want to just get it all working.

@soumith
Copy link
Member

soumith commented Oct 24, 2014

I haven't fully tested them yet.

@frankcarey
Copy link
Author

yes please, Happy to give it a shot instead of banging my head with this.. (can't get the tutorials)

FYI, i just reinstalled readline with hombrew and I get


his formula is keg-only, which means it was not symlinked into /opt/boxen/homebrew.

Mac OS X provides similar software, and installing this software in
parallel can cause all kinds of trouble.

OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

LDFLAGS:  -L/opt/boxen/homebrew/opt/readline/lib
CPPFLAGS: -I/opt/boxen/homebrew/opt/readline/include

==> Summary
🍺 /opt/boxen/homebrew/Cellar/readline/6.3.8: 40 files, 2.1M

@soumith
Copy link
Member

soumith commented Oct 24, 2014

yes, if you see the install-deps script, we also do: brew link readline
which creates symlinks that fix your error. I thought you ran install-deps already

@soumith
Copy link
Member

soumith commented Oct 24, 2014

also, if you want torch in a nice cozy self-contained folder, you can use this :
https://github.com/soumith/torch-distro
(make sure you install all the dependencies first using homebrew or install-deps)

@soumith
Copy link
Member

soumith commented Oct 24, 2014

here are the OSX binaries. No guarantee at all to work:
https://drive.google.com/file/d/0B5a1RIYpo41qbko2RVlLQWZyLWM/view?usp=sharing

@frankcarey
Copy link
Author

So, It was indeed using the wrong readline. I ended up just symlinking the /opt/boxen/homebrew/lib folder into the vacant default location at /usr/local/lib and all was well. Not sure how to specify this in the script, so I asked at luajit-rocks repo how to do that. torch/luajit-rocks#9

Once we have that, I can update the script and send you a PR

@frankcarey
Copy link
Author

And to clarify, brew link just seems to create the link in /usr/local/lib (or /opt/boxen/homebrew/lib in my case). I'm not sure how to add additional paths in, but all of my homebrew stuff seems to work fine, just not when I go to use the make scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants