I was going through the testing procedure (https://github.com/stan-dev/math/wiki) to make sure I didn’t break anything and I was having trouble executing the unit tests.
./runTests.py test/unit
This fails and complains about test/unit/libmultiple.so not existing (within compiling 4/5 things). If I look up the build logs, it looks like test/unit/libmultiple.so never built:
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)
If I add -fPIC to the end of CFLAGS, the compile goes well past the place it broke before (it’s still going). I’m running Ubuntu 16.04. I got this error on two different (Ubuntu 16.04) computers, and I got it again in a clean Stan Math repo (not polluted by my changes).
Does it make sense to add this flag? I Googled and it sounded like something that is pretty platform/application specific that is sometimes enabled by default.
Hey, I was having this problem on Ubuntu as well but didn’t look into it. The fix makes sense to me but I’m not sure who made that test so we should see if they pipe up.
Our dev ops people, Daniel Lee and Sean Talts, are both out. Sean’s coming back soon and hopefully he’ll see this and comment. If you don’t get a response by the end of the week, please repost. Sorry for the delay, but I have no idea how any of this works on Linux, much less cross-platform.