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

Fails to build with LTO enabled #222

Open
dbermond opened this issue Jan 22, 2022 · 6 comments
Open

Fails to build with LTO enabled #222

dbermond opened this issue Jan 22, 2022 · 6 comments

Comments

@dbermond
Copy link

Copperspice 1.7.3 fails to build for me with LTO enabled. Disabling LTO makes it to build fine. Error log:

[  7%] Linking CXX shared library ../../lib/libCsSql1.7.so

...

/usr/bin/ld: /tmp/ccGk6fNj.ltrans0.ltrans.o:(.data.rel.ro+0x20): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccGk6fNj.ltrans0.ltrans.o:(.data.rel.ro+0x788): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccGk6fNj.ltrans0.ltrans.o:(.data.rel.ro+0x8a0): undefined reference to `QAbstractItemModel::metaObject() const'
/usr/bin/ld: /tmp/ccGk6fNj.ltrans0.ltrans.o:(.data.rel.ro+0xac8): undefined reference to `QAbstractTableModel::metaObject() const'
/usr/bin/ld: /tmp/ccGk6fNj.ltrans0.ltrans.o:(.data.rel.ro+0x17a0): undefined reference to `QAbstractItemModel::metaObject() const'
/usr/bin/ld: /tmp/ccGk6fNj.ltrans0.ltrans.o:(.data.rel.ro+0x19c8): undefined reference to `QAbstractTableModel::metaObject() const'
/usr/bin/ld: /tmp/ccGk6fNj.ltrans0.ltrans.o:(.data.rel.ro+0x27b8): undefined reference to `QObject::metaObject() const'
collect2: error: ld returned 1 exit status
make[2]: *** [src/sql/CMakeFiles/CsSql.dir/build.make:339: lib/libCsSql1.7.so] Error 1
make[2]: Leaving directory '/build/copperspice/src/build'
make[1]: *** [CMakeFiles/Makefile2:738: src/sql/CMakeFiles/CsSql.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

...

[ 13%] Linking CXX shared library ../../lib/libCsScript1.7.so
make[2]: Leaving directory '/build/copperspice/src/build'
[ 13%] Built target lupdate
[ 13%] Linking CXX shared library ../../lib/libCsNetwork1.7.so
/usr/bin/ld: /tmp/ccGP8vHp.ltrans0.ltrans.o: in function `ctiVMThrowTrampoline':
<artificial>:(.text+0x4c): undefined reference to `cti_vm_throw'
/usr/bin/ld: /tmp/ccGP8vHp.ltrans0.ltrans.o:(.data.rel.ro+0x8998): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccGP8vHp.ltrans1.ltrans.o:(.data.rel.ro+0x3a8): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccGP8vHp.ltrans8.ltrans.o:(.data.rel.ro+0x20): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccGP8vHp.ltrans39.ltrans.o:(.data.rel.ro+0x70): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccGP8vHp.ltrans39.ltrans.o:(.data.rel.ro+0x188): undefined reference to `QThread::metaObject() const'
/usr/bin/ld: /tmp/ccGP8vHp.ltrans39.ltrans.o:(.data.rel.ro+0x508): undefined reference to `QThread::metaObject() const'
collect2: error: ld returned 1 exit status
make[2]: *** [src/script/CMakeFiles/CsScript.dir/build.make:2931: lib/libCsScript1.7.so] Error 1
make[2]: Leaving directory '/build/copperspice/src/build'
make[1]: *** [CMakeFiles/Makefile2:712: src/script/CMakeFiles/CsScript.dir/all] Error 2
/usr/bin/ld: /tmp/ccaAfqHs.ltrans0.ltrans.o:(.data.rel.ro+0x1080): undefined reference to `QIODevice::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans0.ltrans.o:(.data.rel.ro+0x4cd8): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans1.ltrans.o:(.data.rel.ro+0x788): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans1.ltrans.o:(.data.rel.ro+0xb38): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans4.ltrans.o:(.data.rel.ro+0x3d0): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans4.ltrans.o:(.data.rel.ro+0x6a0): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans4.ltrans.o:(.data.rel.ro+0x990): more undefined references to `QObject::metaObject() const' follow
/usr/bin/ld: /tmp/ccaAfqHs.ltrans14.ltrans.o:(.data.rel.ro+0x148): undefined reference to `QIODevice::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans14.ltrans.o:(.data.rel.ro+0x3a8): undefined reference to `QIODevice::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans15.ltrans.o:(.data.rel.ro+0x90): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans16.ltrans.o:(.data.rel.ro+0x58): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans17.ltrans.o:(.data.rel.ro+0x1a0): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans22.ltrans.o:(.data.rel.ro+0x20): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans22.ltrans.o:(.data.rel.ro+0x138): undefined reference to `QNonContiguousByteDevice::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans25.ltrans.o:(.data.rel.ro+0x1a0): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans25.ltrans.o:(.data.rel.ro+0x2b8): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans27.ltrans.o:(.data.rel.ro+0x80): undefined reference to `QThreadPool::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans32.ltrans.o:(.data.rel.ro+0x38): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans32.ltrans.o:(.data.rel.ro+0x2c0): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans35.ltrans.o:(.data.rel.ro+0x80): undefined reference to `QObject::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans35.ltrans.o:(.data.rel.ro+0x198): undefined reference to `QSocketNotifier::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans35.ltrans.o:(.data.rel.ro+0x580): undefined reference to `QSocketNotifier::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans35.ltrans.o:(.data.rel.ro+0x6e0): undefined reference to `QSocketNotifier::metaObject() const'
/usr/bin/ld: /tmp/ccaAfqHs.ltrans35.ltrans.o:(.data.rel.ro+0x840): undefined reference to `QSocketNotifier::metaObject() const'
collect2: error: ld returned 1 exit status
make[2]: *** [src/network/CMakeFiles/CsNetwork.dir/build.make:1317: lib/libCsNetwork1.7.so] Error 1
make[2]: Leaving directory '/build/copperspice/src/build'
make[1]: *** [CMakeFiles/Makefile2:659: src/network/CMakeFiles/CsNetwork.dir/all] Error 2
make[1]: Leaving directory '/build/copperspice/src/build'
make: *** [Makefile:156: all] Error 2
make: Leaving directory '/build/copperspice/src/build'

