0

On a C project at work, make builds for various targets, one of them apparently being powerpc-405. The build for that specific target fails because I don't have the toolchain installed.

make[7]: /opt/crosstool/gcc-4.2.4-glibc-2.3.6/powerpc-405-linux-gnu/bin/powerpc-405-linux-gnu-gcc: Command not found

Q: I have a very shaky understanding of the "download source code, then build it yourself" paradigm that's common in Linux-land. Can someone please describe how I can do this specific to the noted toolchain in the error?

So far, I've determined/think that I need to go to ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.2.4/ .

Q: What should I download from here? I assume I can safely ignore things like fortran, and java. But from among { gcc-4.2.4, gcc-core-4.2.4, gcc-g++-4.2.4, gcc-testsuite-4.2.4 }, which should I download? All?

Q: After downloading+extracting the correct set of tarballs, what exactly is next? I have a tentative understanding that eventually I will be doing the configure; make; make install incantation, but I'm unclear what I need to do before and after.

Q: You'll note the error mentions glibc-2.3.6. Where does this fit into the picture? As noted above, the ftp site I'm at only mentions gcc-4.2.4. I'm unclear what "melds" gcc-4.2.4 and glibc-2.3.6 for purposes of resolving the build error.

Q: The noted ftp site looks like a "generic" gcc. I.e. from the filenames, I don't perceive any relation to powerpc-405. Am I on the right track, or should I be looking elsewhere? I did google for various combinations of "powerpc" and "gcc" and did not find anything that looked like it led to a powerpc-405-specific gcc.

>uname -a
Linux linuxbox 3.11.10-301.fc20.x86_64 #1 SMP Thu Dec 5 14:01:17 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

From working through this specific example, I'd like to develop an understanding of how Linux users/developers understand where to go to download cross-compiler toolchains and compile them.

  • Don’t your colleagues have a working compiler for this? – Stephen Kitt Jun 22 '17 at 4:21
  • What linux distribution are you using, why download tarballs when the tools are in the repos ? You can, don't get me wrong, but why would you ? – thecarpy Jun 22 '17 at 7:13
  • See kegel.com/crosstool/current/doc/crosstool-howto.html for how to add a platform. It is all explained in the quickstart section. – thecarpy Jun 22 '17 at 7:23
  • @thecarpy - Thanks for your answer. RE: your question "why download tarballs when the tools are in the repos?" - I don't think I understand your question - what do you mean by "the tools are in the repos"? Maybe that's already answered by your posted answer; I'm reading and trying to digest all the information. – StoneThrow Jun 22 '17 at 17:17
  • @StephenKitt - As it turns out, yes, but I was just taking the opportunity to educate myself about the "download source then build it yourself" paradigm since I'm trying to gain Linux experience. – StoneThrow Jun 22 '17 at 18:43
1

I have a very shaky understanding of the "download source code, then build it yourself" paradigm that's common in Linux-land. Can someone please describe how I can do this specific to the noted toolchain in the error?

Basically, read the quick start and troubleshooting sections of http://www.kegel.com/crosstool/current/doc/crosstool-howto.html

More generally, see How to compile and install programs from source for compilation from source.

This should answer some of your questions.

What should I download from here? I assume I can safely ignore things like fortran, and java. But from among { gcc-4.2.4, gcc-core-4.2.4, gcc-g++-4.2.4, gcc-testsuite-4.2.4 }, which should I download? All?

Note that crosstool downloads them for you!

After downloading+extracting the correct set of tarballs, what exactly is next? I have a tentative understanding that eventually I will be doing the configure; make; make install incantation, but I'm unclear what I need to do before and after.

crosstool compiles it/them for you.

More generally: You first read the build instructions on the website BEFORE you download the source of what you want.

Generally, the ./configure && make && sudo make install goes like this:

The source you extract to a temporary directory, cd into the directory and run ./configure This will check that all prerequisites are fulfilled. It will mention any missing libraries, these are in dev(debian)/devel(redhat/suse) packages that you will need. Locate them and install, and try ./configure again.

Once it completes without errors, you issue make.

Hopefully it completes without errors, you issue sudo make install.

Sometimes, you get a autogen.sh instead of configure ... read the instructions on the website.

You'll note the error mentions glibc-2.3.6. Where does this fit into the picture? As noted above, the ftp site I'm at only mentions gcc-4.2.4. I'm unclear what "melds" gcc-4.2.4 and glibc-2.3.6 for purposes of resolving the build error.

glibc is the c library used. The c library on the target platform must be a compatible version or you will get issues. Again, crosstool handles this for you.

So glibc is a c library, like a DLL, that all programs compiled with gcc (the C compiler) use. gcc compiles source code (text files) for a given platform/glibc version combination into binaries, executables and libraries.

You can see dependencies of a given program using ldd, like ldd /usr/bin/gawk, for example.

The noted ftp site looks like a "generic" gcc. I.e. from the filenames, I don't perceive any relation to powerpc-405. Am I on the right track, or should I be looking elsewhere? I did google for various combinations of "powerpc" and "gcc" and did not find anything that looked like it led to a powerpc-405-specific gcc.

The gcc source can be compiled for a number of target platforms. Here, you see the source code, platform-independent, one source fits all.

  • Your answer and the howto you pointed me to are very good reads. So as I understand it, Mr. Kegel's crosstool is actually a "wrapper" that helpfully combines the download+building of both gcc and glibc, which are actually separate entities but are ultimately both needed in order to do cross-compilation - do I have that right? – StoneThrow Jun 22 '17 at 20:22
  • Yes, indeed, that is what the howto reads, I have not used that tool ... – thecarpy Jun 22 '17 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.