linking to library in /usr/lib/

Samuel Verstraete samuel.verstraete@gmail.com
Wed Feb 28 11:10:00 GMT 2007


I'll just bump this in the hope someone that knows the solution reads
this.
gr,S

On Wed, 21 Feb 2007 09:45:24 +0100
Samuel Verstraete <samuel.verstraete@gmail.com> wrote:

> Hi,
> 
> This is a bit of a weird problem for me as afaik it doesn't make
> sense... 
> I have this small library to do some mathematical stuff, called GSlib.
> Due to having a libgs.so lib on my system already i named it libggs.
> 
> < Begin Makefile>
> LIBGS = libggs.a
> SRCS = acorni.f backtr.f beyond.f blue.f chknam.f chktitle.f cova3.f \
>         dlocate.f dpowint.f dsortem.f gauinv.f gcum.f getindx.f
> getz.f \ green.f hexa.f ksol.f ktsol.f locate.f nscore.f numtext.f \
>         ordrel.f picksupr.f powint.f psfill.f psline.f pstext.f
> rand.f \ red.f resc.f scal.f setrot.f setsupr.f sortem.f sqdist.f \
>         srchsupr.f strlen.f srchsuprsisim.f
> OBJS = $(SRCS:.f=.o)
> 
> LIBDIR = /usr/lib
> 
> FFLAGS = -c -O3 -fdefault-integer-8 -fcaller-saves -malign-double
> -funsafe-math-optimizations -fstrength-reduce
> -fexpensive-optimizations -funroll-loops -fomit-frame-pointer
> -march=k8 -msse -msse2 -m3dnow -mmmx 
> 
> all: $(LIBGS)
> 
> $(LIBGS): $(OBJS)
>         /usr/bin/ar -q $@ $(OBJS)
>         /usr/bin/ar -ts $@
> 
> .f.o:
>         gfortran $(FFLAGS) $*.f
> 
> install:
>         install -s -m 644 $(LIBGS) $(LIBDIR)
> 
> clean:
>         /bin/rm -rf $(OBJS) $(LIBGS) core
> </end Makefile>
> 
> This has always worked with g77 from the old gcc3 tree.
> 
> I could link my programs to this library in /usr/lib with the simple:
> g77 program.f -o program -lggs
> 
> Now, after upgrading to gcc4 (and gfortran) i can no longer use this
> command. It simply doesn't find the library anymore... After fiddling
> around a bit with ldconfig and stuff like that, all to no avail... i
> tried to *POINT* to the library very clearly.... so:
> gfortran program.f -o program.o -lggs -L/usr/lib
> 
> nothing... still no library found.... A twist of faith let me tried
> the following command:
> gfortran program.f -o program.o -lggs -L/home/samuel/gslib/gslib
> (that's where the library was originally created.)
> Confusingly this works just fine...
> So i checked permissions.... everything exactly the same....
> 
> To make sure this wasn't some flakey installation (box has been
> running like this for 3 years without reinstallation so i guess i
> gathered some mess already) i tried this on a freshly installed
> Ubuntu box... *exactly* the same result....
> 
> thnx for reading this... and a bigger thnx if you can solve this for
> me :)
> 
> gr,S.



More information about the Fortran mailing list