08-12-2012, 08:41 PM | #1 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Linking static statically is not just an issue for us.
It came as somewhat a revelation that linking statically (In the sense that I thought of it) was a real chore (it seemed) when x-compiling for the Kindle. The Kindle has older libraries - really very old in some instances - so being able to embed new function is obviously a bonus and in some cases critical.
Niluje, Knc1 and GM discuss one manifestation of such an issue and it may be too broad a problem to simply say DO THIS. But a collection of CHECK YOU DID THIS will not hurt. Indeed, to some degree solutions have been found and discussed if only in concept. Essentially: tips about the correct optimal runtime configuration and potential simple steps to prevent issues surrounding these types of builds are spread apart. It would be good to splat them here or on the wiki eventually. As a side note: Given our static complications (Indeed in some cases Codesourcery just fell over) I turned an eye to sets of tools that are alleged and expected to work-out-of-the-box. Other larger concerns would surely have ironed out such issues in a JUST WORK way I reasoned. The main tool I tested was Buildroot and I´ll briefly discuss my - now obvious I suppose, but surprising to me - findings. After some attempts at full static builds; digging through docs and threads to check I wasn´t doing it wrong; consistent failures; In the end I was coming up with exactly the same issues in buildroot as we were experiencing with full statics. I finally found THIS THREAD from about a month ago that confirms - and I quote (The full article discusses relocatable chains - I highlighted the relevant part Quote:
I wish I had known that a few moons ago. So this post is an aide-memoire and hopefully will underline that even the very big fish still are tousling with the self-same problems we little critters are managing to wrestle with - and in the main - win. So I guess I am simply reserving this space for the moment when we can simply say AH, that old chestnut, just go see the STATIC STATIC thread (or hopefully the wiki and Index by the time you read this thread). Either way I can report the major tools don´t fare better than the offerings we play with and that is an eye opener for me. The grass is not always greener. (Although it may have a few more groundskeepers ) Insert Awesome explanations, Typical Fails and miraculous workarounds below. Kindle specific library known issues warmly welcomed. Please indicate the exact Kindle Model (dx, 3, 5 etc) OS revision and toolchain for best results. I don´t claim to have any answers but I can see a cohesive place for them would not hurt. Many thanks. Last edited by twobob; 08-12-2012 at 10:34 PM. Reason: whitebait |
|
08-12-2012, 08:45 PM | #2 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Typical Static Static Fail. This one from Buildroot.
Typical Fail. This time through a buildroot one. But identical to the fail generated using the toolchain direct (well duh but I had to see it for myself)
Spoiler:
|
Advert | |
|
08-12-2012, 08:46 PM | #3 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
PS: Those are some of the reasons Rob builds a fully static linked, relocatable toolchain.
Ah, maybe I didn't mention that in all of the posts about Emu image. It **IS** a statically linked tool-chain inside of the image. |
08-12-2012, 08:53 PM | #4 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Quote:
That does currently come with a few caveats that are discussed in the KEK thread at greater length. Thanks very much! Last edited by twobob; 08-12-2012 at 09:03 PM. |
|
08-12-2012, 09:11 PM | #5 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Not specifically about the static issue this is a decent place to look for interesting autotool guidance. http://www.flameeyes.eu/autotools-mythbuster/ and my personal interest is in the sections http://www.flameeyes.eu/autotools-my...f/finding.html and http://www.flameeyes.eu/autotools-my...compiling.html Noted here for posterity
|
Advert | |
|
08-12-2012, 10:26 PM | #6 |
BLAM!
Posts: 13,492
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
@twobob: Note that a fully static host toolchain and fully statically linked target binaries are two different beasts. (By 'host' I'm referring to our native Linux distro or whatever you run your TC from, and 'target', the Kindle).
Checking if you actually *really* need a static toolchain is fairly easy, if you're missing some older/newer dependencies (and libstdc++ is indeed a fine exemple of this, in some cases), it will simply fail to *run*, you won't even have to hit *build* failures . If you build your TC yourself, that should be of fairly minor concern to you, unless you intend to distribute your TC. On the other hand, fully statically linked *target* binaries are not necessarily a good idea, especially with an (e)glibc based toolchain, like we discussed a few times with knc1 (your second post is a fine exemple a what happens when you try ^^ [well, not the undefined refs]). If for some reason you *really* want fully static binaries, better use an µcLibc TC. But like I said in the post you linked, it's not really necessary on the Kindle. And I concur on reading up on flameeyes' blog (he's been a Gentoo dev for longer than I've been using Gentoo, FWIW) . Last edited by NiLuJe; 08-12-2012 at 10:36 PM. |
08-12-2012, 10:54 PM | #7 |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
If static-linked target binaries are not good, we need a set of rules on how to build portable apps that run on all eink kindles. Otherwise for my needs I will have to avoid using libraries that cannot be trusted across various models and firmware versions.
|
08-12-2012, 10:59 PM | #8 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Quote:
I think I do really want the ability to generate fully static bins going forward and I am going to try out the Crosslib-ng route via buildroot. why not : ) It has a custom skeleton that I am playing with getting something like and once I figure how to splat SYSROOT or/and --prefix / LD_LIBRARY_PATH and anything else I don´t know about yet but really need into it I will look into creating some tools that eventually free us from the need for it. I´m into my nth (read over 20 30?) incorrect build of my tools but never let utter failure get you down I always think. the flameeyes links I posted I hoped might provide the correct interim measures that could be a) applied to re-purpose the binaries created during the configure stage for the correct load paths for our target and then b) further process used to correctly seat the resultant created installs into said paths created by fs/skeleton. True the configuration details are buildroot specific and perhaps no-one can help who hasn´t used it but that doesn´t stop me asking here, and of course continuing to dig on the buildroot site itself. At least I didn´t embarrass myself by asking the question I was going to ask about x-compiling that had a known solution. I´m trying to save up my questions on that mailing list for the really important stuff. Should we find some. My inability to set basic compiler flags doesn´t qualify. Please someone point me at a man page and hopefully a guide? @___@ One would imagine the section marked PreProcessor Flags (The only section with any such argument entering capability) would be the one to splat stuff at. but --prefix=/mnt/us seems to go ignored - even with the relevant skeleton in place. Clearly PEBCAK. Sigh, I wish I knew more so I can get stuff done faster, I would be of more use. Still that´s what this whole life thing is all about I suppose. So yeah. Thanks for the tips. If anyone has a dumbasses guide to splatting stuff into the configures / compiler / etc that would be great. I´ll be pillaging Google in the meantime. Perhaps in the next couple of weeks a day could go by where I don´t have to learn a new skill. Perhaps. Further reading for me http://free-electrons.com/blog/buildroot-2011-11/ Last edited by twobob; 08-13-2012 at 01:37 PM. Reason: 30? 40? sigh + further reading |
|
08-12-2012, 11:00 PM | #9 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
^This.
Quote:
^This. Bang on fella. |
|
08-12-2012, 11:13 PM | #10 |
BLAM!
Posts: 13,492
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
@GM: The easiest way is to simply use more or less the same TC as Amazon used on the K2/K3 (GCC 4.1/glibc 2.5/K 2.6.22 IIRC), and try to avoid ABI/API mismatches in bundled 3rd-party libs. If this is unavoidable, statically link *only* the 3rd-party libs. (Same thing if the 3rd-party lib is not bundled with the Kindle, or just ship the shared libs with your app, and tweak LD_LIBRARY_PATH at runtime).
If you're adventurous like me, you *can* use a newer GCC/glibc pair (I'm using Linaro GCC 4.7/glibc 2.9 for my k2/k3 tc), but know that you might have to tweak some C stuff/trick autotools to avoid pulling stuff from newer glibc, and that C++ stuff will probably be a no-go unless you're willing/can statically link libstdc++. (And you'll have to kill gcc's ssp and glibc's fortify support, which is usually a simple matter of correct CPP/CXX/CFLAGS). If you're targeting the K4/K5, it's way, way neater, since the TC Amazon used is not so freaking ancient (don't remember exactly, but I'd say GCC 4.4/eglibc 2.12/K 2.6.31). That's what I've been doing so far, without too much trouble . And remember, readelf is your friend ^^. Last edited by NiLuJe; 08-12-2012 at 11:59 PM. |
08-12-2012, 11:16 PM | #11 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Update. Even with Cross Tools NG
CVS refuses to build static static. Same error as before about dependencies. Pkg-Config dies on lookup for Clock_t sdl 1.2.15 refuses to install - stupid config error no doubt... qt will not build without c++ support (not an error, merely an observation) Others tools appear to be going through okay aside from the incorrect flags resulting in foolish install locations. I believe I can override that various stages of the build and inject my values there. I will read the manual again but it´s pretty lightweight on this subject. If I can get this detail cracked (and lib locations / referencing obviously) there is a very nice set of tools here just waiting to be unleashed. Answers on a postcard. Or here. Thanks : ) Last edited by twobob; 08-12-2012 at 11:22 PM. Reason: added more deaths |
08-12-2012, 11:24 PM | #12 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
I have an additional. Possibly stupid. Question.
If an executable is built static static this is the sure-firest way of getting it to be able to be dropped on a device. I.E. when I get all this stuff finally built there is a very high chance most of it will work ; ) You can see why I might be interested : D Anyways the build has completed. Letś see what I can salvage from this one Please read relevant licensing for relevant packages. I might add that these packages right here incorrectly used could probably DO DEVASTATING DAMAGE, well they might muck stuff up like access and where your files live so don´t mess about if you don´t know what they are. Cheers. I won´t be held responsible for you hitting yourself with the hammer I provide. Thanks. Last edited by twobob; 08-13-2012 at 08:35 AM. Reason: added hammer thingy |
08-12-2012, 11:59 PM | #13 |
BLAM!
Posts: 13,492
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
@twobob: Well, unless it's targeted at the wrong arch or potentially CPU/FPU, yes . (I'm leaving the Kernel out of it, assuming we're using adequate kernel headers).
|
08-13-2012, 12:03 AM | #14 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Quote:
--prefix=/mnt/us SYSROOT=/mnt/us LD_LIBARARY_PATH=/lib:/mnt/us/lib etc... Kinda thing. Any clues what I should be reading. Don´t tell me, the man page right. Anything a bit less sober out there? anyone : D More specifically: how does one pass all that info into this ridiculous tiny box answer I suspect is - you don´t Last edited by twobob; 08-13-2012 at 12:09 AM. |
|
08-13-2012, 04:23 AM | #15 | |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
Some Makefiles are constructed to do that from the ground up (usually for very large applications), most small application Makefiles do not have that organization. But this is hardly a software 101 build subject. Shoot, it isn't even a Makefile 101 subject. - - - - On a related topic (no pun intended) . . . . Someone wrote a dynamic loader wrapper that allows you to run more than one loader/libc on the same machine. I.E: at object load time, it checks the elf header, then uses the appropriate dynamic loader. Translation: You can install and run uClibc linked applications on a glibc system. If I can just find where I put that link (I was going to build that utility for the K3). As in: Code:
core2quad ~ $ /lib/ld-linux.so.2 Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...] You have invoked `ld.so', the helper program for shared library executables. This program usually lives in the file `/lib/ld.so', and special directives in executable files using ELF shared libraries tell the system's program loader to load the helper program from this file. This helper program loads the shared libraries needed by the program executable, prepares the program to run, and runs it. You may invoke this helper program directly from the command line to load and run an ELF executable file; this is like executing that file itself, but always uses this helper program from the file you specified, instead of the helper program file specified in the executable file you run. This is mostly of use for maintainers to test new versions of this helper program; chances are you did not intend to run this program. --list list all dependencies and how they are resolved --verify verify that given object really is a dynamically linked object we can handle --library-path PATH use given PATH instead of content of the environment variable LD_LIBRARY_PATH --inhibit-rpath LIST ignore RUNPATH and RPATH information in object names in LIST --audit LIST use objects named in LIST as auditors Code:
(armv6l:1) /home # /lib/ld-uClibc.so.0 Standalone execution is not enabled And for those who may have forgotten, glibc is also an executable: Code:
core2quad ~ $ /lib/i386-linux-gnu/libc-2.13.so GNU C Library (Ubuntu EGLIBC 2.13-20ubuntu5.1) stable release version 2.13, by Roland McGrath et al. Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 4.6.1. Compiled on a Linux 3.0.17 system on 2012-03-07. Available extensions: crypt add-on version 2.1 by Michael Glad and others GNU Libidn by Simon Josefsson Native POSIX Threads Library by Ulrich Drepper et al BIND-8.2.3-T5B libc ABIs: UNIQUE IFUNC For bug reporting instructions, please see: <http://www.debian.org/Bugs/>. |
|
Tags |
compiling, development, issues, kindle, tools |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is there anyway to set a static IP address on the Kobo Wifi? | saladasalad | Kobo Reader | 3 | 07-11-2012 07:22 AM |
Content Download a static website to the kindle? | scotter | Amazon Kindle | 1 | 03-07-2011 06:52 PM |
Static screensaver | kindle79 | Amazon Kindle | 2 | 11-17-2010 02:51 PM |
Free Book (Kindle) - The Static of the Spheres | koland | Deals and Resources (No Self-Promotion or Affiliate Links) | 3 | 06-21-2010 06:24 AM |
Static IP grey out | rushkk | enTourage Archive | 1 | 06-04-2010 11:23 AM |