Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Math] Weird compiler-error with Clang 3.8
From: Deniz Bahadir (deniz.bahadir_at_[hidden])
Date: 2017-01-19 10:36:43


Am 19.01.2017 um 15:27 schrieb Deniz Bahadir:
> Am 18.01.2017 um 18:00 schrieb John Maddock:
>>
>>
>> On 18/01/2017 13:25, Deniz Bahadir wrote:
>>> Hi guys,
>>>
>>> Our build-server (Jenkins) tried to build Boost 1.58 with Clang 3.8
>>> and libc++ and tripped over an error that I do not understand.
>>> Maybe someone can shed some light on it?
>
> I can, now.
>
>
>>
>> A probable workaround is to build with pch=off, but I don't understand
>> the error either, it's something to do with your specific version of
>> clang not understanding the command line (which I believe is the same as
>> for gcc, so it should work?)
>
> Actually, these lines look quite different.
>
> from gcc.jam:
> "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS)
> -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
>
> from clang-linux.jam:
> rm -f "$(<)" && "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS)
> $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -emit-pth -o "$(<)"
> "$(>)"
>
> Note the "-c" option which is there in the GCC command but missing in
> the Clang command?
> With it missing, Clang seems to try to generate pre-compiled headers and
> link them (to what?) which would generate multiple output files.
> Therefore the error-message.
>
> BTW, this is not only true for Boost.Build command
> "clang-linux.compile.c++.pch" but also for "clang-linux.compiler.c.pch".
>
> After I added the "-c" option to both commands, it compiles fine.
>
>
> A patch for the 1.58.0 release is attached.
> Should I create a pull-request to Boost.Build with this fix?
>

I created a pull-request:
https://github.com/boostorg/build/pull/155

>
>>
>> Everything works fine for me with my clang version on Ubuntu BTW, but if
>> you can figure out what the issue with the command line is, we might be
>> able to fix it in the build scripts.
>>
>
> I am wondering why your Clang version seems to work fine. I tested Clang
> 3.8 and Clang 3.7 and both fail with the "-c" option missing.
>
> However, just a few days ago I was able to compile everything with Clang
> 3.8 without any problems!?
> However, some linker-options changed since then. (I added "-lc++abi" and
> "-Wl,--as-needed".) And some updates where installed to the Ubuntu OS...
> So I cannot really tell what made the difference.
>
>
>> HTH, John.
>>
>
> Thanks,
> Deniz
>
>>>
>>> The specific error is this:
>>>
>>> clang-linux.compile.c++.pch
>>> /home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi/../src/tr1/pch.hpp.pth
>>>
>>>
>>> clang: error: cannot specify -o when generating multiple output files
>>>
>>> Does this look familiar to anyone?
>>>
>>> My build-environment is Ubuntu 16.04 x86_64 and I invoked Boost.Build
>>> like this:
>>>
>>>
>>> cd /home/jenkins/workspace/Pipeline_Boost/sources/boost_1_58_0
>>> COMMON_COMPILER_FLAGS="-m64 -fpic -fdiagnostics-color=always -O3"
>>> CFLAGS="$COMMON_COMPILER_FLAGS"
>>> CXXFLAGS="$COMMON_COMPILER_FLAGS -std=c++14 -stdlib=libc++
>>> -isystem/usr/include/libcxxabi -lc++abi"
>>> CC=/usr/bin/clang-3.8
>>> CXX=/usr/bin/clang++-3.8
>>>
>>> /home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost-build/b2
>>> -j1 -q \
>>>
>>> --build-dir=/home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost
>>> \
>>> --build-type=minimal --layout=versioned address-model=64 install \
>>>
>>> --prefix=/home/jenkins/workspace/Pipeline_Boost_at_3/clang38/installed/opt/BENOCS/clang38
>>>
>>> \
>>>
>>> --libdir=/home/jenkins/workspace/Pipeline_Boost_at_3/clang38/installed/opt/BENOCS/clang38/lib/x86_64-linux-gnu
>>>
>>> \
>>> dll-path==/opt/BENOCS/clang38/lib/x86_64-linux-gnu \
>>> toolset=clang-3.8 \
>>> cflags="$CFLAGS" CXXFLAGS="$CXXFLAGS" linkflags="-Wl,--as-needed"
>>>
>>>
>>> The more detailed error-message is the following:
>>>
>>>
>>> common.mkdir
>>> /home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build
>>>
>>>
>>> common.mkdir
>>> /home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8
>>>
>>>
>>> common.mkdir
>>> /home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release
>>>
>>>
>>> common.mkdir
>>> /home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi
>>>
>>>
>>> common.mkdir
>>> /home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi/..
>>>
>>>
>>> common.mkdir
>>> /home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi/../src
>>>
>>>
>>> common.mkdir
>>> /home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi/../src/tr1
>>>
>>>
>>> clang-linux.compile.c++.pch
>>> /home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi/../src/tr1/pch.hpp.pth
>>>
>>>
>>> clang: error: cannot specify -o when generating multiple output files
>>>
>>> rm -f
>>> "/home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi/../src/tr1/pch.hpp.pth"
>>>
>>> && "clang++" -x c++-header -m64 -fpic -fdiagnostics-color=always -O3
>>> -std=c++14 -stdlib=libc++ -isystem/usr/include/libcxxabi -lc++abi -m64
>>> -fpic -fdiagnostics-color=always -O3 -O3 -Wno-inline -Wall -pthread
>>> -fPIC -m64 -m64 -fpic -fdiagnostics-color=always -O3 -std=c++14
>>> -stdlib=libc++ -isystem/usr/include/libcxxabi -lc++abi -m64 -fpic
>>> -fdiagnostics-color=always -O3 -DBOOST_ALL_NO_LIB=1
>>> -DBOOST_BUILD_PCH_ENABLED -DBOOST_MATH_TR1_DYN_LINK=1 -DNDEBUG -I"."
>>> -I"libs/math/src/tr1" -Xclang -emit-pth -o
>>> "/home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi/../src/tr1/pch.hpp.pth"
>>>
>>> "libs/math/build/../src/tr1/pch.hpp"
>>>
>>> ...failed clang-linux.compile.c++.pch
>>> /home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi/../src/tr1/pch.hpp.pth...
>>>
>>>
>>> ...skipped
>>> <p/home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi>assoc_laguerre.o
>>>
>>> for lack of
>>> <p/home/jenkins/workspace/Pipeline_Boost_at_3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi>../src/tr1/pch.hpp.pth...
>>>
>>>
>>> ...failed updating 1 target...
>>> ...skipped 1 target...
>>> ...updated 11871 targets...
>>>
>>>
>>> Can someone tell me what is going on and how to fix or work around
>>> this problem?
>>>
>>> Thanks,
>>> Deniz
>>>
>>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
BENOCS GmbH
Dipl.-Inform. Deniz Bahadir
Winterfeldtstr. 21
10781 Berlin
Germany
Phone: +49 - 30 / 577 0004-22
Email: deniz.bahadir_at_[hidden]
www.benocs.com
Board of Management:
   Michael Wolz, Dr.-Ing. Oliver Holschke, Dr.-Ing. Ingmar Poese
Commercial Register: Amtsgericht Bonn HRB 19378

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net