probcomp / crosscat

A domain-general, Bayesian method for analyzing high-dimensional data tables
http://probcomp.csail.mit.edu/crosscat/
Apache License 2.0
322 stars 42 forks source link

Building for Anaconda on OS X requires extra linker flags #52

Open tibbetts opened 9 years ago

tibbetts commented 9 years ago

Requires extra_link_args = ["-stdlib=libstdc++","-mmacosx-version-min=10.6"],

LDFLAGS isn't respected, not sure the right way to detect when this is needed.

riastradh-probcomp commented 9 years ago

What goes wrong if you don't change the stdlib or if you omit the macosx-version-min?

tibbetts commented 9 years ago

Build failure:

g++ -bundle -undefined dynamic_lookup -L/Users/tibbetts/anaconda/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/crosscat/cython_code/CyclicComponentModel.o build/temp.macosx-10.5-x86_64-2.7/cpp_code/src/utils.o build/temp.macosx-10.5-x86_64-2.7/cpp_code/src/numerics.o build/temp.macosx-10.5-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o build/temp.macosx-10.5-x86_64-2.7/cpp_code/src/ComponentModel.o build/temp.macosx-10.5-x86_64-2.7/cpp_code/src/CyclicComponentModel.o -L/Users/tibbetts/anaconda/lib -o build/lib.macosx-10.5-x86_64-2.7/crosscat/cython_code/CyclicComponentModel.so
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1

----------------------------------------
Command "/Users/tibbetts/anaconda/bin/python -c "import setuptools, tokenize;__file__='/var/folders/h9/8d2yv2ln0gq74mp5mffdw8qw0000gn/T/pip-6CaCIe-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/h9/8d2yv2ln0gq74mp5mffdw8qw0000gn/T/pip-pFbKkb-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /var/folders/h9/8d2yv2ln0gq74mp5mffdw8qw0000gn/T/pip-6CaCIe-build
riastradh-probcomp commented 9 years ago

Is that without -stdlib=libstdc++, or is that without -mmacosx-version-min=10.6?

riastradh-probcomp commented 9 years ago

I just tried setting LDFLAGS and it took effect:

% LDFLAGS=-wotsit python setup.py build
...
c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -wotsit build/temp.linux-x86_64-2.7/crosscat/cython_code/CyclicComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/utils.o build/temp.linux-x86_64-2.7/cpp_code/src/numerics.o build/temp.linux-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o build/temp.linux-x86_64-2.7/cpp_code/src/ComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/CyclicComponentModel.o -o build/lib.linux-x86_64-2.7/crosscat/cython_code/CyclicComponentModel.so
c++: error: unrecognized command line option ‘-wotsit’
error: command 'c++' failed with exit status 1
tibbetts commented 9 years ago

I stand corrected, the following line builds successfully:

LDFLAGS="-stdlib=libstdc++ -mmacosx-version-min=10.6" pip install git+ssh://git@github.com/probcomp/crosscat