jwinarske / meta-luxonis

Luxonis Meta Layer for Yocto
Apache License 2.0
1 stars 3 forks source link

Failure to build kirkstone #6

Open travisariggs opened 1 year ago

travisariggs commented 1 year ago

First, Joel, thank you for publishing this layer.

I am trying to build depthai-core on the kirkstone branch with bitbake, but getting a failure.

Full disclosure: I am not a Yocto expert.

Here are some of the key lines of the log surrounding the failure:

FAILED: libdepthai-core.so.2.20.2 
...
/home/travis/src/ros/yocto-common-2/tmp/work/skylake-64-oe-linux/depthai-core/2.20.2-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/11.3.0/ld: /home/travis/src/ros/yocto-common-2/tmp/work/skylake-64-oe-linux/depthai-core/2.20.2-r0/recipe-sysroot/usr/lib/libarchive_static.a(archive_entry.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/home/travis/src/ros/yocto-common-2/tmp/work/skylake-64-oe-linux/depthai-core/2.20.2-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/11.3.0/ld: failed to set dynamic section sizes: bad value

collect2: error: ld returned 1 exit status
...
ninja: build stopped: subcommand failed.
WARNING: exit code 1 from a shell command.

Full log attached here: log.do_compile.820910.log

Here is the output of bb -e depthai-core: yocto-e.log

Do you have any suggestions?

jwinarske commented 1 year ago

I haven't tried it on x86_64, only aarch64. Hmm. You might start with adding this to the depthai-core recipe:

EXTRA_OECMAKE += " -DCMAKE_POSITION_INDEPENDENT_CODE=ON"

edit: actually if PACKAGECONFIG contains shared it should be okay. Are you overriding PACKAGECONFIG for the recipe?

jwinarske commented 1 year ago

Also be sure you're aware of this one: https://github.com/jwinarske/meta-luxonis/issues/3 If it's enabled it will clean up things needed to link. I haven't solved this just yet

travisariggs commented 1 year ago

I looked over Issue #3 before I logged this one. I did not have rm_work in my local conf. (I was able to reproduce that issue when I added rm_work to my local conf, but that is not my issue.)

According to bb -e depthai-core, I found:

PACKAGECONFIG="shared examples tests opencv resource-compile"

So, it looks like it contains "shared" as you suggested.

Grepping through your layer, it looks like this line turns on position-independent code if PACKAGECONFIG contains "shared":

${@bb.utils.contains('PACKAGECONFIG', 'shared', '-DCMAKE_POSITION_INDEPENDENT_CODE=ON', '-DCMAKE_POSITION_INDEPENDENT_CODE=OFF', d)}

During all of my attempts so far, I have been building from the tip of your kirkstone branch (2394f5a). I haven't modified your recipe yet. So, I don't think I have attempted to override PACKAGECONFIG in any way.

Just for kicks, I tried adding your suggested line to depthai-core_2.20.2.bb at line 150, just after the block of EXTRA_OECMAKE.

It failed the same way.

travisariggs commented 1 year ago

I think I've fixed it.

I added -D CMAKE_POSITION_INDEPENDENT_CODE=ON to the EXTRA_OECMAKE arguments in the libarchive-luxonis_git.bb recipe.

That built successfully on my machine, although I did get a QA warning...not sure how important it is.

WARNING: depthai-core-2.20.2-r0 do_package_qa: QA Issue: depthai-core-dbg: found library in wrong location: /usr/bin/luxonis/examples/.debug/libutility.so
depthai-core-examples: found library in wrong location: /usr/bin/luxonis/examples/libutility.so [libdir]

I sent you a PR for the kirkstone branch. I am curious if this still works for your system.