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

libgcc-s-dev should include crtbegin/crtend/libgcc binaries #62

Open
lumag opened this issue Mar 24, 2015 · 7 comments
Open

libgcc-s-dev should include crtbegin/crtend/libgcc binaries #62

lumag opened this issue Mar 24, 2015 · 7 comments
Assignees
Labels

Comments

@lumag
Copy link

lumag commented Mar 24, 2015

libgcc-s-dev generated by external-sourcery-toolchain should include more binaries. Compare:

Original libgcc-s-dev from OE:

drwxrwxrwx root/root         0 2015-01-31 00:07 ./
drwxr-xr-x root/root         0 2015-01-31 00:06 ./usr/
drwxr-xr-x root/root         0 2015-01-31 00:06 ./usr/lib/
lrwxrwxrwx root/root         0 2015-01-31 00:06 ./usr/lib/arm-oe-linux -> arm-oe-linux-gnueabi
drwxr-xr-x root/root         0 2015-01-31 00:06 ./usr/lib/arm-oe-linux-gnueabi/
drwxr-xr-x root/root         0 2015-01-31 00:06 ./usr/lib/arm-oe-linux-gnueabi/4.9.1/
-rw-r--r-- root/root      2632 2015-01-31 00:06 ./usr/lib/arm-oe-linux-gnueabi/4.9.1/crtbeginS.o
-rw-r--r-- root/root      2524 2015-01-31 00:06 ./usr/lib/arm-oe-linux-gnueabi/4.9.1/crtbeginT.o
-rw-r--r-- root/root      2196 2015-01-31 00:06 ./usr/lib/arm-oe-linux-gnueabi/4.9.1/crtbegin.o
-rw-r--r-- root/root   5808530 2015-01-31 00:06 ./usr/lib/arm-oe-linux-gnueabi/4.9.1/libgcc.a
-rw-r--r-- root/root      1065 2015-01-31 00:06 ./usr/lib/arm-oe-linux-gnueabi/4.9.1/crtend.o
-rw-r--r-- root/root      1065 2015-01-31 00:06 ./usr/lib/arm-oe-linux-gnueabi/4.9.1/crtendS.o
-rw-r--r-- root/root     75528 2015-01-31 00:06 ./usr/lib/arm-oe-linux-gnueabi/4.9.1/libgcc_eh.a
drwxr-xr-x root/root         0 2015-01-31 00:06 ./lib/
-rw-r--r-- root/root       132 2015-01-31 00:06 ./lib/libgcc_s.so

libgcc-s-dev from meta-sourcery:

drwxrwxrwx root/root         0 2015-03-16 15:26 ./
drwxr-xr-x root/root         0 2015-03-16 15:25 ./lib/
-rw-r--r-- root/root       132 2014-07-29 19:22 ./lib/libgcc_s.so

Noticed by @vsitdikov .

@kergoth
Copy link
Member

kergoth commented Mar 24, 2015

Nicely spotted, thanks for the report. I'll take a look. I tried to make use of existing .inc's in the core where possible, but the external toolchain sysroot extraction requires more explicit specification than the core recipes do. I'm assuming this is against current master?

@lumag
Copy link
Author

lumag commented Mar 24, 2015

It's against release/2014.12. Using that branch for now. I'll recheck with the master branch tomorrow.
I have a patch/workaround locally, but I'd like to give it a test before posting.

@lumag
Copy link
Author

lumag commented Mar 24, 2015

Created SB-4841, if that matters

@kergoth
Copy link
Member

kergoth commented Mar 24, 2015

Okay, that's good to know. The recipes were completely reworked in master to use separate recipes for each upstream recipe (e.g. libgcc-external is its own recipe) with an entirely different mechanism for the file extraction from the external toolchain sysroot. Regardless, fixing this should just be a matter of adding a few entries to the FILES variable in question in the external-sourcery-toolchain recipe.

@lumag
Copy link
Author

lumag commented Mar 24, 2015

Good to know. This should give us more flexibility. Unfortuntately ATM I'm stuck with release 2014.12.

Regarding FILES_* variables. Not quite. To be as compatible as possible I'm also installing files to a gcc-specific folders, not to /usr/lib. On the other hand just putting everything to /usr/lib should also work. I'll give it a try.

@lumag
Copy link
Author

lumag commented Mar 25, 2015

@kergoth Installing these files to /usr/lib has serious drawback --- they will go now to libc6-dev package instead of libgcc-dev. I'll do few more tests.

@lumag
Copy link
Author

lumag commented Mar 26, 2015

@kergoth just FYI. I ended up with the following snippet:

def sourcery_get_libroot(d):
    import subprocess
    libroot_cmd = "${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} -print-file-name=crtbegin.o"
    try:
        toolchain_libroot = bb.process.run(bb.data.expand(libroot_cmd, d),
                                           stderr=subprocess.PIPE,
                                           env={"PATH": d.getVar('PATH', True)})[0].rstrip()[:-11]
    except bb.process.CmdError as exc:
        bb.fatal(str(exc))
    else:
        return toolchain_libroot

EXTERNAL_TOOLCHAIN_LIBROOT = "${@sourcery_get_libroot(d)}"

do_install_append() {
        install -d ${D}/usr/lib/${TARGET_SYS}/${CSL_VER_GCC}
        for file in crtbegin.o crtbeginS.o crtendT.o crtend.o crtendS.o libgcc.a libgcc_eh.a ; do
                if [ -e "${EXTERNAL_TOOLCHAIN_LIBROOT}"/$file ]; then
                        install -m 0644 "${EXTERNAL_TOOLCHAIN_LIBROOT}"/$file ${D}/usr/lib/${TARGET_SYS}/${CSL_VER_GCC}
                fi
        done
}

FILES_libgcc-dev += "${libdir}/${TARGET_SYS}/${CSL_VER_GCC}"
INSANE_SKIP_libgcc-dev = "staticdev"

pkg_postinst_libgcc-dev () {
        for file in crtbegin.o crtbeginS.o crtendT.o crtend.o crtendS.o libgcc.a libgcc_eh.a ; do
                ln -s /usr/lib/${TARGET_SYS}/${CSL_VER_GCC}/$file ${libdir}
        done
}

@kergoth kergoth added the bug label Aug 3, 2015
@kergoth kergoth self-assigned this Aug 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants