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

Can't compile Julia on Mac OS X 10.7 (Lion) #636

Closed
ksvanhorn opened this issue Mar 24, 2012 · 15 comments
Closed

Can't compile Julia on Mac OS X 10.7 (Lion) #636

ksvanhorn opened this issue Mar 24, 2012 · 15 comments
Labels
domain:building Build system, or building Julia or its dependencies

Comments

@ksvanhorn
Copy link

I upgraded from 10.5 (Leopard) to 10.6 (Snow Leopard) and then to 10.7.3 (Lion). Then I uninstalled my existing gfortran, downloaded and installed the 64-bit gfortran for Lion (gfortran-4.6.2-x86_64-Lion.dmg), downloaded julia with git, and ran make. The compilation continued for some time (albeit with a lot of warnings) and ultimately failed at this point near the end:

Making install in m4
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1216k 100 1216k 0 0 207k 0 0:00:05 0:00:05 --:--:-- 277k
CC src/jltypes.o
CC src/gf.o
CC src/support/hashing.o
CC src/support/timefuncs.o
CC src/support/dblprint.o
CC src/support/ptrhash.o
CC src/support/operators.o
CC src/support/socket.o
CC src/support/utf8.o
CC src/support/ios.o
CC src/support/dirpath.o
CC src/support/htable.o
CC src/support/bitvector.o
CC src/support/int2str.o
CC src/support/dump.o
CC src/support/libsupportinit.o
CC src/support/arraylist.o
LINK src/support/libsupport.a
CC src/flisp/flisp.o
CC src/flisp/builtins.o
CC src/flisp/string.o
CC src/flisp/equalhash.o
CC src/flisp/table.o
CC src/flisp/iostream.o
CC src/flisp/julia_extensions.o
LINK src/flisp/libflisp.a
CC src/flisp/flmain.o
CC src/flisp/flisp
FLISP src/julia_flisp.boot
FLISP src/julia_flisp.boot.inc
CC src/ast.o
CC src/builtins.o
CC src/module.o
CC src/codegen.o
CC src/interpreter.o
CC src/alloc.o
CC src/dlload.o
CC src/sys.o
CC src/init.o
CC src/task.o
CC src/array.o
CC src/dump.o
CC src/gc.o
LINK src/libjulia-release.a
LINK libjulia-release.dylib
PERL base/pcre_h.jl
cc1: warning: unrecognized gcc debugging option: M
PERL base/errno_h.jl
cc1: warning: unrecognized gcc debugging option: M
cc1: warning: unrecognized gcc debugging option: M
CC ui/repl.o
CC ui/repl-basic.o
LINK uijulia-release-basic
CC ui/repl-readline.o
LINK uijulia-release-readline
LINK ui/webserverjulia-release-webserver
JULIA sys0.ji
dlopen(/Users/kevin/Tmp/julia/lib/libsuitesparse.dylib, 2): Symbol not found: ___addtf3
Referenced from: /usr/local/gfortran/lib/libquadmath.0.dylib
Expected in: /usr/lib/libSystem.B.dylib
in /usr/local/gfortran/lib/libquadmath.0.dylib

make[1]: *** [sys0.ji] Error 1
make: *** [release] Error 2

I can provide the complete make output if desired.

@ksvanhorn
Copy link
Author

Seems the build of readline also fails:

Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.922/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]_$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.922/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
i686-apple-darwin11-llvm-gcc-4.2: -compatibility_version only allowed with -dynamiclib
make[4]: *_* [libreadline.6.2.dylib] Error 1

It's 2:30 a.m. and I have been trying since early in the evening to get this thing to build...

@nolta
Copy link
Member

nolta commented Mar 24, 2012

i686-apple-darwin11-llvm-gcc-4.2: -compatibility_version only allowed with -dynamiclib

Does this help:

http://techdebug.com/blog/2009/01/03/compiling-readline-on-an-osx-105-intel-x86_64/

?

@ksvanhorn
Copy link
Author

Thanks, that fixed the readline problem. For anyone else who has this problem, I went to the external directory and issued this command to rebuild readline:

make -B install-readline SHOBJ_LDFLAGS=-dynamiclib

Now if I can just get this "Symbol not found" business straightened out.

@StefanKarpinski
Copy link
Sponsor Member

That cc1 warning is worrying. What version of gcc and gfortran do you have?

@ksvanhorn
Copy link
Author

mac> gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)

mac> gfortran --version
GNU Fortran (GCC) 4.6.2 20111019 (prerelease)

After upgrading to Lion I installed XCode 4.3.2 and and its Command Line Tools, presuming that this would get me reasonably up-to-date versions of all the developer tools. For gfortran I followed the Julia "Source Download and Compilation" instructions:

Either download and install gfortran from hpc.sf.net, or 64-bit gfortran from gcc.gnu.org.

I opted for the latter, specifically, http://quatramaran.ens.fr/~coudert/gfortran/gfortran-4.6.2-x86_64-Lion.dmg

