{"id":475,"date":"2022-08-30T15:01:58","date_gmt":"2022-08-30T15:01:58","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/problem-about-uclibc-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:01:58","modified_gmt":"2022-08-30T15:01:58","slug":"problem-about-uclibc-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/problem-about-uclibc-collection-of-common-programming-errors\/","title":{"rendered":"problem about uclibc-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/65e7d20ce29a6a9afc31d0ccfb2e749d?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nuser1091344<br \/>\ngcc debian cross-compiling ada uclibc<br \/>\nI compiled a GCC 4.8.1 Cross-Compiler (BUILD\/HOST: debian\/glibc, TARGET: alpinelinux\/uclibc). The C compiler is working great, but Ada won&#8217;t work at moment.juan@debian:~\/HelloAda$ x86_64-alpine-linux-uclibc-gnatmake hello.adb x86_64-alpine-linux-uclibc-gcc -c hello.adb x86_64-alpine-linux-uclibc-gnatbind -x hello.ali x86_64-alpine-linux-uclibc-gnatlink hello.ali \/home\/juan\/opt\/cross\/lib\/gcc\/x86_64-alpine-linux-uclibc\/4.8.1\/adalib\/libgnat.a(adaint.o): In function `__gnat_cpu_alloc&#8217;: \/home\/juan\/GCC\/obj\/gcc\/ada\/rts\/adaint.c:3797: undefined reference to `__sched_cpualloc&#8217; \/home\/juan\/opt\/cross\/lib\/gcc\/x86_64-alpine-linux-uclibc\/4.8.1\/adalib\/libgnat.a(adaint.o): In function `__gnat_cpu_free&#8217;: \/home\/juan\/GCC\/obj\/gcc\/ada\/rts\/adaint.c:3807: undefined reference to `__sched_cpufree&#8217; collect2: error: ld returned 1 exit status x86_64-alpine-linux-uclibc-gnatlink: error when calling \/home\/juan\/opt\/cross\/bin\/x86_64-alpine-linux-uclibc-gcc x86_64-alpine-linux-uclibc-gnatmake: *** link failed.\/home\/juan\/GCC\/obj\/gcc\/ada\/rts\/adaint.c: http:\/\/nopaste.info\/ffcb612692.html\/usr\/include\/sched.h: http:\/\/nopaste.info\/5332aed42a.html \/usr\/include\/bits\/sched.h: http:\/\/nopaste.info\/46323ab5d8.html\/opt\/alpine\/usr\/include\/sched.h: http:\/\/nopaste.info\/998896bafe.html \/opt\/alpine\/usr\/include\/bits\/sched.h: http:\/\/nopaste.info\/e8cfbd2844.htmlDoes someone know, what&#8217;s going wrong?A more verbose output of what is going on:juan@debian:~\/HelloAda$ x86_64-alpine-linux-uclibc-gcc -c hello.adb juan@debian:~\/HelloAda$ x86_64-alpine-linux-uclibc-gnatbind hello juan@debian:~\/HelloAda$ x86_64-alpine-linux-uclibc-gnatlink -v -v helloGNATLINK 4.8.1 Copyright (C) 1995-2013, Free Software Foundation, Inc. x86_64-alpine-linux-uclibc-gcc -c -mtune=generic -march=x86-64 -gnatA -gnatWb -gnatiw -v -gnatws \/home\/juan\/HelloAda\/b~hello.adb Using built-in specs. COLLECT_GCC=\/home\/juan\/opt\/cross\/bin\/x86_64-alpine-linux-uclibc-gcc Target: x86_64-alpine-linux-uclibc Con<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8d14e043d3c1f08e23d0a6fbbed1be3e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBrian Bruggeman<br \/>\ngcc arm gentoo cross-compile uclibc<br \/>\nCan anyone help with my ARM + GCC + UCLIBC linking issue with crossdev?Also posted to Gentoo Forums here: http:\/\/forums.gentoo.org\/viewtopic-t-925012.htmlRecently, I was assigned to a project that has executables developed using an old GCC with OABI. As a point of reference, here&#8217;s a header output from readelf of an executable that runs just fine on the system:ELF Header:Magic: 7f 45 4c 46 01 01 01 61 00 00 00 00 00 00 00 00 Class: ELF32Data: 2&#8217;s complement, little endianVersion: 1 (current)OS\/ABI: ARMABI Version: 0Type: EXEC (Executable file)Machine: ARMVersion: 0x1Entry point address: 0x9464Start of program headers: 52 (bytes into file)Start of section headers: 540956 (bytes into file)Flags: 0x202, has entry point, GNU EABI, software FPSize of this header: 52 (bytes)Size of program headers: 32 (bytes)Number of program headers: 6Size of section headers: 40 (bytes)Number of section headers: 35Section header string table index: 32I creaed a cross-compiler using crossdev and the latest gcc\/binutils\/linux-headers\/etc. and with EABI. $ crossdev arm-softfloat-linux-uclibceabiI quite happily began to populate my local folder with executables using that cross compiler only to later try the executable on my hardware and find out that I ended up with a segmentation fault. I realized, only through quite a bit of googling, that I really needed to have the old, legacy ABI for uclibc: OABI. My previous cross compiler was from circa 2005.As another point of reference, my executables with eabi were producing headers from readelf that look a bit like this:ELF Header:Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32Data: 2&#8217;s complement, little endianVersion: 1 (current)OS\/ABI: UNIX &#8211; System VABI Version: 0Type: EXEC (Executable file)Machine: ARMVersion: 0x1Entry point address: 0x8130Start of program headers: 52 (bytes into file)Start of section headers: 21284 (bytes into file)Flags: 0x5000002, has entry point, Version5 EABISize of this header: 52 (bytes)Size of program headers: 32 (bytes)Number of program headers: 7Size of section headers: 40 (bytes)Number of section headers: 21Section header string table index: 18While the Machine is the same, the segmentation fault doesn&#8217;t provide a way to execute the binary on the target.After googling more, I found that there may be a way to produce some code with the eabi compiler for the legacy system. I was quite happy when I ran this command:$ arm-softfloat-linux-uclibceabi-gcc -mabi=apcs-gnu -static -c -o \/mnt\/arm_uclibc\/tmp\/test \/mnt\/arm\/tmp\/test.c &amp;&amp; readelf -h \/mnt\/arm_uclibc\/tmp\/testAnd I ended up with:ELF Header:Ma<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7e14da1cece8e6eab4bfba9814d246f5?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPoltoS<br \/>\nc gcc cross-compiling uclibc<br \/>\nI&#8217;m trying to build a project for ARM uClibc environment, but I&#8217;ve some functions missing. Can not find which library shall I include to resolve dependancies. nm do not help me to search, since it says on most of libs coming with toolchain:nm: .\/host\/usr\/arm-unknown-linux-uclibcgnueabi\/sysroot\/lib\/libuClibc-0.9.32.1.so: no symbolsHere is the output from GCC:.\/host\/usr\/bin\/arm-unknown-linux-uclibcgnueabi-gcc-Wl,-rpath,.\/host\/usr\/lib\/-Wl,-rpath,.\/host\/usr\/..\/lib\/-Wl,-rpath,.\/host\/usr\/arm-unknown-linux-uclibcgnueabi\/sysroot\/lib\/-Llibzway -o test_so main.o -lzway-L.\/host\/us<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/4ddba4b0e307527d849a5f6a2e1cce06?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nFrancesco<br \/>\ngcc ld uclibc angstrom-linux openembedded<br \/>\nI am trying to build an application for angstrom linux (that uses uclibc instead of libstdc++, in my case). I am using bitbake and openembedded. With a simple toolchain I am able to build successfully by adding only -muclibc flag. With bitbake my build command is the followingarm-angstrom-linux-gnueabi-gcc -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb &#8211;sysroot=\/home\/hnsl\/stuff\/tmp\/sysroots\/armv7a-angstrom-linux-gnueabi -fexpensive-optimizations -fomit-frame-pointer -frename-registers -O2 -ggdb2 -Wl,-O1 -Wl,&#8211;hash-style=gnu -muclibc mainThread.cpp lib.cpp -lportaudiowhere -muclibc mainThread.cpp lib.cpp -lportaudio is done by me. Portaudio (-lportaudio) is linked successfully. Uclibc (I think) fails to be linked; I get these errors:\/tmp\/ccW4SVb4.o: In function `main&#8217;: | \/home\/hnsl\/stuff\/tmp\/work\/armv7a-angstrom-linux-gnueabi\/cphone-1.0.0-r1\/mainThread.cpp:68: undefined reference to `__cxa_end_cleanup&#8217; | \/home\/hnsl\/stuff\/tmp\/work\/armv7a-angstrom-linux-gnueabi\/cphone-1.0.0-r1\/mainThread.cpp:68: undefined reference to `__cxa_begin_catch&#8217; | \/tmp\/ccW4SVb4.o: In function `operator<\/li>\n<\/ul>\n<p id=\"rop\"><small>Originally posted 2013-11-09 19:44:26. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>user1091344 gcc debian cross-compiling ada uclibc I compiled a GCC 4.8.1 Cross-Compiler (BUILD\/HOST: debian\/glibc, TARGET: alpinelinux\/uclibc). The C compiler is working great, but Ada won&#8217;t work at moment.juan@debian:~\/HelloAda$ x86_64-alpine-linux-uclibc-gnatmake hello.adb x86_64-alpine-linux-uclibc-gcc -c hello.adb x86_64-alpine-linux-uclibc-gnatbind -x hello.ali x86_64-alpine-linux-uclibc-gnatlink hello.ali \/home\/juan\/opt\/cross\/lib\/gcc\/x86_64-alpine-linux-uclibc\/4.8.1\/adalib\/libgnat.a(adaint.o): In function `__gnat_cpu_alloc&#8217;: \/home\/juan\/GCC\/obj\/gcc\/ada\/rts\/adaint.c:3797: undefined reference to `__sched_cpualloc&#8217; \/home\/juan\/opt\/cross\/lib\/gcc\/x86_64-alpine-linux-uclibc\/4.8.1\/adalib\/libgnat.a(adaint.o): In function `__gnat_cpu_free&#8217;: \/home\/juan\/GCC\/obj\/gcc\/ada\/rts\/adaint.c:3807: undefined reference to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-475","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=475"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/475\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=475"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=475"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}