Page 8 of 16

Re: Newlib

Posted: Wed Sep 18, 2013 5:19 pm
by Wildwest

Re: Newlib

Posted: Wed Sep 18, 2013 6:11 pm
by SoUrcerer
esevece wrote:I don't understand how to use the newlib.
I tried translating this thread to spanish and english but it's not accurate.

I'll be grateful if someone can explain me in english what I have to do to use the newlib.
Prepare 32 bit gcc which able to generate PE output; then download a-libs, ld-scripts and "include" headers. Then use "nostdinc", custom ld script and newlib a-files to generate static binaries.

Re: Newlib

Posted: Wed Sep 18, 2013 8:59 pm
by stefano
Thank you Wildwest and SoUrcerer.

SoUrcerer: I will try to follow your guide.

Re: Newlib

Posted: Fri Sep 20, 2013 8:02 am
by stefano
I'm compiling GCC and BINUTILS following this guide http://wiki.osdev.org/GCC_Cross-Compiler.
Is right to use 'i586-mingw32' as --target?

Re: Newlib

Posted: Fri Sep 20, 2013 8:37 am
by SoUrcerer
If you on linux, you can just install mingw32 package. Also, there's port of binutils for Kolibri on SVN

Re: Newlib

Posted: Fri Sep 20, 2013 5:41 pm
by stefano
Ok. Thank you.

Re: Newlib

Posted: Sat Sep 21, 2013 4:08 am
by stefano
Do you mean that I don't have to compile GCC?
I've compiled binutils with the patch from the SVN and installed mingw32-gcc. But when I run `make` in 'newlib/' I get:

Code: Select all

gcc -c -O2 -fomit-frame-pointer -DBUILD_DLL -D_IEEE_LIBM -I ./include -o crt/crtdll.o crt/crtdll.c
In file included from crt/crtdll.c:10:0:
./include/sys/kos_io.h:69:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘unpack’
 void __stdcall unpack(void* packed_data, void* unpacked_data);
                ^
make: *** [crt/crtdll.o] Error 1

Re: Newlib

Posted: Sat Sep 21, 2013 11:08 am
by SoUrcerer
I suppose if you use binutils with i586-kos32 target, then you have to port gcc too. Otherwise you need to use i586-mingw32-gcc as compiler; check lua compile.sh/link.sh scripts: download/file.php?id=3748

Re: Newlib

Posted: Sat Sep 21, 2013 3:53 pm
by stefano
Ok, now I understand. Thank you SoUrcerer.
I will use that scripts as reference.

Re: Newlib

Posted: Sat Sep 21, 2013 5:11 pm
by stefano
I modified the 'Makefile' in 'newlib/' to use mingw32.
Now I have i486-mingw32-gcc, i486-mingw32-ld, etc. But I get an error because i486-mingw32-ld doesn't find 'libc.ver'.

Code: Select all

i486-mingw32-ld: cannot open linker script file libc.ver: No existe el fichero o el directorio (in english: the file or directory not exist)

Re: Newlib

Posted: Sat Sep 21, 2013 5:57 pm
by Serge
esevece
fixed

Re: Newlib

Posted: Sat Sep 21, 2013 7:11 pm
by stefano
Thank you Serge.
I got an error about "-lgcc". So, after search I found the solution adding "-L/usr/lib/gcc/i486-mingw32/4.7.2" to the line that uses "-lgcc".

Now I have newlib built. I will try to use newlib and if works I will create an article in the wiki.

Thanks guys.

Re: Newlib

Posted: Tue Oct 01, 2013 1:16 pm
by Serge
Есть вопрос.
Надо ли включать в SDK исходные коды пакетов (freetype ffmpeg cairo libpng, zlib etc) ?

Re: Newlib

Posted: Tue Oct 01, 2013 2:40 pm
by stefano
That question was to me?

Re: Newlib

Posted: Tue Oct 01, 2013 3:21 pm
by punk_joker
esevece, no.