@StefanKarpinski
Copy link
Sponsor Member

Ok, those versions are all perfectly reasonable. Hmm...

@ksvanhorn
Copy link
Author

Here's another datum that might (or might not) be relevant. When I try to run the prebuilt julia binaries for Mac OS X, I get this error:

dlopen(/Users/kevin/Downloads/julia/lib/libamos.dylib, 2): Library not loaded: /usr/local/lib/libgfortran.3.dylib
Referenced from: /Users/kevin/Downloads/julia/lib/libamos.dylib
Reason: image not found
error during init:
could not load module libamos
in dlopen at /Users/viral/julia/jl/base.jl:98
at string:15

If I add /usr/local/gfortran/lib to DYLD_LIBRARY_PATH it takes care of that error, but I still get pretty much the same error I'm getting when I build julia myself:

dlopen(/Users/kevin/Downloads/julia/lib/libamos.dylib, 2): Symbol not found: ___addtf3
Referenced from: /usr/local/gfortran/lib/libquadmath.0.dylib
Expected in: /usr/lib/libSystem.B.dylib
in /usr/local/gfortran/lib/libquadmath.0.dylib
error during init:
could not load module libamos
in dlopen at /Users/viral/julia/jl/base.jl:98
at string:15

@ksvanhorn
Copy link
Author

One other thing -- I've tried it both with and without using the system BLAS and LAPACK, by uncommenting

ifeq ($(OS), Darwin)
USE_SYSTEM_BLAS=1
USE_SYSTEM_LAPACK=1
endif

in Make.inc. The only difference I've seen is (no suprise) in build time.

@StefanKarpinski
Copy link
Sponsor Member

The function __addtf3 is a GCC software floating point routine:

http://www.opensource.apple.com/source/gcc/gcc-5666.3/gcc/config/soft-fp/addtf3.c

It looks like GCC isn't finding that function for some reason.

@ksvanhorn
Copy link
Author

I ran a script to run nm on every *.dylib file under /usr; these are the only ones that mention ___addtf3:

/usr/local/gfortran/lib/i386/libgfortran.3.dylib : U ___addtf3
/usr/local/gfortran/lib/i386/libgfortran.dylib : U ___addtf3
/usr/local/gfortran/lib/i386/libquadmath.0.dylib : U ___addtf3
/usr/local/gfortran/lib/i386/libquadmath.dylib : U ___addtf3
/usr/local/gfortran/lib/libgcc_ext.10.4.dylib : 0000000000005330 T ___addtf3
/usr/local/gfortran/lib/libgcc_ext.10.5.dylib : 0000000000005330 T ___addtf3
/usr/local/gfortran/lib/libgcc_s.1.dylib : 0000000000005330 T ___addtf3
/usr/local/gfortran/lib/libgcc_s_ppc64.1.dylib : 0000000000005330 T ___addtf3
/usr/local/gfortran/lib/libgcc_s_x86_64.1.dylib : 0000000000005330 T ___addtf3
/usr/local/gfortran/lib/libgfortran.3.dylib : U ___addtf3
/usr/local/gfortran/lib/libgfortran.dylib : U ___addtf3
/usr/local/gfortran/lib/libquadmath.0.dylib : U ___addtf3
/usr/local/gfortran/lib/libquadmath.dylib : U ___addtf3

@aviks
Copy link
Member

aviks commented Mar 25, 2012

FWIW, I recently upgraded from SnowLeopard to Lion, and successfully re-compiled julia and its dependencies using

Gfortran from http://quatramaran.ens.fr/~coudert/gfortran/gfortran-4.6.2-x86_64-Lion.dmg

$gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gfortran/libexec/gcc/x86_64-apple-darwin11/4.6.2/lto-wrapper
Target: x86_64-apple-darwin11
Configured with: ../gcc-4.6.2-RC-20111019/configure --prefix=/usr/local/gfortran --with-gmp=/Users/fx/devel/gcc/deps-static/x86_64 --enable-languages=c,c++,fortran,objc,obj-c++ --build=x86_64-apple-darwin11
Thread model: posix
gcc version 4.6.2 20111019 (prerelease) (GCC) 

and GCC

$gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)

@ksvanhorn
Copy link
Author

I found the solution: putting /usr/local/gfortran/lib at the beginning of DYLD_LIBRARY_PATH solved the problem. Previously I had .../gfortran/lib at the end of DYLD_LIBRARY_PATH.

@StefanKarpinski
Copy link
Sponsor Member

Ah. That's interesting. I generally don't have DYLD_LIBRARY_PATH set at all.

@StefanKarpinski
Copy link
Sponsor Member

Should we put some kind of note about DY/LD_LIBRARY_PATH in the install docs?

@ViralBShah
Copy link
Member

With this version of gfortran, -static-gfortran would solve this problem, but create problems on some older versions of gfortran. Of course that flag does not include libquadmath, so it is only a partial solution, if at all it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:building Build system, or building Julia or its dependencies
Projects
None yet
Development

No branches or pull requests

6 participants