Issue with Dynamic Linker and Python Dependency in Yocto SDK Setup
Hi everyone,
I'm currently facing an issue while setting up a Yocto SDK environment using the bitbake my-image -c populate_sdk command. The SDK needs to be deployed on a machine that has no existing installations and lacks Python. To work around this, I've modified SDK_PACKAGING_FUNC to "do_compile" instead of "create_shar" to directly obtain the source files.
However, when I try to set up the environment using the generated SDK, I encounter the following error related to the dynamic linker:
. /yocto-sdk/june-21-linux-x86/environment-setup-core2-64-poky-linux
$CC : no such file or directory: x86_64-poky-linux-gcc ...
which $CC : x86_64-poky-linux-gcc not found
ldd /yocto-sdk/june-21-linux-x86/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc linux-vdso.so.1 (0x00007ffca9731000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007faf662c7000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007faf660e6000) /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007faf663af000)
file /yocto-sdk/june-21-linux-x86/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc /yocto-sdk/june-21-linux-x86/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2, BuildID[sha1]=d5ac41fb03fc89ca348393a6e8734b6fc93ee561, for GNU/Linux 3.2.0, stripped
Since I don't have Python installed, I am unable to run relocate_sdk.py. Could someone please advise on how to resolve this issue or suggest alternative approaches to correctly set up the Yocto SDK environment without Python?
Best regards, Nicolas
Quoted 3 lines · Nicolas Wirth via lists.yoctoproject.org
Hi everyone,
I'm currently facing an issue while setting up a Yocto SDK environment using the bitbake my-image -cpopulate_sdkcommand. The SDK needs to be deployed on a machine that has no existing installations and lacks Python. To work around this, I've modifiedSDK_PACKAGING_FUNCto "do_compile" instead of "create_shar" to directly obtain the source files.
The SDK installer needs Python.
Quoted 1 line
Since I don't have Python installed, I am unable to run
relocate_sdk.py. Could someone please advise on how to resolve this issue or suggest alternative approaches to correctly set up the Yocto SDK environment without Python?
You could reimplement the relocation code in C and compile it into the SDK I guess. Or hack the SDK generation so that it can only be installed into a specific location, and then you won’t need to relocate it.
My recommendation would be to ensure Python is on the machine.
Ross
Thanks for your input.
I cannot install anything (including Python) on the target machine that will use the SDK due to company policy. Additionally, I cannot modify the SDK generation because the SDK is mounted on the machine using a token mechanism, making the location variable.
Is there no other way to have the SDK available on my target without using the relocate_sdk.py script?
Quoted 3 lines · Nicolas Wirth via lists.yoctoproject.org
Thanks for your input.
I cannot install anything (including Python) on the target machine that will use the SDK due to company policy. Additionally, I cannot modify the SDK generation because the SDK is mounted on the machine using a token mechanism, making the location variable.
The policy is insane and prevents productive work needed to ship products. You need to take this to your management, we cannot help you.
Alex
Quoted 9 lines · Nicolas Wirth via lists.yoctoproject.org
[Edited Message Follows]
Thanks for your input.
I cannot install anything (including Python) on the target machine that will use the SDK due to company policy. Additionally, I cannot modify the SDK generation because the SDK is mounted on the machine using a token mechanism, making the location variable. Finally, I don't have root privilege on the target.
Is there no other way to have the SDK available on my target without using the
relocate_sdk.pyscript?
relocating tools is a necessary part of SDK self-installer, so it can edit the binaries to use correct libs as SDK expects. You may explore using buildtools-tarball which can provide python perhaps
https://downloads.yoctoproject.org/releases/yocto/yocto-5.0/buildtools/
Quoted 9 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13386): https://lists.yoctoproject.org/g/poky/message/13386
Mute This Topic: https://lists.yoctoproject.org/mt/106796971/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 5 lines
relocating tools is a necessary part of SDK self-installer, so it can edit the binaries to use correct libs as SDK expects. You may explore using buildtools-tarball which can provide python perhaps
https://downloads.yoctoproject.org/releases/yocto/yocto-5.0/buildtools/
We found a workaround using patchelf to change the dynamic linker of the SDK to the current directory. Then, we create a symlink to the toolchain's dynamic linker. By setting LD_LIBRARY_PATH , we can use the toolchain as intended without using the installation script or Python.
This is our current solution. Do you see any potential issues or a better way to achieve this?
Quoted 6 lines · Nicolas Wirth via lists.yoctoproject.org
Quoted 6 lines
relocating tools is a necessary part of SDK self-installer, so it can
edit the binaries to use correct libs as SDK expects. You may explore
using buildtools-tarball which can provide python perhaps
https://downloads.yoctoproject.org/releases/yocto/yocto-5.0/buildtools/
Quoted 7 lines
We found a workaround using patchelf to change the dynamic linker of the SDK to the current directory. Then, we create a symlink to the toolchain's dynamic linker. By setting
LD_LIBRARY_PATH, we can use the toolchain as intended without using the installation script or Python.
This is our current solution. Do you see any potential issues or a better way to achieve this?
Personally I'd probably have tried to find/create a statically linked minimal python binary and used that to run the relocation script. Our own build could probably generate one with a little bit of work or there may be some around online.
I'd be a bit concerned that you've probably not caught all the relocation issues with the approach you're using as the relocation script changes a number of things and I don't think you've listed everything. I don't have the time to try and look into what you're doing though, we taught that existing script all these things for a reason!
Cheers,
Richard
An other idea would be to create a static toolchain, with a static cross-compiler. Is this a possibility ? I had a look at those options but none of them seems to be working:
EXTRA_OECONF : remove = "--disable-static" EXTRA_OECONF : append = " --enable-static"
EXTRA_OECONF : remove = "--enable-shared" EXTRA_OECONF : append = " --disable-static"
DISABLE_STATIC = ""
BUILDSDK_CFLAGS : append = " -static" BUILDSDK_CXXFLAGS : append = " -static" BUILDSDK_LDFLAGS : append = " -static"