Open notzain opened 1 week ago
I am not sure what is the root issue. It seems that the error message indicate that the compiler bug. I think that the following approach could help you.
FYI:
I tried the separate compilation mode using the following g++:
g++ (GCC) 14.1.1 20240522
Copyright (C) 2024 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.
no error is occurred.
i upgraded to 8.0.0, and tried with GCC12. This is the latests GCC available to me, and it has the same issue. I'm also using Boost 1.85, if that makes a difference
Unfortunately I can't fix it internal compiler error that is solved in newer g++ version. Because I don't have much knowledge the internal implementation of g++.
But according to the outpug message, the error is related to dwarf2out.c
. Perhaps remove debug -g
, -gdb3
etc option could something different if you set it.
I come up with other approach but it is very hard way.
Disable the following part using #if 0
and observe the result. The error would disappear. The separated compiled library is incomplete. But if the error is disappeared, we might be able to narrow down the scope of the investigation.
I created g++-12 environment using docker ubuntu.
Then I got the following result. It seems that no errors are reported.
root@e50c20bf7c03:/var/work/clb_ubu# BOOST_ROOT=../tmp_boost/boost_1_85_0/stage/ cmake -DASYNC_MQTT_BUILD_EXAMPLES=ON -DCMAKE_CXX_COMPILER="g++-12" ..
-- Setting minimum C++ standard to C++17
-- Dynamically linking with Boost
-- Dynamically linking with Openssl
-- TLS disabled
-- WS disabled
-- Logging disabled
-- Print payload disabled
-- Found Boost: /var/work/tmp_boost/boost_1_85_0/stage/lib/cmake/Boost-1.85.0/BoostConfig.cmake (found suitable version "1.85.0", minimum required is "1.81.0")
-- Examples enabled
-- C++20 examples added
-- Tools disabled
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /var/work/clb_ubu
root@e50c20bf7c03:/var/work/clb_ubu# cd example/
root@e50c20bf7c03:/var/work/clb_ubu/example# ls
CMakeFiles Makefile cacert.pem client.crt.pem client.key.pem cmake_install.cmake mosquitto.org.crt separate_client separate_endpoint
root@e50c20bf7c03:/var/work/clb_ubu/example# cd separate_client/
root@e50c20bf7c03:/var/work/clb_ubu/example/separate_client# make VERBOSE=1
cd /var/work/clb_ubu && /usr/bin/cmake -S/var/work -B/var/work/clb_ubu --check-build-system CMakeFiles/Makefile.cmake 0
cd /var/work/clb_ubu && /usr/bin/cmake -E cmake_progress_start /var/work/clb_ubu/CMakeFiles /var/work/clb_ubu/example/separate_client//CMakeFiles/progress.marks
cd /var/work/clb_ubu && make -f CMakeFiles/Makefile2 example/separate_client/all
make[1]: Entering directory '/var/work/clb_ubu'
make -f example/separate_client/CMakeFiles/separate_client.dir/build.make example/separate_client/CMakeFiles/separate_client.dir/depend
make[2]: Entering directory '/var/work/clb_ubu'
cd /var/work/clb_ubu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /var/work /var/work/example/separate_client /var/work/clb_ubu /var/work/clb_ubu/example/separate_client /var/work/clb_ubu/example/separate_client/CMakeFiles/separate_client.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/var/work/clb_ubu'
make -f example/separate_client/CMakeFiles/separate_client.dir/build.make example/separate_client/CMakeFiles/separate_client.dir/build
make[2]: Entering directory '/var/work/clb_ubu'
[ 33%] Building CXX object example/separate_client/CMakeFiles/separate_client.dir/async_mqtt.cpp.o
cd /var/work/clb_ubu/example/separate_client && /usr/bin/g++-12 -DASYNC_MQTT_SEPARATE_COMPILATION -DBOOST_PROGRAM_OPTIONS_DYN_LINK -I/var/work/include -isystem /var/work/tmp_boost/boost_1_85_0 -std=c++20 -MD -MT example/separate_client/CMakeFiles/separate_client.dir/async_mqtt.cpp.o -MF CMakeFiles/separate_client.dir/async_mqtt.cpp.o.d -o CMakeFiles/separate_client.dir/async_mqtt.cpp.o -c /var/work/example/separate_client/async_mqtt.cpp
[ 66%] Building CXX object example/separate_client/CMakeFiles/separate_client.dir/main.cpp.o
cd /var/work/clb_ubu/example/separate_client && /usr/bin/g++-12 -DASYNC_MQTT_SEPARATE_COMPILATION -DBOOST_PROGRAM_OPTIONS_DYN_LINK -I/var/work/include -isystem /var/work/tmp_boost/boost_1_85_0 -std=c++20 -MD -MT example/separate_client/CMakeFiles/separate_client.dir/main.cpp.o -MF CMakeFiles/separate_client.dir/main.cpp.o.d -o CMakeFiles/separate_client.dir/main.cpp.o -c /var/work/example/separate_client/main.cpp
[100%] Linking CXX executable separate_client
cd /var/work/clb_ubu/example/separate_client && /usr/bin/cmake -E cmake_link_script CMakeFiles/separate_client.dir/link.txt --verbose=1
/usr/bin/g++-12 CMakeFiles/separate_client.dir/async_mqtt.cpp.o CMakeFiles/separate_client.dir/main.cpp.o -o separate_client
make[2]: Leaving directory '/var/work/clb_ubu'
[100%] Built target separate_client
make[1]: Leaving directory '/var/work/clb_ubu'
/usr/bin/cmake -E cmake_progress_start /var/work/clb_ubu/CMakeFiles 0
root@e50c20bf7c03:/var/work/clb_ubu/example/separate_client# g++ --version
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 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.
root@e50c20bf7c03:/var/work/clb_ubu/example/separate_client#
root@e50c20bf7c03:/var/work/clb_ubu/example/separate_client# g++-12 --version
g++-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
Copyright (C) 2022 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.
root@e50c20bf7c03:/var/work/clb_ubu/example/separate_client# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"
I just merged 3d4cdd6decf0ef62ed9a421a29a62e448d014229.
I'm not sure if this commit will help you, but it provides another way to build a separately compiled library.
cmake -DASYNC_MQTT_BUILD_LIB=ON ..
make async_mqtt_separate
See https://redboltz.github.io/async_mqtt/doc/latest/separate.html for more details.
If the internal error is caused by memory consumption (separate compilation requires instantiating many templates), this approach might help. It allows you to compile each .ipp file step by step.
I'm trying out this library, and am getting stuck on the seperate compilation. To clarify, I'm using Conan to repackage your library. This is on Ubuntu 22, GCC11 with C++20.