Code Monkey home page Code Monkey logo

Comments (8)

ivandavidov avatar ivandavidov commented on July 16, 2024
  • Have you made any changes to the scripts?
  • Are you sure all previous phases have been executed correctly?
  • Which version are you talking about? You can always try one of the previous versions.
  • Could you please elaborate on the CONFIG_SYSROOT thing? I didn't really get what you mean.

Most probably the 'glibc' build configuration is not fully compatible. Take a look at the latest glibc build process:

https://github.com/ivandavidov/minimal/blob/master/src/04_build_glibc.sh

I have disabled certain 'glibc' functionalities in order to make the build more generic. In particular, this is what I've used:

# glibc is configured to use the root folder (--prefix=) and as result all libraries
# will be installed in '/lib'. Kernel headers are taken from our already prepared
# kernel header area (see 02_build_kernel.sh). Packages 'gd' and 'selinux' are disabled.
echo "Configuring glibc..."
../configure --prefix= --with-headers=$WORK_KERNEL_DIR/usr/include --without-gd --without-selinux --disable-werror

My suggestion is to edit your 'glibc' build script and add the '--without' options that you see above. Then continue with the build process and see what happens.

You can also try to google the string "undefined reference to __poll_chk" and try to figure out what the actual underlying problem is.

Let me know if you find solution for the issue.

Regards,
Ivan Davidov

from minimal.

blueardour avatar blueardour commented on July 16, 2024

Hi, Dear Ivan

Sorry for not clearly described the problem.

My host machine has Ubuntu12.04 x86_64 OS installed. Gcc version is gcc-4.9.

I used the lasted scripts on the GitHub and made not changes to them. I double check the build process of the glibc (04_build_glibc.sh), and all commands returned success.

There was only a warning at the end of make installl of glibc:
test ! -x /workspace/acceleration-gpu/git/minimal/src/work/glibc/glibc-2.23/glibc_objects/elf/ldconfig || LC_ALL=C \ /workspace/acceleration-gpu/git/minimal/src/work/glibc/glibc-2.23/glibc_objects/elf/ldconfig -r /workspace/acceleration-gpu/git/minimal/src/work/glibc/glibc-2.23/glibc_installed \ /lib /lib /workspace/acceleration-gpu/git/minimal/src/work/glibc/glibc-2.23/glibc_objects/elf/ldconfig: Warning: ignoring configuration file that cannot be opened: /workspace/acceleration-gpu/git/minimal/src/work/glibc/glibc-2.23/glibc_installed/etc/ld.so.conf: No such file or directory make[1]: Leaving directory/workspace/acceleration-gpu/git/minimal/src/work/glibc/glibc-2.23'`
But I think it does't matter. (I could touch the ld.so.conf to work it around)

The issue happened at the link phase of the busybox when run 07_build_busybox.sh : undefined reference to __poll_chk.
LINK busybox_unstripped Trying libraries: crypt m Failed: -Wl,--start-group -lcrypt -lm -Wl,--end-group Output of:

gcc -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wno-format-security -Wdeclaration-after-statement -Wold-s tyle-definition -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -static-libgcc -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-l oops=1 -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-builtin-printf -Os --sysroot=/workspace/acceleration-gpu/git/minimal/src/work/glibc/glibc-2.23/glibc_installed -o busybox_unstripped -Wl,--sort-common -Wl,--sort-section, alignment -Wl,--gc-sections -Wl,--start-group applets/built-in.o archival/lib.a archival/libarchive/lib.a console-tools/lib.a coreutils/lib.a coreutils/libcoreutils/lib.a debianutils/lib.a e2fsprogs/lib.a editors/lib.a findutils/lib. a init/lib.a libbb/lib.a libpwdgrp/lib.a loginutils/lib.a mailutils/lib.a miscutils/lib.a modutils/lib.a networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a printutils/lib.a procps/lib.a runit/lib.a selinux/lib.a shel l/lib.a sysklogd/lib.a util-linux/lib.a util-linux/volume_id/lib.a archival/built-in.o archival/libarchive/built-in.o console-tools/built-in.o coreutils/built-in.o coreutils/libcoreutils/built-in.o debianutils/built-in.o e2fsprogs/bu ilt-in.o editors/built-in.o findutils/built-in.o init/built-in.o libbb/built-in.o libpwdgrp/built-in.o loginutils/built-in.o mailutils/built-in.o miscutils/built-in.o modutils/built-in.o networking/built-in.o networking/libiproute/bu ilt-in.o networking/udhcp/built-in.o printutils/built-in.o procps/built-in.o runit/built-in.o selinux/built-in.o shell/built-in.o sysklogd/built-in.o util-linux/built-in.o util-linux/volume_id/built-in.o -Wl,--end-group -Wl,--start-g roup -lcrypt -lm -Wl,--end-group

