JuliaInterop / libcxxwrap-julia

C++ library for backing CxxWrap.jl
Other
84 stars 43 forks source link

-std=c++14 breaks clang build #13

Closed jstrube closed 6 years ago

jstrube commented 6 years ago

I'm trying to build against v0.5, but my build is failing on MacOS:

[ 50%] Building CXX object CMakeFiles/lciowrap.dir/src/lciowrap.cc.o
/opt/x86_64-linux-gnu/tools/clang++ --sysroot=/opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root  -DJULIA_ENABLE_THREADING -Dlciowrap_EXPORTS -I/workspace/srcdir/LCIOWrapBuilder/include -isystem /workspace/destdir/include -isystem /workspace/destdir/include/julia  -target x86_64-apple-darwin14 --sysroot /opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root -stdlib=libc++ -target x86_64-apple-darwin14 --sysroot /opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root -stdlib=libc++;-std=c++14 -fPIC   -std=c++14 -o CMakeFiles/lciowrap.dir/src/lciowrap.cc.o -c /workspace/srcdir/LCIOWrapBuilder/src/lciowrap.cc
clang-6.0: error: no input files
/bin/sh: -std=c++14: not found

I think this is coming from here Is this really necessary? Is this line not enough?

barche commented 6 years ago

The extra line is necessary to avoid needing all dependent projects to set the C++ standard themselves. I don't think it is problematic in itself, the semicolon after libc++ is strange though, I wonder where it comes from and I think that is the direct cause of the error.

I'm experimenting with testing agains this sort of thing in PR #14

barche commented 6 years ago

I can't reproduce this with the new test, there is no semicolon in this line:

/opt/x86_64-linux-gnu/tools/clang++ --sysroot=/opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root  -DJULIA_ENABLE_THREADING -Dtestlib_EXPORTS -isystem /workspace/destdir/include -isystem /workspace/destdir/include/julia  -march=x86-64 -target x86_64-apple-darwin14 --sysroot /opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root -stdlib=libc++ -target x86_64-apple-darwin14 --sysroot /opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root -stdlib=libc++ -O3 -DNDEBUG -fPIC   -std=c++14 -o CMakeFiles/testlib.dir/testlib.cpp.o -c /workspace/srcdir/testlib/testlib.cpp

I did have to adapt the build script, setting CMAKE_FIND_ROOT_PATH: https://github.com/JuliaInterop/libcxxwrap-julia/blob/master/testlib-builder/build_tarballs.jl#L10

jstrube commented 6 years ago

OK, thanks. I'll try to find out if this is caused by the LCIO dependency. They also use CMAKE; maybe the semicolon sneaks in that way.

jstrube commented 6 years ago

Hmm. I have now reproduced that bug with another project, FastJetWrapBuilder. This line https://travis-ci.com/jstrube/FastJetWrapBuilder/jobs/154017870#L727 also does not contain a semicolon, yet the build still breaks, even on g++. I am a bit puzzled.

jstrube commented 6 years ago

Oh, never mind. That one was on gcc 4.8.5. No wonder that option isn't known...

jstrube commented 6 years ago

I have no idea how, but this seems to be fixed for me now... Maybe there was some stale code picked up from somewhere in my build. Either way, works now. Thanks for looking into this and sorry for the noise.