Page 1 of 1

Where to install NewLib

Posted: Thu Aug 07, 2014 2:52 am
by EgeO
I am trying to port Newlib to my kernel. However I have no idea where to install library /usr/include or my kernels directory?

Re: Where to install NewLib

Posted: Thu Aug 07, 2014 3:41 am
by iansjack
You need to put it wherever your cross-compiler looks for includes/libraries. This is highly unlikely to be /usr/include or /usr/lib.

Re: Where to install NewLib

Posted: Thu Aug 07, 2014 3:56 am
by alexfru
I'm actually having a similar issue. I'd like to store my Smaller C compiler's header files and libraries in a location that would be common/logical/reasonable for Linux (and OSes alike), but I'm still new to Linux and I have no idea where I'd need to put my compiler's stuff. It's easy to find out where gcc stores its files, but Smaller C is not gcc and there isn't going to be any kind of compatibility or interchangeability between the two.

So far I've narrowed the choice down to:
/usr/local/smlrc/include
/usr/local/smlrc/lib

Reasonable? Unreasonable? Outright bad?

Re: Where to install NewLib

Posted: Thu Aug 07, 2014 5:19 am
by iansjack
/usr/local is a good base location if the compliler will be used by more than one account. If it's always going to be used by just one user then their home directory may be a better choice. And using another level of location is sensible to avoid any potential interplay with other headers (some libraries may install their files in /usr/local/include and /usr/local/lib so if you want to avoid the possibility of your compiler pulling them in then the extra level is useful).

Short answer - yes, your proposed location is fine. You just need to be sure that any environment variables, or Makefile variables, are set to look there and not the system locations.

Re: Where to install NewLib

Posted: Thu Aug 07, 2014 5:49 am
by alexfru
Thanks!

Re: Where to install NewLib

Posted: Thu Aug 07, 2014 6:28 am
by EgeO
Thanks for answers. I tried to install it on /opt/cross/lib/gcc/i686-elf/4.9.1/include/ but it gives me error: (I tried to remove i686-elf-cc from makefile but it still gives same error.)

Code: Select all

/bin/sh: i686-elf-cc: command not found
Makefile:386: recipe for target 'lib_a-dummy.o' failed
make[5]: *** [lib_a-dummy.o] Error 127
make[5]: Leaving directory '/opt/cross/src/build-newlib/i686-elf/newlib/libc/argz'
Makefile:675: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory '/opt/cross/src/build-newlib/i686-elf/newlib/libc'
Makefile:627: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/opt/cross/src/build-newlib/i686-elf/newlib'
Makefile:450: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/opt/cross/src/build-newlib/i686-elf/newlib'
Makefile:7423: recipe for target 'all-target-newlib' failed
make[1]: *** [all-target-newlib] Error 2
make[1]: Leaving directory '/opt/cross/src/build-newlib'
Makefile:824: recipe for target 'all' failed
make: *** [all] Error 2

Re: Where to install NewLib

Posted: Thu Aug 07, 2014 3:33 pm
by iansjack
So is i686-elf-cc in any of the directories in your path?

Re: Where to install NewLib

Posted: Sat Aug 09, 2014 1:46 pm
by EgeO
Sorry for late answer. And no there is no i686-elf-cc. After that i googled and someone suggested to change cc with gcc in makefile. After this output:

Code: Select all

/home/ege/newlib-2.1.0/newlib/libc/include/sys/_types.h:76:5: error: unknown type name 'wint_t'
     wint_t __wch;
     ^
Makefile:392: recipe for target 'lib_a-argz_add.o' failed
make[5]: *** [lib_a-argz_add.o] Error 1
make[5]: Leaving directory '/home/ege/newlib-2.1.0/build-newlib/i686-elf/newlib/libc/argz'
Makefile:675: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory '/home/ege/newlib-2.1.0/build-newlib/i686-elf/newlib/libc'
Makefile:627: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/ege/newlib-2.1.0/build-newlib/i686-elf/newlib'
Makefile:450: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/home/ege/newlib-2.1.0/build-newlib/i686-elf/newlib'
Makefile:7428: recipe for target 'all-target-newlib' failed
make[1]: *** [all-target-newlib] Error 2
make[1]: Leaving directory '/home/ege/newlib-2.1.0/build-newlib'
Makefile:829: recipe for target 'all' failed
make: *** [all] Error 2