bfgroup / b2

B2 makes it easy to build C++ projects, everywhere.
https://www.bfgroup.xyz/b2/
Boost Software License 1.0
76 stars 228 forks source link

bootstrap fails on gcc-8.3 #323

Closed janwilmans closed 4 months ago

janwilmans commented 1 year ago
jan.wilmans@HAMILTON246{~/home/project/b2}: ./bootstrap.sh
Building the B2 engine..

###
###
### Using 'cxx' toolset.
###
###

cpp (Debian 8.3.0-6) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

###
###

> cpp -DNDEBUG bindjam.cpp builtins.cpp class.cpp command.cpp compile.cpp constants.cpp cwd.cpp debug.cpp debugger.cpp execcmd.cpp execnt.cpp execunix.cpp filent.cpp filesys.cpp fileunix.cpp frames.cpp function.cpp glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam_strings.cpp jam.cpp jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp native.cpp option.cpp output.cpp parse.cpp pathnt.cpp pathsys.cpp pathunix.cpp regexp.cpp rules.cpp scan.cpp search.cpp startup.cpp subst.cpp timestamp.cpp value.cpp variable.cpp w32_getreg.cpp mod_jam_builtin.cpp mod_jam_class.cpp mod_jam_errors.cpp mod_jam_modules.cpp mod_order.cpp mod_path.cpp mod_property_set.cpp mod_regex.cpp mod_sequence.cpp mod_set.cpp mod_string.cpp mod_sysinfo.cpp mod_version.cpp -o b2
cpp: fatal error: too many input files
compilation terminated.

Failed to build the B2 engine.

If I use gcc-11.2, it works, but I would really rather use the system-native compiler for b2.

janwilmans commented 1 year ago

I'm not sure how to the issue was introduced, but I found a workaround:

/home/jan.wilmans/home/project/packages-repo/boost/

open b2/src/engine/build.sh and add:

B2_CXX="g++"

at the end of the file likes so:

image

in the boost-project, this file is located at : ./tools/build/src/engine/build.sh and the workaround works for boost too.

janwilmans commented 1 year ago

On gcc-11.2: ./bootstrap reports:

image

while on gcc-8.3 it says:

image

Somehow it detects the "cxx" toolset instead of the "gcc" toolset and continues to use "cpp" instead of "g++"

janwilmans commented 1 year ago

build.sh has an --cxx option, but bootstrap.sh does not, so it doesn't seem possible to override the gcc-exectuable from bootstrap invocation.

grafikrobot commented 1 year ago

build.sh has an --cxx option, but bootstrap.sh does not, so it doesn't seem possible to override the gcc-exectuable from bootstrap invocation.

Which bootstrap.sh are you referring to?

janwilmans commented 1 year ago

the boostrap.sh at the top-level of https://github.com/boostorg/boost/blob/master/bootstrap.sh Sorry about that, I seem to have mixed up references to the b2 bootstrap.sh in the boost project, and the b2 project. I will re-test to be sure this also applies to the top-level bootstrap.sh in the b2 project.

janwilmans commented 1 year ago

No, I was wrong, --cxx=g++8 can be passed, but it doesn't solve the problem, now check_clib() fails:

image

janwilmans commented 1 year ago

The bootstrap.sh in the boost project however: image

but I guess we should consider this out of the scope of the issue ;)

Kojoley commented 1 year ago
> cpp -DNDEBUG bindjam.cpp builtins.cpp class.cpp command.cpp compile.cpp constants.cpp cwd.cpp debug.cpp debugger.cpp execcmd.cpp execnt.cpp execunix.cpp filent.cpp filesys.cpp fileunix.cpp frames.cpp function.cpp glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam_strings.cpp jam.cpp jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp native.cpp option.cpp output.cpp parse.cpp pathnt.cpp pathsys.cpp pathunix.cpp regexp.cpp rules.cpp scan.cpp search.cpp startup.cpp subst.cpp timestamp.cpp value.cpp variable.cpp w32_getreg.cpp mod_jam_builtin.cpp mod_jam_class.cpp mod_jam_errors.cpp mod_jam_modules.cpp mod_order.cpp mod_path.cpp mod_property_set.cpp mod_regex.cpp mod_sequence.cpp mod_set.cpp mod_string.cpp mod_sysinfo.cpp mod_version.cpp -o b2
cpp: fatal error: too many input files
compilation terminated.

Isn't cpp a preprocessor and not a compiler? https://man7.org/linux/man-pages/man1/cpp.1.html

I actually questioned the sanity of this line previously https://github.com/bfgroup/b2/blob/09bd0f675077091a6b9f0f01b03d415f86ba08ff/src/engine/build.sh#L252

@grafikrobot Is there really a platform where cpp is a compiler?

@janwilmans Though if you are telling that g++ is available I don't understand what happens, could you please post output of ./bootstrap.sh --verbose