Skip to contentSkip to conversation

ln -rs throws suntax error in do_populate_sysroot:append()

DISCUSSION Jojan 2 participants 2 messages Oct 10, 2024 1 message not in the archive

lore
Share & tools
lore

Jojan

author
#0 lore raw

I have a sysroot provide glibc-external
sysroot_stage_dirs function does not stage links  correctly
in my do_install append I added ln -rs ${D}${libdir} ${D}${prefix_native}/lib64   link of lib64 to /usr/lib lib64 is also added in FILES:${PN}

But when do_populate_sysroot calls the sysroot_stage_dirs()  , that populates everything defined in the SYSROOT_DIRS sysroot_stage_dirs() {
from="$1"
to="$2"

for dir in      /usr/include     /usr/lib     /lib     /lib     /usr/share     /sysroot-only ; do

sysroot_stage_dir "$from$dir" "$to$dir"
done
}

I added  an append function like this so that lib64 is a softlink to lib . The stage do_populate_sysroot:append() {
dstdir = d.getVar('SYSROOT_DESTDIR')
#    bb.warn("DEST DIR s '%s'" % (dstdir))
ln -s -r ${dstdir}${libdir} ${SYSROOT_DESTDIR}${prefix_native}/lib64
}

But this cause a syntax error
ln -s -r ${dstdir}${libdir} ${SYSROOT_DESTDIR}${prefix_native}/lib64 ^
SyntaxError: invalid syntax
ERROR: Parsing halted due to errors, see error messages above

Adding "SYSROOT_DIRS +=   ${prefix_native}/lib64 \ "  does not work , becuase it only created empty directory . Any idea why ln command throws syntax error in do_populate_sysroot:append()

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 3 lines · Jojan via lists.yoctoproject.org

I added an append function like this so that lib64 is a softlink to lib . The stage
do_populate_sysroot:append() {
dstdir = d.getVar('SYSROOT_DESTDIR')

This is Python.

Quoted 2 lines

# bb.warn("DEST DIR s '%s'" % (dstdir))

    ln -s -r ${dstdir}${libdir} ${SYSROOT_DESTDIR}${prefix_native}/lib64

This is shell.

You need to pick a language, or in the case of an :append use the same language as the function you’re appending.

do_populate_sysroot() is python, so you need to use python.

Feels like a better fix would be to actually fix the bug in the SYSROOT_DIRS handling instead of trying to work around it.

Ross