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

Support for c++17 #265

Open
dinardo opened this issue Apr 27, 2022 · 8 comments
Open

Support for c++17 #265

dinardo opened this issue Apr 27, 2022 · 8 comments

Comments

@dinardo
Copy link

dinardo commented Apr 27, 2022

Dear experts,
is it possible to compile IPbus with --std=c++1z flag?

Many thanks,
Mauro.

@tswilliams
Copy link
Collaborator

Hi,

This should be possible by ovrerriding CXXFLAGS when running make - i.e. make CXXFLAGS="-g -Wall -pedantic -O3 -MMD -MP -fPIC -std=c++1z"

Cheers,
Tom

@dinardo
Copy link
Author

dinardo commented May 10, 2022

Many thanks. I used this make command:

make EXTERN_BOOST_INCLUDE_PREFIX=/home/testbeam/boost_v1_77_0/ EXTERN_BOOST_LIB_PREFIX=/home/testbeam/boost_v1_77_0/stage/lib/ CXXFLAGS="-g -Wall -pedantic -O3 -MMD -MP -fPIC -std=c++1z"

I'm getting this error:

mkdir -p /home/testbeam/ipbus-software/uhal/tests/lib
g++ -shared -Wl,-soname,libcactus_uhal_tests.so.2.8 -Wall -g -O3 -fPIC -Wl,--no-as-needed -lrt /home/testbeam/ipbus-software/uhal/tests/obj/DummyClient.o /home/testbeam/ipbus-software/uhal/tests/obj/DummyDerivedNode.o /home/testbeam/ipbus-software/uhal/tests/obj/DummyHardware.o /home/testbeam/ipbus-software/uhal/tests/obj/PCIeDummyHardware.o /home/testbeam/ipbus-software/uhal/tests/obj/PerfTester_static.o /home/testbeam/ipbus-software/uhal/tests/obj/TCPDummyHardware.o /home/testbeam/ipbus-software/uhal/tests/obj/UDPDummyHardware.o /home/testbeam/ipbus-software/uhal/tests/obj/fixtures.o /home/testbeam/ipbus-software/uhal/tests/obj/test_block.o /home/testbeam/ipbus-software/uhal/tests/obj/test_check_permissions.o /home/testbeam/ipbus-software/uhal/tests/obj/test_client_factory.o /home/testbeam/ipbus-software/uhal/tests/obj/test_config_space.o /home/testbeam/ipbus-software/uhal/tests/obj/test_empty_dispatch.o /home/testbeam/ipbus-software/uhal/tests/obj/test_hierarchy.o /home/testbeam/ipbus-software/uhal/tests/obj/test_masking.o /home/testbeam/ipbus-software/uhal/tests/obj/test_multithreaded.o /home/testbeam/ipbus-software/uhal/tests/obj/test_nodes.o /home/testbeam/ipbus-software/uhal/tests/obj/test_nonreachable.o /home/testbeam/ipbus-software/uhal/tests/obj/test_rawclient.o /home/testbeam/ipbus-software/uhal/tests/obj/test_single.o /home/testbeam/ipbus-software/uhal/tests/obj/test_soak.o /home/testbeam/ipbus-software/uhal/tests/obj/test_timeout.o /home/testbeam/ipbus-software/uhal/tests/obj/test_uri.o /home/testbeam/ipbus-software/uhal/tests/obj/tools.o -L/home/testbeam/boost_v1_77_0/stage/lib/ -L/home/testbeam/ipbus-software/uhal/log/lib -L/home/testbeam/ipbus-software/uhal/grammars/lib -L/home/testbeam/ipbus-software/uhal/uhal/lib -Llib -lcactus_uhal_uhal -lcactus_uhal_grammars -lcactus_uhal_log -lboost_filesystem -lboost_program_options -lboost_unit_test_framework -lboost_regex -lboost_system -lpugixml -lrt -lpthread -o lib/libcactus_uhal_tests.so.2.8.1
ln -s -f /home/testbeam/ipbus-software/uhal/tests/lib/libcactus_uhal_tests.so.2.8.1 lib/libcactus_uhal_tests.so.2.8
ln -s -f /home/testbeam/ipbus-software/uhal/tests/lib/libcactus_uhal_tests.so.2.8 lib/libcactus_uhal_tests.so
g++ -c -g -Wall -pedantic -O3 -MMD -MP -fPIC -std=c++1z  -Iinclude -I/home/testbeam/boost_v1_77_0/ -I/home/testbeam/ipbus-software/uhal/log/include -I/home/testbeam/ipbus-software/uhal/grammars/include -I/home/testbeam/ipbus-software/uhal/uhal/include /home/testbeam/ipbus-software/uhal/tests/src/common/DummyHardwareTcp.cxx -o /home/testbeam/ipbus-software/uhal/tests/obj/DummyHardwareTcp.o
mkdir -p /home/testbeam/ipbus-software/uhal/tests/bin
g++ -Wall -g -O3 -fPIC -Wl,--no-as-needed -lrt /home/testbeam/ipbus-software/uhal/tests/obj/DummyHardwareTcp.o -L/home/testbeam/boost_v1_77_0/stage/lib/ -L/home/testbeam/ipbus-software/uhal/log/lib -L/home/testbeam/ipbus-software/uhal/grammars/lib -L/home/testbeam/ipbus-software/uhal/uhal/lib -Llib -lcactus_uhal_tests -lcactus_uhal_uhal -lcactus_uhal_grammars -lcactus_uhal_log -lboost_filesystem -lboost_program_options -lboost_unit_test_framework -lboost_regex -lboost_system -lpugixml -lrt -lpthread -lstdc++ -o /home/testbeam/ipbus-software/uhal/tests/bin/DummyHardwareTcp.exe
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: warning: libboost_chrono.so.1.77.0, needed by /home/testbeam/ipbus-software/uhal/uhal/lib/libcactus_uhal_uhal.so, not found (try using -rpath or -rpath-link)
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: warning: libboost_atomic.so.1.77.0, needed by /home/testbeam/boost_v1_77_0/stage/lib//libboost_filesystem.so, not found (try using -rpath or -rpath-link)
g++ -c -g -Wall -pedantic -O3 -MMD -MP -fPIC -std=c++1z  -Iinclude -I/home/testbeam/boost_v1_77_0/ -I/home/testbeam/ipbus-software/uhal/log/include -I/home/testbeam/ipbus-software/uhal/grammars/include -I/home/testbeam/ipbus-software/uhal/uhal/include /home/testbeam/ipbus-software/uhal/tests/src/common/DummyHardwareUdp.cxx -o /home/testbeam/ipbus-software/uhal/tests/obj/DummyHardwareUdp.o
g++ -Wall -g -O3 -fPIC -Wl,--no-as-needed -lrt /home/testbeam/ipbus-software/uhal/tests/obj/DummyHardwareUdp.o -L/home/testbeam/boost_v1_77_0/stage/lib/ -L/home/testbeam/ipbus-software/uhal/log/lib -L/home/testbeam/ipbus-software/uhal/grammars/lib -L/home/testbeam/ipbus-software/uhal/uhal/lib -Llib -lcactus_uhal_tests -lcactus_uhal_uhal -lcactus_uhal_grammars -lcactus_uhal_log -lboost_filesystem -lboost_program_options -lboost_unit_test_framework -lboost_regex -lboost_system -lpugixml -lrt -lpthread -lstdc++ -o /home/testbeam/ipbus-software/uhal/tests/bin/DummyHardwareUdp.exe
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: warning: libboost_chrono.so.1.77.0, needed by /home/testbeam/ipbus-software/uhal/uhal/lib/libcactus_uhal_uhal.so, not found (try using -rpath or -rpath-link)
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: warning: libboost_atomic.so.1.77.0, needed by /home/testbeam/boost_v1_77_0/stage/lib//libboost_filesystem.so, not found (try using -rpath or -rpath-link)
g++ -c -g -Wall -pedantic -O3 -MMD -MP -fPIC -std=c++1z  -Iinclude -I/home/testbeam/boost_v1_77_0/ -I/home/testbeam/ipbus-software/uhal/log/include -I/home/testbeam/ipbus-software/uhal/grammars/include -I/home/testbeam/ipbus-software/uhal/uhal/include /home/testbeam/ipbus-software/uhal/tests/src/common/PerfTester.cxx -o /home/testbeam/ipbus-software/uhal/tests/obj/PerfTester.o
g++ -Wall -g -O3 -fPIC -Wl,--no-as-needed -lrt /home/testbeam/ipbus-software/uhal/tests/obj/PerfTester.o -L/home/testbeam/boost_v1_77_0/stage/lib/ -L/home/testbeam/ipbus-software/uhal/log/lib -L/home/testbeam/ipbus-software/uhal/grammars/lib -L/home/testbeam/ipbus-software/uhal/uhal/lib -Llib -lcactus_uhal_tests -lcactus_uhal_uhal -lcactus_uhal_grammars -lcactus_uhal_log -lboost_filesystem -lboost_program_options -lboost_unit_test_framework -lboost_regex -lboost_system -lpugixml -lrt -lpthread -lstdc++ -o /home/testbeam/ipbus-software/uhal/tests/bin/PerfTester.exe
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: warning: libboost_chrono.so.1.77.0, needed by /home/testbeam/ipbus-software/uhal/uhal/lib/libcactus_uhal_uhal.so, not found (try using -rpath or -rpath-link)
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: warning: libboost_atomic.so.1.77.0, needed by /home/testbeam/boost_v1_77_0/stage/lib//libboost_filesystem.so, not found (try using -rpath or -rpath-link)
g++ -c -g -Wall -pedantic -O3 -MMD -MP -fPIC -std=c++1z  -Iinclude -I/home/testbeam/boost_v1_77_0/ -I/home/testbeam/ipbus-software/uhal/log/include -I/home/testbeam/ipbus-software/uhal/grammars/include -I/home/testbeam/ipbus-software/uhal/uhal/include /home/testbeam/ipbus-software/uhal/tests/src/common/run_uhal_tests.cxx -o /home/testbeam/ipbus-software/uhal/tests/obj/run_uhal_tests.o
g++ -Wall -g -O3 -fPIC -Wl,--no-as-needed -lrt /home/testbeam/ipbus-software/uhal/tests/obj/run_uhal_tests.o -L/home/testbeam/boost_v1_77_0/stage/lib/ -L/home/testbeam/ipbus-software/uhal/log/lib -L/home/testbeam/ipbus-software/uhal/grammars/lib -L/home/testbeam/ipbus-software/uhal/uhal/lib -Llib -lcactus_uhal_tests -lcactus_uhal_uhal -lcactus_uhal_grammars -lcactus_uhal_log -lboost_filesystem -lboost_program_options -lboost_unit_test_framework -lboost_regex -lboost_system -lpugixml -lrt -lpthread -lstdc++ -o /home/testbeam/ipbus-software/uhal/tests/bin/run_uhal_tests.exe
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: warning: libboost_chrono.so.1.77.0, needed by /home/testbeam/ipbus-software/uhal/uhal/lib/libcactus_uhal_uhal.so, not found (try using -rpath or -rpath-link)
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: warning: libboost_atomic.so.1.77.0, needed by /home/testbeam/boost_v1_77_0/stage/lib//libboost_filesystem.so, not found (try using -rpath or -rpath-link)
/opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /lib/../lib64/crt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/testbeam/ipbus-software/uhal/config/mfRules.mk:113: /home/testbeam/ipbus-software/uhal/tests/bin/run_uhal_tests.exe] Error 1
make[2]: Leaving directory '/home/testbeam/ipbus-software/uhal/tests'
make[1]: *** [Makefile:49: tests/.virtual.Makefile] Error 2
make[1]: Leaving directory '/home/testbeam/ipbus-software/uhal'
make: *** [Makefile:58: uhal/.virtual.Makefile] Error 2

