|
FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
What include and shared library directories are searched by gcc
Hello I have a question concerning gcc with f2c files and where gcc looks for include and shared library directories. Perhaps this should be in the programming section but since the problem only occurs in freebsd and I did not intend to do programming, I hope that I can ask it here.
The problem is that I want to compile foo.c which is the output from f2c program. The makefile make.sh is as follows Code:
gcc -03 -o oscillator oscillator.c -lf2c -lm Code:
/usr/local/inclucde Code:
gcc -03 -o oscillator oscillator.c -I/usr/local/include -lf2c -lm Code:
ldconfig -r | grep lf2c Code:
531:-lf2c.2 => /usr/local/lib/libf2c.so.2 Code:
gcc -03 -o oscillator oscillator.c -I/usr/local/include -L/usr/local/lib -lf2c -lm So my question are 1)why gcc does not look in the /usr/local for include files and why if ldconfig had lf2c linked why did gcc not find the file. 2) how can I change so that gcc looks for include and library files in /usr/local 3) Is the gcc in /usr/bin the same as /usr/local/gccXX, what I can see it is not a link |
|
||||
Code:
Terry@dixie$ gcc -v -E - 15:26 Using built-in specs. Target: i386-undermydesk-freebsd Configured with: FreeBSD/i386 system compiler Thread model: posix gcc version 4.2.1 20070719 [FreeBSD] /usr/libexec/cc1 -E -quiet -v -D_LONGLONG - -std=c99 -Wall -W -Wpointer-arith -Wbad-function-cast ignoring duplicate directory "/usr/include" #include "..." search starts here: #include <...> search starts here: /usr/include End of search list. ^C Terry@dixie$ 15:27 Why *should* the system compiler search anything but the system headers and libraries by default ? Like most decent compilers and some indecent ones gcc can be told to append items to it's search paths. Code:
gcc -I/usr/local/include -L/usr/local/lib -lX11 xlib_test.c -o test where (LANG) is C, CPLUS, OBJC, and so on. NOTE: ensuring the correctness and secure implementation of third party libraries is not a core concern of the FreeBSD project when compared to system libraries.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
Thank you for your reply.
So I guess that /usr/local/include /usr/local/lib should not be searched by the preprocessor and linker. I think I was confused since it was mentioned as the default in the configuration of gcc via --with-local-prefix=dirname and some post mentioned that it could be changed post installation in make.conf. It probably worked smoother in ubunto since the package manager put the f2c things in /usr/lib and /usr/include. |
|
||||
I wouldn't be familiar with gcc's installation/initial configuration phases. I have little use for any operating system that does not include a C Compiler by default :-)
Various Linux Distros tend to place things where ever they like. But on FreeBSD, everything that doesn't come with the system gets stuffed into /usr/local/ instead of /usr/, with few exceptions (e..g grub if installed)
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Shared object not found 'libwrap.so.4' | magic | FreeBSD General | 3 | 22nd July 2009 09:36 PM |
Is /usr/X11R6/include/ supposed to be in $CPATH | kasse | OpenBSD General | 4 | 3rd December 2008 05:34 PM |
shared libraries and linux emulation | Business_woman | FreeBSD General | 4 | 16th November 2008 10:03 AM |
/usr/local and application directories | ducu_00 | FreeBSD Ports and Packages | 14 | 23rd May 2008 05:37 PM |
Home directories suddenly missing in Samba | Dagoles | FreeBSD General | 4 | 22nd May 2008 12:50 AM |