miscutils/lib.a(microcom.o): In function microcom_main': microcom.c:(.text.microcom_main+0x28b): undefined reference to__poll_chk' networking/lib.a(ifplugd.o): In function ifplugd_main': ifplugd.c:(.text.ifplugd_main+0x318): undefined reference to__poll_chk' runit/lib.a(runsv.o): In function runsv_main': runsv.c:(.text.runsv_main+0x4fe): undefined reference to__poll_chk' util-linux/lib.a(script.o): In function script_main': script.c:(.text.script_main+0x204): undefined reference to__poll_chk' collect2: error: ld returned 1 exit status make: *** [busybox_unstripped] Error 1

I think the problem is we force the busybox linked with the glibc we just built (by set the SYSROOT variable). However, the __poll_chk function from glibc was not correctly built in. (the function is defined in glibc-xxx/debug/poll_chk.c

I can get rid of the error by haking: copy poll_chk.c to the busybox folder, then compile to get poll_chk.o and add this file to the busybox link list.

from minimal.

ivandavidov avatar ivandavidov commented on July 16, 2024

The ld.so.conf warning is harmless, as you've already discovered and it doesn't affect the final result.

We do need to link BusyBox against our version of glibc or otherwise we'll be using our kernel + our busybox + our glibc but the actuall BusyBox linking would be against the host's kernel headers and glibc's libraries. In theory this could bring inconsistencies when we ues the finally produced ISO image.

Currently you are in better position to research this particular issue since my host environments are OK. I use Linux Mint (x86 and x86_64) and I have no such issues there (i.e. "works on my machine").

Could you please track down the glibc configuration/build logs and find the parts where __poll_chk is involved? If there is a problem building this particular piece of code, there should be some kind of warning or error. Also, there might be a hint in the output of the --configure phase of glibc. This is where I found out that I need to disable the selinux module in order to get better compatibility. It might turn out that there are other glibc modules that need to be disabled for even better compatibility.

I guess you can redirect the output from the scripts in some log files and examine the logs. I've already done that in the Makefile but if you decide to do that you only need to redirect the output of the configuration and the build phase.

from minimal.

blueardour avatar blueardour commented on July 16, 2024

I found this post: http://stackoverflow.com/questions/35362844/version-glibc-2-16-not-found-target-host-error-after-upgrading-build-environ

According to the post, the __poll_chk function is only include in GLIBC_2.16. Thus, when linking against other version of glibc, there would be a problem.

Further more, I check the libc.map file in my minimal/src/work/glibc/glibc-2.23/glibc_objects folder. There is a section related:

GLIBC_2.15 { global: __fdelt_chk; __fdelt_warn; process_vm_readv; process_vm_writev; scandirat; scandirat64; } GLIBC_2.14; GLIBC_2.16 { global: __getauxval; getauxval; __poll_chk; __ppoll_chk; aligned_alloc; c16rtomb; c32rtomb; mbrtoc16; mbrtoc32; timespec_get; } GLIBC_2.15; GLIBC_2.17 { global: clock_getres; clock_gettime; clock_settime; clock_getcpuclockid; clock_nanosleep; recvmmsg; sendmmsg; secure_getenv; } GLIBC_2.16;

the __poll_chk only occurs in the GLIBC_2.16 section.

I Intuitively felt the issue was caused by a similar problem, however I have little sense how to verify.

from minimal.

ivandavidov avatar ivandavidov commented on July 16, 2024

OK, I'm just brainstorming here, based on the article which you've found:

  • Perhaps you could try to change the glibc and/or BuisyBox build process and explicitly disable all compiler optimizations.
  • Or probably add -U_FORTIFY_SOURCE to the compiler flags, even though this might be Debian/Ubuntu/Mint specific (haven't researched it yet).

Once I have some free time I'll try to reproduce the issue and analyze it further. I'd be happy if there is a permanent solution or at least a workaround which I could include in the next version of Minimal Linux Live.

from minimal.

ivandavidov avatar ivandavidov commented on July 16, 2024

OK, this is what I propose:

In 07_build_busybox.sh change this line...

make busybox -j $(grep ^processor /proc/cpuinfo | wc -l)

...with this one:

make EXTRA_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0" busybox -j $(grep ^processor /proc/cpuinfo | wc -l)

Please let me know if applying this change works for you.

FYI - you can apply the same CFLAGS to the glibc build in 04_build_glibc.sh by changing this line...

../configure --prefix= --with-headers=$WORK_KERNEL_DIR/usr/include --without-gd --without-selinux --disable-werror

...with this line:

../configure --prefix= --with-headers=$WORK_KERNEL_DIR/usr/include --without-gd --without-selinux --disable-werror CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0"

Note that in general you won't need to do the latter. In your case it should be enough to apply the BusyBox related change.

EDIT - it seems like the issue is really Ubuntu specific. The _FORTIFY_SOURCE flag is set by default on Ubuntu (hence the CFLAGS to disable it explicitly) but it's not set by default on Debian and depending on the host Linux environment this may lead to unexpected compile/link issues.

from minimal.

blueardour avatar blueardour commented on July 16, 2024

Great. It works after I replace the make command in the 07_build_busybox.sh.

So much appreciated to you

from minimal.

ivandavidov avatar ivandavidov commented on July 16, 2024

Glad to hear the issue has been resolved. I'll include the workaround in the next MLL version.

from minimal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.