compile errors when porting newlib

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
szhou42
Member
Member
Posts: 67
Joined: Thu Apr 28, 2016 12:40 pm
Contact:

compile errors when porting newlib

Post by szhou42 »

I've followed the exact steps described in this tutorial http://wiki.osdev.org/Porting_Newlib
but when I do

Code: Select all

make all
to compile newlib, it gives me this error:

Code: Select all

mkdir tmp
cd tmp; \
	 for i in argz/lib.a stdlib/lib.a ctype/lib.a search/lib.a stdio/lib.a   string/lib.a signal/lib.a time/lib.a locale/lib.a reent/lib.a  errno/lib.a misc/lib.a     machine/lib.a sys/lib.a; do \
	   i686-simpleos-ar x ../$i; \
	 done; \
	i686-simpleos-ar rc ../libc.a *.o
i686-simpleos-ar: ../sys/lib.a: No such file or directory
i686-simpleos-ranlib libc.a
rm -rf tmp
rm -f crt0.o
ln sys/crt0.o crt0.o >/dev/null 2>/dev/null || cp sys/crt0.o crt0.o
cp: cannot stat ‘sys/crt0.o’: No such file or directory
make[5]: *** [crt0.o] Error 1
make[5]: Leaving directory `/home/vagrant/backup/build-newlib/i686-simpleos/newlib/libc'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/home/vagrant/backup/build-newlib/i686-simpleos/newlib/libc'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/vagrant/backup/build-newlib/i686-simpleos/newlib'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/vagrant/backup/build-newlib/i686-simpleos/newlib'
make[1]: *** [all-target-newlib] Error 2
make[1]: Leaving directory `/home/vagrant/backup/build-newlib'
make: *** [all] Error 2
Can someone explains what's going on and how to solve this problem? thanks
szhou42
Member
Member
Posts: 67
Joined: Thu Apr 28, 2016 12:40 pm
Contact:

Re: compile errors when porting newlib

Post by szhou42 »

.
User avatar
kotovalexarian
Member
Member
Posts: 38
Joined: Tue Nov 24, 2020 10:17 am
Contact:

Re: compile errors when porting newlib

Post by kotovalexarian »

I have the same error.

Google shows four results when searching the error message, one of which is this thread and others are:
None of them provides an answer.
Octocontrabass
Member
Member
Posts: 5440
Joined: Mon Mar 25, 2013 7:01 pm

Re: compile errors when porting newlib

Post by Octocontrabass »

One source suggests that this error means you're not using automake 1.11 for whichever reason.
nullplan
Member
Member
Posts: 1740
Joined: Wed Aug 30, 2017 8:24 am

Re: compile errors when porting newlib

Post by nullplan »

It appears the build system could not build sys/crt0.o nor sys/lib.a, but why is not evident from the error listings. You might want to investigate the build files in the sys directory.
Carpe diem!
User avatar
kotovalexarian
Member
Member
Posts: 38
Joined: Tue Nov 24, 2020 10:17 am
Contact:

Re: compile errors when porting newlib

Post by kotovalexarian »

Octocontrabass wrote:One source suggests that this error means you're not using automake 1.11 for whichever reason.
I'm using Automake 1.15.1, which is greater.
Octocontrabass
Member
Member
Posts: 5440
Joined: Mon Mar 25, 2013 7:01 pm

Re: compile errors when porting newlib

Post by Octocontrabass »

It doesn't work with higher versions. Try again with Automake 1.11.
User avatar
kotovalexarian
Member
Member
Posts: 38
Joined: Tue Nov 24, 2020 10:17 am
Contact:

Re: compile errors when porting newlib

Post by kotovalexarian »

True. https://wiki.osdev.org/Porting_Newlib says:
The newlib source is organized using "Cygnus style," which is unsupported in Automake versions 1.12 and beyond. Therefore, to be able to build newlib, you need a version less than or equal to 1.11.
Why didn't authors of Newlib changed this since 2012, when the next minor version of Automake was released? Should I build Automake to just build Newlib? Genius.

UPD: Automake 1.11 doesn't even work for me. Automake creators are genius too. They drop feature support as minor version change, they don't provide message that feature is not supported.
techdude17
Posts: 4
Joined: Fri Dec 23, 2022 1:06 pm

Re: compile errors when porting newlib

Post by techdude17 »

Hi all! I was having a similar issue to this and I hope I can shed some light on what fixed it for me.

I was using Newlib 3.0.0 (if it matters, 20180206) and was encountering the same issue. Changing versions of autoconf and automake did not help (although the newlib README is bad and doesn't specify that you need a Cygnus-compatible automake and autoconf).

However, if you look a little further up in the build log, you might spot some compile errors from GCC for your C files. For some reason, the Makefile just ignores these errors and tries to continue, which can be misleading. Look a little further up in your compilation logs to see if there are any.

For reference here are the versions of tools I used for Newlib 3:
- autoconf: 2.69
- automake: 1.12.1
- aclocal: 1.12.1

Hope this helps!
Currently developing reduceOS, being rewritten on a new branch - https://github.com/sasdallas/reduceOS/tree/rewrite
Post Reply