OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Dec 12, 2017 10:22 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Building gcc in cygwin for cross-compiling for MIPS linux
PostPosted: Wed Sep 20, 2017 2:51 pm 
Offline

Joined: Wed Sep 20, 2017 2:38 pm
Posts: 3
Hi,
I'm following the guide here http://wiki.osdev.org/GCC_Cross-Compiler, my target being
Code:
mipsel-unknown-linux-gnu

and I'm stuck at
Code:
make all-target-libgcc

which fails with
Code:
In file included from ../../../gcc-7.2.0/libgcc/gthr.h:148:0,
                 from ../../../gcc-7.2.0/libgcc/libgcov-interface.c:27:
./gthr-default.h:35:10: fatal error: pthread.h: No such file or directory
#include <pthread.h>
          ^~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:915: _gcov_dump.o] Error 1
make[1]: Leaving directory '/home/alikim/src/build-gcc/mipsel-unknown-linux-gnu/libgcc'
make: *** [Makefile:11866: all-target-libgcc] Error 2

What do I need to do to fix this error?

Also, since I'm not building a OS, just a program that needs to run under linux, will
Code:
--without-headers
limit my ability to use standard C libraries in my code?

Thank you!


Top
 Profile  
 
 Post subject: Re: Building gcc in cygwin for cross-compiling for MIPS linu
PostPosted: Wed Sep 20, 2017 3:39 pm 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 385
The wiki instructions are for building a freestanding compiler. If you want a hosted compiler, you'll need to build --with-sysroot and install the libc headers into the sysroot before building libgcc, libstdc++ and other GCC support libraries. You cannot use --without-headers and expect to use the C standard library.


Top
 Profile  
 
 Post subject: Re: Building gcc in cygwin for cross-compiling for MIPS linu
PostPosted: Wed Sep 20, 2017 5:14 pm 
Offline

Joined: Wed Sep 20, 2017 2:38 pm
Posts: 3
I'm following the wiki instructions for building a freestanding compiler, it's not what I want but it's a start...

The point is, it doesn't work. I copied all the instructions from the wiki and it fails as I described above, I'd like to know why, that's my question.

As per wiki, binutils were compiled with --with-sysroot and gcc with --without-headers.


Top
 Profile  
 
 Post subject: Re: Building gcc in cygwin for cross-compiling for MIPS linu
PostPosted: Wed Sep 20, 2017 5:24 pm 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 385
Let me reiterate: You cannot build a Linux compiler --without-headers. You need to pass --with-sysroot to the GCC build and compile your libc to that directory (using your cross compiler, that was built during all-gcc), before building libgcc.


Top
 Profile  
 
 Post subject: Re: Building gcc in cygwin for cross-compiling for MIPS linu
PostPosted: Wed Sep 20, 2017 6:39 pm 
Offline

Joined: Wed Sep 20, 2017 2:38 pm
Posts: 3
Oh god... I mean thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group