Discussion:
[Boost-users] [Boost.Math] Weird compiler-error with Clang 3.8
Deniz Bahadir
2017-01-18 13:25:20 UTC
Permalink
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?

The specific error is this:

clang-linux.compile.c++.pch
/home/jenkins/workspace/***@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/***@3/clang38/build/boost-build/b2
-j1 -q \

--build-dir=/home/jenkins/workspace/***@3/clang38/build/boost \
--build-type=minimal --layout=versioned address-model=64 install \

--prefix=/home/jenkins/workspace/***@3/clang38/installed/opt/BENOCS/clang38
\

--libdir=/home/jenkins/workspace/***@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/***@3/clang38/build/boost/boost/bin.v2/libs/math/build
common.mkdir
/home/jenkins/workspace/***@3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8
common.mkdir
/home/jenkins/workspace/***@3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release
common.mkdir
/home/jenkins/workspace/***@3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi
common.mkdir
/home/jenkins/workspace/***@3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi/..
common.mkdir
/home/jenkins/workspace/***@3/clang38/build/boost/boost/bin.v2/libs/math/build/clang-linux-3.8/release/threading-multi/../src
common.mkdir
/home/jenkins/workspace/***@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/***@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/***@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/***@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/***@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/***@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/***@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
--
BENOCS GmbH
Dipl.-Inform. Deniz Bahadir
Winterfeldtstr. 21
10781 Berlin
Germany
Phone: +49 - 30 / 577 0004-22
Email: ***@benocs.com
www.benocs.com

Board of Management:
Michael Wolz, Dr.-Ing. Oliver Holschke, Dr.-Ing. Ingmar Poese
Commercial Register: Amtsgericht Bonn HRB 19378
John Maddock
2017-01-18 17:00:28 UTC
Permalink
Post by Deniz Bahadir
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?
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?)

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.

HTH, John.
Post by Deniz Bahadir
clang-linux.compile.c++.pch
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
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
-j1 -q \
\
--build-type=minimal --layout=versioned address-model=64 install \
\
\
dll-path==/opt/BENOCS/clang38/lib/x86_64-linux-gnu \
toolset=clang-3.8 \
cflags="$CFLAGS" CXXFLAGS="$CXXFLAGS" linkflags="-Wl,--as-needed"
common.mkdir
common.mkdir
common.mkdir
common.mkdir
common.mkdir
common.mkdir
common.mkdir
clang-linux.compile.c++.pch
clang: error: cannot specify -o when generating multiple output files
rm -f
&& "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
"libs/math/build/../src/tr1/pch.hpp"
...failed clang-linux.compile.c++.pch
...skipped
for lack of
...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
Deniz Bahadir
2017-01-19 14:27:14 UTC
Permalink
Post by John Maddock
Post by Deniz Bahadir
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.
Post by John Maddock
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?
Post by John Maddock
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.
Post by John Maddock
HTH, John.
Thanks,
Deniz
Post by John Maddock
Post by Deniz Bahadir
clang-linux.compile.c++.pch
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
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
-j1 -q \
\
--build-type=minimal --layout=versioned address-model=64 install \
\
\
dll-path==/opt/BENOCS/clang38/lib/x86_64-linux-gnu \
toolset=clang-3.8 \
cflags="$CFLAGS" CXXFLAGS="$CXXFLAGS" linkflags="-Wl,--as-needed"
common.mkdir
common.mkdir
common.mkdir
common.mkdir
common.mkdir
common.mkdir
common.mkdir
clang-linux.compile.c++.pch
clang: error: cannot specify -o when generating multiple output files
rm -f
&& "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
"libs/math/build/../src/tr1/pch.hpp"
...failed clang-linux.compile.c++.pch
...skipped
for lack of
...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
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Deniz Bahadir
2017-01-19 15:36:43 UTC
Permalink
Post by Deniz Bahadir
Post by John Maddock
Post by Deniz Bahadir
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.
Post by John Maddock
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.
"$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS)
-D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
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
Post by Deniz Bahadir
Post by John Maddock
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.
Post by John Maddock
HTH, John.
Thanks,
Deniz
Post by John Maddock
Post by Deniz Bahadir
clang-linux.compile.c++.pch
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
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
-j1 -q \
\
--build-type=minimal --layout=versioned address-model=64 install \
\
\
dll-path==/opt/BENOCS/clang38/lib/x86_64-linux-gnu \
toolset=clang-3.8 \
cflags="$CFLAGS" CXXFLAGS="$CXXFLAGS" linkflags="-Wl,--as-needed"
common.mkdir
common.mkdir
common.mkdir
common.mkdir
common.mkdir
common.mkdir
common.mkdir
clang-linux.compile.c++.pch
clang: error: cannot specify -o when generating multiple output files
rm -f
&& "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
"libs/math/build/../src/tr1/pch.hpp"
...failed clang-linux.compile.c++.pch
...skipped
for lack of
...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
http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
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: ***@benocs.com
www.benocs.com

Board of Management:
Michael Wolz, Dr.-Ing. Oliver Holschke, Dr.-Ing. Ingmar Poese
Commercial Register: Amtsgericht Bonn HRB 19378
John Maddock
2017-01-19 17:07:33 UTC
Permalink
Post by Deniz Bahadir
https://github.com/boostorg/build/pull/155
Thanks!

John.

Loading...