Where to install 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
EgeO
Posts: 9
Joined: Wed Jul 23, 2014 2:03 am

Where to install NewLib

Post 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?
User avatar
iansjack
Member
Member
Posts: 4709
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Where to install NewLib

Post 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.
alexfru
Member
Member
Posts: 1112
Joined: Tue Mar 04, 2014 5:27 am

Re: Where to install NewLib

Post 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?
User avatar
iansjack
Member
Member
Posts: 4709
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Where to install NewLib

Post 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.
alexfru
Member
Member
Posts: 1112
Joined: Tue Mar 04, 2014 5:27 am

Re: Where to install NewLib

Post by alexfru »

Thanks!
EgeO
Posts: 9
Joined: Wed Jul 23, 2014 2:03 am

Re: Where to install NewLib

Post 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
User avatar
iansjack
Member
Member
Posts: 4709
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Where to install NewLib

Post by iansjack »

So is i686-elf-cc in any of the directories in your path?
EgeO
Posts: 9
Joined: Wed Jul 23, 2014 2:03 am

Re: Where to install NewLib

Post 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
Post Reply