Build options:

cmake -B build -S copperspice-cs-1.7.3 \
        -DCMAKE_BUILD_TYPE:STRING='None' \
        -DCMAKE_INSTALL_BINDIR:PATH='lib/copperspice/bin' \
        -DCMAKE_INSTALL_INCLUDEDIR:PATH='include/copperspice' \
        -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
        -Wno-dev

Build flags:

CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -flto
CXXFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto
LDFLAGS: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto

System information:

  • Arch Linux x86_64
  • gcc 11.1.0
  • CMake 3.22.1
@bgeller
Copy link
Member

bgeller commented Dec 27, 2023

As expected, CS builds with LTO disabled. Most likely the build machine exceeded the available memory.

Did you try this with a newer version of CopperSpice?

@dbermond
Copy link
Author

The same error still persists with latest Copperspice 1.8.2 when building with LTO enabled.

This does not look like to be related to the available machine memory, otherwise the OOM killer would be triggered, which is not the case. And the error also occurs in a build server with 256GiB of RAM, which should be more than enough to build virtually anything.

@dbermond dbermond reopened this Dec 28, 2023
@dbermond
Copy link
Author

Also, the error is of type "undefined reference", which does any have any relation to the amount of available machine memory.

@bgeller
Copy link
Member

bgeller commented Dec 28, 2023

We mentioned this because another user run out of memory building with LTO enabled. A CS team member is going to test this again.

@dbermond
Copy link
Author

Thank you.

@bgeller
Copy link
Member

bgeller commented Jan 3, 2024

We were able to repeat this behavior on Debian and it looks like something similar to an import/export issue. Trying a few things to see if it can be resolved easily.

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