[CLN-list] Linking against cln fails when built with link-time-optimization
Alexey Sheplyakov
asheplyakov at yandex.ru
Sun Sep 20 18:35:56 CEST 2020
Hi!
20.09.2020, 15:11, "Atri Bhattacharya" <badshah400 at opensuse.org>:
> Hello,
> When the shared library for CLN is built with link-time optimization
> [1] (LTO) enabled, linking against libcln.so fails (for example GiNaC
> fails to build).
Can't reproduce it here with gcc 7.5 and binutils 2.30.
git clone git://ginac.de/ginac.git
cd ginac
git clone -b cmake git://github.com/asheplyakov/cln.git
mkdir _build
cd _build
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_SHARED_LINKER_FLAGS='-flto' -DCMAKE_CXX_FLAGS='-std=c++11 -O2 -g -Wall -flto' -DCMAKE_C_FLAGS='-O2 -g -Wall -flto' ..
ninja test_suite
ninja test | tail -n 3
100% tests passed, 0 tests failed out of 62
Total Test time (real) = 341.58 sec
This builds both CLN and GiNaC and runs test suites (both GiNaC and CLN's ones).
I've verified that '-flto' switch has been passed to the compiler and the linker, and
noticed those memory hungry 'lto1' processes.
> This issue was first reported [2] against openSUSE Tumbleweed which
> builds its packages with LTO flags by default;
> $ g++ example.cpp -lginac
This looks wrong, one should link with both GiNaC and CLN:
g++ example.cpp -lginac -lcln
(I'm not sure this is the root cause, though)
Best regards,
Alexey
More information about the CLN-list
mailing list