
Now, I'm a bit confused about that target thing - is it correct that binutils / GCC don't support a "plain" ELF target for x86_64, but insist on a "linux" target? (Since that's probably where your problems with the C++ compilation come from...)
Yes, exactly.Solar wrote: Candy did quite some work on researching how-to build a cross-compiler for the x86_64 target. Thanks for that (since I consider the whole cross-compiler page to be my "baby").
Now, I'm a bit confused about that target thing - is it correct that binutils / GCC don't support a "plain" ELF target for x86_64, but insist on a "linux" target? (Since that's probably where your problems with the C++ compilation come from...)
Might be an idea to split it up into multiple pages? Perhaps making some (or all) of the special things (x86-64, canadian cross) subpages?Solar wrote: I reworked the page... this is getting bigger than I thought.![]()
No, that's not true. If you read my note carefully, you can not move the compiled binaries on your own system (to a different dir f.ex.) if you use dynamic linking. You cannot move them to a different system (at all) if you use static linking. The option IS useful, considering the amount of people that compile in one place and then use in a different one.I also removed references to --disable-shared, as they're just confusing now until we write up the section about bootstrapping).
You were right about those things.Candy, please double-check the changes I made to the x86_64 and Canadian Cross sections. I haven't tried this stuff, so I might be wrong.
I hope that the issue (of x86_64-elf not being supported) is a temporary one, which would make most of that subchapter go away.Candy wrote: Might be an idea to split it up into multiple pages? Perhaps making some (or all) of the special things (x86-64, canadian cross) subpages?
Erm... you can move the binaries (and the shared libs) allright; you just have to make sure the libraries are in the library search path - set LD_LIBRARYPATH if need be. (I'm testing this right now but am pretty sure.)If you read my note carefully, you can not move the compiled binaries on your own system (to a different dir f.ex.) if you use dynamic linking.
I haven't tested this, but find it hard to believe. The very idea of static linking is to make the executable independent of the system, isn't it?You cannot move them to a different system (at all) if you use static linking.
uhm... the point is that you do not use the standard libraries but the new ones, even though they have the same name. The way this is handled is by including the entire path in the header (yes, I checked that with hexdump), so if you move it the path is incorrect and there's a damn good chance it'll use one of the normal ones, that do not support 64-bit code (for instance). If they're both x86 that doesn't matter.Solar wrote:Erm... you can move the binaries (and the shared libs) allright; you just have to make sure the libraries are in the library search path - set LD_LIBRARYPATH if need be. (I'm testing this right now but am pretty sure.)If you read my note carefully, you can not move the compiled binaries on your own system (to a different dir f.ex.) if you use dynamic linking.
Well, yes. It's independant of the shared libraries that you would normally need to run the program. That is to say, you can run it on all computers and you don't have to worry about the libraries. You do have to worry about instruction set presence though. So, it doesn't make it really independant of the system, it just makes it independant of the libraries. I'd love the GCC people adding a new thing, which makes it include its own libraries statically but the default libs dynamically... that'd rip out the entire reason I have to make it dynamic (with all the consequeces that has again).I haven't tested this, but find it hard to believe. The very idea of static linking is to make the executable independent of the system, isn't it?You cannot move them to a different system (at all) if you use static linking.
This whole Canadian Cross stuff gives me headaches. :-\ ;DCandy wrote:Well, yes. It's independant of the shared libraries that you would normally need to run the program. That is to say, you can run it on all computers and you don't have to worry about the libraries. You do have to worry about instruction set presence though. So, it doesn't make it really independant of the system, it just makes it independant of the libraries. I'd love the GCC people adding a new thing, which makes it include its own libraries statically but the default libs dynamically... that'd rip out the entire reason I have to make it dynamic (with all the consequeces that has again).Solar wrote: I haven't tested this, but find it hard to believe. The very idea of static linking is to make the executable independent of the system, isn't it?![]()
Hum... you could do with some trickery. Look up GCC configure options like --with-as=... and see if they might help. (I'm still fuzzy about this.)Candy wrote: This meant I had to do dynamic linking, and that meant that the directory could not be changed. Since the P4 box is not mine (it's my shell @ internet server actually) I cannot compile to /usr/cross, so I'm forced to put it in /home/candy/gcc/cross on my laptop too. Now, for me that doesn't really matter, but I don't see anybody else actually doing that.
It took me 3 weeks to get a compiling version, can't say it's easySolar wrote: This whole Canadian Cross stuff gives me headaches. :-\ ;D
No, that's not the principal difference. The most obvious difference _is_ in place, if somebody decided to speed up his/her computer by compiling glibc or stdlib or whatever with -march=pentium4, then linking to those files will produce a p4-only executable no matter what options you specify otherwise. That's what the problem is with static linking on a fake canadian cross. Doing so on a true canadian cross will link with the recompiled glibc so that's no problem.I got the thing with dynamic linking right now (I think), but the static linking still confuses me.
The instruction set doesn't matter for static vs. dynamic linking, or does it? I mean, the executable itself (statically linked or not) is fully dependent on the instruction set, and can only be run on a CPU with that instruction set.
Because it then links to the other computers libraries, which are made for that computer. If you do not link it dynamically, you limit it to the subset of computers that can run both the libc and the executable itself. If either is "optimized" for ppro or higher, I couldn't run it. Since I can control one, but not the other, don't include the other to make it copyable to all computers that fit your destination.How could an executable be moved to a different machine just because it's linked dynamically? ???
That's not the problem. Still, I think that if you move the libraries elsewhere and tell LD to look in those dirs *FIRST* it'd work too. If it found the default dirs first however, you'd be screwed.Hum... you could do with some trickery. Look up GCC configure options like --with-as=... and see if they might help. (I'm still fuzzy about this.)