0
votes

I am trying to compile a piece of code on my Linux system (x86_64) for MIPS big endian architecture.

Basically I followed this URL: https://www.linux-mips.org/wiki/Toolchains

to get my own tool chain.

I tried to compile software, configure phase is OK:

./configure --target=mips-unknown-linux-gnu --host=mips-unknown-linux-gnu CC=/opt/cross/bin/mips-unknown-linux-gnu-gcc  --prefix=/opt/mycode

I get this error just after "make":

# make
make  all-recursive
make[1]: Entering directory `/usr/local/src/code2.0.9'
Making all in compat
make[2]: Entering directory `/usr/local/src/code2.0.9/compat'
/opt/cross/bin/mips-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I..          -I../include -I../include  -Wall -O2  -MT Thread.o -MD -MP -MF     .deps/Thread.Tpo -c -o Thread.o Thread.c
In file included from Thread.c:71:0:
../include/headers.h:78:20: fatal error: stdlib.h: No such file or      directory
 #include <stdlib.h>

How can I fix this issue? Thank you

2
The <stdlib.h> header file is part of the C standard library, it should be available for all C implementations. If you don't have it then your cross-compilation environment is not properly installed. Have you e.g. installed a C standard library, cross-compiled for your target?Some programmer dude
And a note about "target" and "host"... The "target" is the platform you're building for, the "host" is the platform you're building on. If you're on an x86_64 Linux system, then that's the host.Some programmer dude
Do you have stdlib.h somehwere inside /opt/cross directory?KamilCuk
Hi Kamil, no, I don't!hap78
root@server:/opt/cross# find . -name stdlib.h returns nothinghap78

2 Answers

0
votes

I think host command is not correct.

try this,

./configure --target=mips-unknown-linux-gnu --host=linux CC=/opt/cross/bin/mips-unknown-linux-gnu-gcc --prefix=/opt/mycode

0
votes

I finally solved with buildroot. I set target mips and build my toolchain. After that, I used this command to compile source:

./configure --enable-static --disable-shared --target=mips-buildroot-linux-gnu --host=mips-buildroot-linux-gnu CC=/home/myuser/buildroot-2019.05.1/output/host/bin/mips-linux-gcc --with-openssl=no  --disable-profiling

All went ok