CopperSpice Yotco Layer

Discuss issues related to installing or building
Post Reply
ablaylock
Posts: 4
Joined: Tue Dec 31 2024 7:09 pm

CopperSpice Yotco Layer

Post by ablaylock »

Hello,

I am trying to add a CopperSpice Yocto Layer. I am partially able to get the build working however the build fails during the link step. The link step takes a few hours to fail on a fairly recent processor - Ryzen 5950x. I am assuming trying to resolve symbols in all of the object files because when the build does finally fail the following output is produced (full output here https://gist.github.com/ablaylock/6ad11f0f759e0d532a385728101ba94e):
/home/dev/yocto/poky/build/tmp/work/core2-64-poky-linux/copperspice/1.0.10+gitAUTOINC+036ae96b22-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/11.3.0/ld: src/gui/CMakeFiles/CsGui.dir/platform/qplatform_systemtrayicon.cpp.o: in function `QMetaObject_T<QPlatformSystemTrayIcon>::superClass() const':
qplatform_systemtrayicon.cpp:(.text._ZNK13QMetaObject_TI23QPlatformSystemTrayIconE10superClassEv[_ZNK13QMetaObject_TI23QPlatformSystemTrayIconE10superClassEv]+0x1): undefined reference to `QObject::staticMetaObject()'
/home/dev/yocto/poky/build/tmp/work/core2-64-poky-linux/copperspice/1.0.10+gitAUTOINC+036ae96b22-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/11.3.0/ld: src/gui/CMakeFiles/CsGui.dir/platform/qplatform_systemtrayicon.cpp.o:(.data.rel.ro._ZTC23QPlatformSystemTrayIcon0_7QObject[_ZTV23QPlatformSystemTrayIcon]+0x20): undefined reference to `QObject::metaObject() const'
/home/dev/yocto/poky/build/tmp/work/core2-64-poky-linux/copperspice/1.0.10+gitAUTOINC+036ae96b22-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/11.3.0/ld: src/gui/CMakeFiles/CsGui.dir/platform/qplatform_themeplugin.cpp.o:(.data.rel.ro._ZTC20QPlatformThemePlugin0_7QObject[_ZTV20QPlatformThemePlugin]+0x20): undefined reference to `QObject::metaObject() const'
/home/dev/yocto/poky/build/tmp/work/core2-64-poky-linux/copperspice/1.0.10+gitAUTOINC+036ae96b22-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/11.3.0/ld: src/gui/CMakeFiles/CsGui.dir/styles/qstyleplugin.cpp.o:(.data.rel.ro._ZTC12QStylePlugin0_7QObject[_ZTV12QStylePlugin]+0x20): undefined reference to `QObject::metaObject() const'
I have gotten CopperSpice to be built if only the core is enabled, as soon as the QtGui is enabled (no other modules) the linker error occurs.


I have examined these threads to get the basic build off the ground:
https://forum.copperspice.com/viewtopic.php?f=9&t=1605&p=3773
https://forum.copperspice.com/viewtopic.php?f=11&t=1976&p=4959

The meta layer along with basic build instructions can be found here:
https://github.com/ablaylock/meta-copperspice.git

Initially I was trying to build this for an ARM target, however I thought there might be something specific to the architecture going on so I switched to use the main upstream poke yocto distribution targeting x86_64 which still exhibits the issue.

Another issue to be aware of for anyone attempting to reproduce this issue is the build takes a significant amount of RAM per thread. My system doesn’t have issues if I allocate 4GB of RAM per build thread (or limit the number of threads to avaliable RAM).
barbara
Posts: 479
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: CopperSpice Yotco Layer

Post by barbara »

We are not sure what problem you are attempting to solve. Can you start by explaining the overall idea of your work. That might help us figure out what you want to do.

We cross compile CopperSpice on a Debian x86_64 computer to generate the binary files for Raspberry Pi. This is one of the ways we test CS and ensure we maintain support for ARM. It is not feasible or practical to build the CS binary files directly on the Raspberry Pi.
. . . the build takes a significant amount of RAM per thread. My system doesn’t have issues if I allocate 4GB of RAM per build thread (or limit the number of threads to avaliable RAM).
CopperSpice is a large set of libraries and we suggest at least 32GB for a C++ development system, most of our stand alone computers have 64 GB. Our main build Server has 128GB and runs multiple CI platforms using Docker and a KVM.

If you are building using 4GB you will will only be able to build using a -j1 flag on the Ninja command line.

Before you start cross compiling CS it might be a good idea to ensure you can build the binary files for your development platform. If you need more information about this process please take a look at the first few blogs on our CS Journal.

https://journal.copperspice.com/?p=180

Barbara
ablaylock
Posts: 4
Joined: Tue Dec 31 2024 7:09 pm

Re: CopperSpice Yotco Layer

Post by ablaylock »

Hello Barbara,

Thank you so much for the responce!

I am attempting to add a Yocto layer for CopperSpice that can be used by developers who use Yocto to build custom linux images. I would use this layer to build CopperSpice for an iMX7 based platform where the base image and "SDK" is build via Yocto. I've reviewed the build process for the Raspberry Pi which provided the basis for my Yocto recipe.

Yocto allows developers to set up a cross-compile environment to avoid compiling projects on the target hardware and map all build dependencies for distribution packages.

I did find another post regarding the compiling requirements of CopperSpice and have a system that can allocate up to 128GB of memory, in my attempt to get CS building in Yocto I initially had issues with out of memory because I missed the requirement. This has been resolved.
Before you start cross compiling CS it might be a good idea to ensure you can build the binary files for your development platform. If you need more information about this process please take a look at the first few blogs on our CS Journal.

https://journal.copperspice.com/?p=180
I have verified I can build the binary files for my development platform by using the SDK generated by Yocto. The SDK makes an environment with the cross-compiler, compile flags, cmake toolchain, system-root, etc necessary to build for the target platform.

Reading the link at https://journal.copperspice.com/?p=180 it looks like the CMAKE_PREFIX_PATH might be important for the full Yocto build to set and gives me something new to examine. Do you have more details on how the CMAKE_PREFIX_PATH is used in the build phase and what files/directory structures are expected to be located there?

The link says:
Line 5 sets a CMake variable [CMAKE_PREFIX_PATH] indicating a path where the build system can find the CopperSpice CMake export files. You will need to adjust this path to match the exact location where CS is installed on your system.
Is this the location of a bootstrapping CS build (for cross compile targets, things like rcc and uic) or somehow related to an early step of the build and should point to the build directory of the current build?
ablaylock
Posts: 4
Joined: Tue Dec 31 2024 7:09 pm

Re: CopperSpice Yotco Layer

Post by ablaylock »

It looks like I am mistaken about the CMAKE_PREFIX_PATH. This appears to only be necessary for building applications which I am able to do. My issue is building the CopperSpice library as part of the Yocto build system.

At the moment I am trying to compare the generated temp files to see if there are differences between the .ii files (generated using --save-temps on the compiler) for the successful build using the SDK and the failed build as part of the full image build. Any additional ideas on troubleshooting why there are undefined references at link time when built as part of Yocto vs using the resulting SDK from Yocto would be appreciated.
ablaylock
Posts: 4
Joined: Tue Dec 31 2024 7:09 pm

Re: CopperSpice Yotco Layer

Post by ablaylock »

I was able to determine the cause of the linking errors while building as part of the full image build. An inherited CXX_FLAGS, -fvisibility-inlines-hidden was causing a variety of symbols not to be available from the classes at link time.

For those interested the layer is here: https://github.com/ablaylock/meta-copperspice.git
Post Reply