Both these two libraries are present precisely in the directory /home/testbeam/boost_v1_77_0/stage/lib/:

  • libboost_chrono.so.1.77.0
  • libboost_atomic.so.1.77.0

Instead, if don't use CXXFLAGS="-g -Wall -pedantic -O3 -MMD -MP -fPIC -std=c++1z" everything seems to be compiled properly

@dinardo
Copy link
Author

dinardo commented May 10, 2022

How can I force make to use ONLY my boost personal installation?

@tswilliams
Copy link
Collaborator

tswilliams commented May 12, 2022

Hi,

How can I force make to use ONLY my boost personal installation?

The use of EXTERN_BOOST_INCLUDE_PREFIX and EXTERN_BOOST_LIB_PREFIX should already be including your personal boost installation

Instead, if don't use CXXFLAGS="-g -Wall -pedantic -O3 -MMD -MP -fPIC -std=c++1z" everything seems to be compiled properly

Was boost also compiled with the same -std=c++1z flag?

@dinardo
Copy link
Author

dinardo commented May 12, 2022

I see for example that one of the make command lines is:

g++ -shared -Wl,-soname,libcactus_uhal_tests.so.2.8 -Wall -g -O3 -fPIC -Wl,--no-as-needed -lrt /home/testbeam/ipbus-software/uhal/tests/obj/DummyClient.o /home/testbeam/ipbus-software/uhal/tests/obj/DummyDerivedNode.o /home/testbeam/ipbus-software/uhal/tests/obj/DummyHardware.o /home/testbeam/ipbus-software/uhal/tests/obj/PCIeDummyHardware.o /home/testbeam/ipbus-software/uhal/tests/obj/PerfTester_static.o /home/testbeam/ipbus-software/uhal/tests/obj/TCPDummyHardware.o /home/testbeam/ipbus-software/uhal/tests/obj/UDPDummyHardware.o /home/testbeam/ipbus-software/uhal/tests/obj/fixtures.o /home/testbeam/ipbus-software/uhal/tests/obj/test_block.o /home/testbeam/ipbus-software/uhal/tests/obj/test_check_permissions.o /home/testbeam/ipbus-software/uhal/tests/obj/test_client_factory.o /home/testbeam/ipbus-software/uhal/tests/obj/test_config_space.o /home/testbeam/ipbus-software/uhal/tests/obj/test_empty_dispatch.o /home/testbeam/ipbus-software/uhal/tests/obj/test_hierarchy.o /home/testbeam/ipbus-software/uhal/tests/obj/test_masking.o /home/testbeam/ipbus-software/uhal/tests/obj/test_multithreaded.o /home/testbeam/ipbus-software/uhal/tests/obj/test_nodes.o /home/testbeam/ipbus-software/uhal/tests/obj/test_nonreachable.o /home/testbeam/ipbus-software/uhal/tests/obj/test_rawclient.o /home/testbeam/ipbus-software/uhal/tests/obj/test_single.o /home/testbeam/ipbus-software/uhal/tests/obj/test_soak.o /home/testbeam/ipbus-software/uhal/tests/obj/test_timeout.o /home/testbeam/ipbus-software/uhal/tests/obj/test_uri.o /home/testbeam/ipbus-software/uhal/tests/obj/tools.o -L/home/testbeam/boost_v1_77_0/stage/lib -L/home/testbeam/ipbus-software/uhal/log/lib -L/home/testbeam/ipbus-software/uhal/grammars/lib -L/home/testbeam/ipbus-software/uhal/uhal/lib -Llib -lcactus_uhal_uhal -lcactus_uhal_grammars -lcactus_uhal_log -lboost_filesystem -lboost_program_options -lboost_unit_test_framework -lboost_regex -lboost_system -lpugixml -lrt -lpthread -o lib/libcactus_uhal_tests.so.2.8.1

Is for example -lboost_system taken from my local BOOST or from system BOOST?

Yes indesd, I compiled my local BOOST with: -std=c++1z, this is the sequence of commands:

./bootstrap.sh
./b2 cxxflags=-std=c++1z --prefix=/home/testbeam/boost_v1_77_0/

Did you try yourself to compile v2.8.1 with c++17 ?

Many thanks for your support

@tswilliams
Copy link
Collaborator

Hi,

To understand the situation: Which OS & g++ version are you using?

Cheers,
Tom

@dinardo
Copy link
Author

dinardo commented May 13, 2022

I'm using: CENTOS7 and devtools10

@dinardo
Copy link
Author

dinardo commented Jun 8, 2022

Dear experts,
do you have any insight into this issue?

Many thanks,

  • Mauro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants