Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config checks using address-model=32 in Linux don't use the right flags #368

Closed
3 tasks done
anarthal opened this issue Mar 26, 2024 · 2 comments · Fixed by boostorg/boost#879
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@anarthal
Copy link

Make sure you completed the following tasks

Environment and version details

  • Operating System+version: Linux Ubuntu 22.04 - as per the Docker container ghcr.io/anarthal-containers/build-clang16-i386
  • Compiler+version: clang-16 (also happens with the system's default gcc)
  • Shell: bash
  • B2 Version: Output of b2 -v and b2 --version: B2 5.1.0 (OS=LINUX, jobs=8)
  • B2 Configuration: Output of b2 --debug-configuration in your project.
root@ce785db6e1f3:~/boost-root# ./b2 --debug-configuration libs/mysql/test//fail_if_no_openssl
notice: found boost-build.jam at /root/boost-root/boost-build.jam
notice: loading B2 from /root/boost-root/tools/build/src/build-system.jam
notice: Searching '/etc' '/root' '/root/boost-root/tools/build/src/util' '/root/boost-root/tools/build/src/tools' '/root/boost-root/tools/build/src/options' '/root/boost-root/tools/build/src/engine' '/root/boost-root/tools/build/src/contrib' '/root/boost-root/tools/build/src/build' '/root/boost-root/tools/build/src' for site-config configuration file 'site-config.jam'.
notice: Configuration file 'site-config.jam' not found in '/etc' '/root' '/root/boost-root/tools/build/src/util' '/root/boost-root/tools/build/src/tools' '/root/boost-root/tools/build/src/options' '/root/boost-root/tools/build/src/engine' '/root/boost-root/tools/build/src/contrib' '/root/boost-root/tools/build/src/build' '/root/boost-root/tools/build/src'.
notice: Searching '/root' '/root/boost-root/tools/build/src/util' '/root/boost-root/tools/build/src/tools' '/root/boost-root/tools/build/src/options' '/root/boost-root/tools/build/src/engine' '/root/boost-root/tools/build/src/contrib' '/root/boost-root/tools/build/src/build' '/root/boost-root/tools/build/src' for user-config configuration file 'user-config.jam'.
notice: Configuration file 'user-config.jam' not found in '/root' '/root/boost-root/tools/build/src/util' '/root/boost-root/tools/build/src/tools' '/root/boost-root/tools/build/src/options' '/root/boost-root/tools/build/src/engine' '/root/boost-root/tools/build/src/contrib' '/root/boost-root/tools/build/src/build' '/root/boost-root/tools/build/src'.
notice: Searching '.' for project-config configuration file 'project-config.jam'.
notice: Loading project-config configuration file 'project-config.jam' from '.'.
notice: will use 'clang++' for clang-linux, condition <toolset>clang-linux-16
warning: toolset clang-linux initialization: can not find tool windres
warning: initialized from project-config.jam:12
notice: using rc compiler :: <toolset>clang-linux-16 :: as
notice: [python-cfg] Configuring python...
notice: [python-cfg]   user-specified version: "3.11"
notice: [python-cfg]   user-specified cmd-or-prefix: "/usr"
notice: [python-cfg] Checking interpreter command "/usr/bin/python3.11"...
notice: [python-cfg] running command '/usr/bin/python3.11 -c "from sys import *; print('version=%d.%d\nplatform=%s\nprefix=%s\nexec_prefix=%s\nexecutable=%s' % (version_info[0],version_info[1],platform,prefix,exec_prefix,executable))" 2>&1'
notice: [python-cfg] ...requested configuration matched!
notice: [python-cfg] Details of this Python configuration:
notice: [python-cfg]   interpreter command: "/usr/bin/python3.11"
notice: [python-cfg]   include path: "/usr/include/python3.11"
notice: [python-cfg]   library path: "/usr/lib/python3.11/config" "/usr/lib"
notice: [python-cfg] Checking for NumPy...
notice: [python-cfg] running command '/usr/bin/python3.11 -c "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())"'
notice: [python-cfg] NumPy disabled. Reason:
notice: [python-cfg]   /usr/bin/python3.11 -c "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())" aborted with 
notice: [python-cfg]   Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
notice: [openssl] Using pre-installed library
notice: [openssl] Condition
Performing configuration checks

    - ssl                      : no
OpenSSL could not be found. Don't build target fail_if_no_openssl to skip this check

Please note: fail_if_no_openssl is a Boost.MySQL target that is not yet in the development branch.

Brief problem description

When building in Linux specifying address-model=32 in the command line, configuration checks seem to ignore the setting, which causes libraries to appear as not found.

Steps to reproduce the issue

  1. Create a repro/Jamfile file in the Boost root with the following, to force a config check on the OpenSSL library:
import ac ;
using openssl ;

alias test : requirements [ ac.check-library /openssl//ssl : : <build>no ] ;
  1. Run b2
root@ce785db6e1f3:~/boost-root# ./b2 address-model=32 toolset=clang repro
Performing configuration checks

    - ssl                      : no
...found 1 target...
  1. The output of config.log seems to imply that configuration checks are being run without the -m32 flag, which is causing the test executables to not build. Here's the log:
root@ce785db6e1f3:~/boost-root# cat bin.v2/config.log 
...found 14 targets...
...updating 12 targets...
clang-linux.compile.c++ bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/openssl/ssl_h.o
In file included from bin.v2/standalone/ac/openssl/ssl_h.cpp:1:
In file included from /usr/include/openssl/ssl.h:21:
/usr/include/openssl/macros.h:14:10: fatal error: 'openssl/opensslconf.h' file not found
#include <openssl/opensslconf.h>
         ^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

    "clang++"   -fvisibility-inlines-hidden -fPIC -pthread -O0 -fno-inline -Wall -g -fvisibility=hidden       -c -o "bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/openssl/ssl_h.o" "bin.v2/standalone/ac/openssl/ssl_h.cpp"

...failed clang-linux.compile.c++ bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/openssl/ssl_h.o...

...updated 11 targets...

...failed updating 1 target...
   clang-linux.compile.c++ bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/openssl/ssl_h.o
...found 5 targets...
...updating 3 targets...
clang-linux.compile.c++ bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/main-ssl.o
clang-linux.link bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/ssl
/usr/bin/ld: cannot find -lssl: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

    "clang++"    -o "bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/ssl" -Wl,--start-group "bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/main-ssl.o"  -Wl,-Bstatic  -Wl,-Bdynamic -lrt -lssl -Wl,--end-group -fPIC -pthread -g -fvisibility=hidden -fvisibility-inlines-hidden 

...failed clang-linux.link bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/ssl...

...updated 2 targets...

...failed updating 1 target...
   clang-linux.link bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/ssl
...found 5 targets...
...updating 3 targets...
clang-linux.compile.c++ bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/main-ssleay32.o
clang-linux.link bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/ssleay32
/usr/bin/ld: cannot find -lssleay32: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

    "clang++"    -o "bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/ssleay32" -Wl,--start-group "bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/main-ssleay32.o"  -Wl,-Bstatic  -Wl,-Bdynamic -lrt -lssleay32 -Wl,--end-group -fPIC -pthread -g -fvisibility=hidden -fvisibility-inlines-hidden 

...failed clang-linux.link bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/ssleay32...

...updated 2 targets...

...failed updating 1 target...
   clang-linux.link bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/ssleay32
...found 5 targets...
...updating 5 targets...
clang-linux.compile.c++ bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/link-static/threading-multi/visibility-hidden/main-ssl.o
clang-linux.link bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/link-static/threading-multi/visibility-hidden/ssl
/usr/bin/ld: cannot find -lssl: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

    "clang++"    -o "bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/link-static/threading-multi/visibility-hidden/ssl" -Wl,--start-group "bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/link-static/threading-multi/visibility-hidden/main-ssl.o"  -Wl,-Bstatic -lssl -Wl,-Bdynamic -lrt -Wl,--end-group -pthread -g -fvisibility=hidden -fvisibility-inlines-hidden 

...failed clang-linux.link bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/link-static/threading-multi/visibility-hidden/ssl...

...updated 4 targets...

...failed updating 1 target...
   clang-linux.link bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/link-static/threading-multi/visibility-hidden/ssl
...found 2 targets...
...updating 2 targets...
clang-linux.compile.c++ bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/link-static/threading-multi/visibility-hidden/main-ssleay32.o
clang-linux.link bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/link-static/threading-multi/visibility-hidden/ssleay32
/usr/bin/ld: cannot find -lssleay32: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

    "clang++"    -o "bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/link-static/threading-multi/visibility-hidden/ssleay32" -Wl,--start-group "bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/link-static/threading-multi/visibility-hidden/main-ssleay32.o"  -Wl,-Bstatic -lssleay32 -Wl,-Bdynamic -lrt -Wl,--end-group -pthread -g -fvisibility=hidden -fvisibility-inlines-hidden 

...failed clang-linux.link bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/link-static/threading-multi/visibility-hidden/ssleay32...

...updated 1 target...

...failed updating 1 target...
   clang-linux.link bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/link-static/threading-multi/visibility-hidden/ssleay32
...found 1 target...
...updating 1 target...
config-cache.write bin.v2/project-cache.jam

...updated 1 target...

Running the check "clang++" -fvisibility-inlines-hidden -fPIC -pthread -O0 -fno-inline -Wall -g -fvisibility=hidden -c -o "bin.v2/standalone/ac/clang-linux-16/debug/address-model-32/threading-multi/visibility-hidden/openssl/ssl_h.o" "bin.v2/standalone/ac/openssl/ssl_h.cpp" adding the -m32 flag succeeds.

  1. Note that libssl-dev:i386 is installed on the machine, but not libssl-dev:i686.
  2. Running ./b2 address-model=32 toolset=clang architecture=x86 repro succeeds.

Actual behavior summary

Expected behavior summary

We shouldn't need to specify architecture=x86 for config checks to succeed, since we don't need it for the code to build.

@anarthal anarthal added the bug Something isn't working label Mar 26, 2024
@grisumbras
Copy link
Contributor

The problem is with deduction rules in https://github.com/boostorg/boost, the issue should be moved there.

@pdimov
Copy link
Contributor

pdimov commented Apr 18, 2024

I merged the linked PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants