-
-
Notifications
You must be signed in to change notification settings - Fork 198
Closed
Description
Summary:
Multiple translation units test fails on Linux. This shouldn't fail.
See: http://discourse.mc-stan.org/t/stan-math-ubuntu-clang-needs-fpic/339/3
Description:
The test was originally put in place so we can check that the headers be included from multiple translation units and compiled separately. We've added inline to all our functions which allows this behavior.
It currently runs on Mac with the clang++ and g++ compilers, but this may not be safe with the compiler flags that are default for linux.
Possible fixes:
- Remove the test and don't support including in multiple translation units. This originally came up with @rgiordan 's request; I'm not sure who else depends on this.
- Fix the compiler options so it works for Linux (and Windows?). Looks like adding
-fPICmay do it. See: http://discourse.mc-stan.org/t/stan-math-ubuntu-clang-needs-fpic/339/3
Reproducible Steps:
Run:
./runTests.py test/unit/multiple_translation_units_test.cpp
Current Output:
clang++ -shared -o test/unit/libmultiple.so test/unit/multiple_translation_units1.o test/unit/multiple_translation_units2.o
/usr/bin/ld: test/unit/multiple_translation_units1.o: relocation R_X86_64_32S against `_ZTVN4stan4math4variE' can not be used when making a shared object; recompile with -fPIC
test/unit/multiple_translation_units1.o: error adding symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Expected Output:
It runs.
Additional Information:
Thanks, Ben! (Sorry, don't know your GitHub profile)
@seantalts, mind helping out?
Current Version:
v2.15.0