Thread: Linker Problems
Hello, This is only a small annoyance but I figured I would ask to see if anyone out there has any clues on how to fix it. I am using Linux Red Hat 7.1 with kernel 2.4.9-31. I have glibc 2.2.4-24, ld 2.10.91, gcc 2.96, and Postgres 7.2. My problem is when I am compiling programs I have written using lpq I have to give my compiler -L/<dir to libpq> even though it is in my ld.so.conf file and I have run ldconfig. I even checked to make sure that ldconfig was seeing those libraries by running ldconfig -p to print out the cache and see if the libraries were listed there and they were. I am not sure why ld is not seeing the libraries unless I specifically tell it to search the path where the libraries are, and it is not that hard to type in -L/<some dir> but it is slightly annoying that it does not work correctly. So if there is anyone out there who may have some clues about which direction to start looking for the solution in, it would be greatly appreciated. Thanks Isaac -- P.S. Somehow it seems like I ended up sending this message to the wrong mailing list the first time, so if for some reason this is the second time I have sent this message, please disregard it and accept my apologies for causing extra mail.
I would closely look at that entry in ld.so.conf. There may be leading or trailing spaces or some minor mispelling that's somehow throwing it off. Once I added the path to ld.so.conf I no longer had to specify the -L path, so to my mind there must be something wrong with the line in the conf file. Tim ----- Original Message ----- From: "isaac flemmin" <isaac@knox.net> To: <pgsql-interfaces@postgresql.org> Sent: Tuesday, June 04, 2002 1:17 PM Subject: Linker Problems > Hello, > > This is only a small annoyance but I figured I would ask to see if > anyone out there has any clues on how to fix it. > > I am using Linux Red Hat 7.1 with kernel 2.4.9-31. I have glibc > 2.2.4-24, ld 2.10.91, gcc 2.96, and Postgres 7.2. > > My problem is when I am compiling programs I have written using lpq I > have to give my compiler -L/<dir to libpq> even though it is in my > ld.so.conf file and I have run ldconfig. I even checked to make sure > that ldconfig was seeing those libraries by running ldconfig -p to print > out the cache and see if the libraries were listed there and they were. > I am not sure why ld is not seeing the libraries unless I specifically > tell it to search the path where the libraries are, and it is not that > hard to type in -L/<some dir> but it is slightly annoying that it does > not work correctly. > > So if there is anyone out there who may have some clues about which > direction to start looking for the solution in, it would be greatly > appreciated. > > Thanks > Isaac > -- > P.S. Somehow it seems like I ended up sending this message to the wrong > mailing list the first time, so if for some reason this is the second > time I have sent this message, please disregard it and accept my > apologies for causing extra mail. > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >
Hello, Thanks for the prompt reply! Yes I did double check that line in ld.so.conf and it is okay. I even ran ldconfig -p to check the ld.so.cache file and see if the actual files from the directory were in the cache and they were. So I am rather confused as to why it will not link unless I specifically use -L to show the path. As I said I am not very concerned about it since it seems to work just fine when I do use -L so it is only a slight annoyance. I will update though if I figure anything out and would still appreciate any input anyone may have who maybe experienced the same type of trouble and how they fixed it. Thanks again Isaac -- -----Original Message----- From: Tim Barnard [mailto:tbarnard@povn.com] Sent: Tuesday, June 04, 2002 1:27 PM To: isaac flemmin Cc: pgsql-interfaces@postgresql.org Subject: Re: Linker Problems I would closely look at that entry in ld.so.conf. There may be leading or trailing spaces or some minor mispelling that's somehow throwing it off. Once I added the path to ld.so.conf I no longer had to specify the -L path, so to my mind there must be something wrong with the line in the conf file. Tim ----- Original Message ----- From: "isaac flemmin" <isaac@knox.net> To: <pgsql-interfaces@postgresql.org> Sent: Tuesday, June 04, 2002 1:17 PM Subject: Linker Problems > Hello, > > This is only a small annoyance but I figured I would ask to see if > anyone out there has any clues on how to fix it. > > I am using Linux Red Hat 7.1 with kernel 2.4.9-31. I have glibc > 2.2.4-24, ld 2.10.91, gcc 2.96, and Postgres 7.2. > > My problem is when I am compiling programs I have written using lpq I > have to give my compiler -L/<dir to libpq> even though it is in my > ld.so.conf file and I have run ldconfig. I even checked to make sure > that ldconfig was seeing those libraries by running ldconfig -p to print > out the cache and see if the libraries were listed there and they were. > I am not sure why ld is not seeing the libraries unless I specifically > tell it to search the path where the libraries are, and it is not that > hard to type in -L/<some dir> but it is slightly annoying that it does > not work correctly. > > So if there is anyone out there who may have some clues about which > direction to start looking for the solution in, it would be greatly > appreciated. > > Thanks > Isaac > -- > P.S. Somehow it seems like I ended up sending this message to the wrong > mailing list the first time, so if for some reason this is the second > time I have sent this message, please disregard it and accept my > apologies for causing extra mail. > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >
"isaac flemmin" <isaac@knox.net> writes: > Yes I did double check that line in ld.so.conf and it is okay. I even > ran ldconfig -p to check the ld.so.cache file and see if the actual > files from the directory were in the cache and they were. So I am rather > confused as to why it will not link unless I specifically use -L to show > the path. AFAIR, ld.so.conf only affects the behavior of the dynamic loader. You *also* need to persuade the compiler/linker to find the library during link. I believe gcc's default link search path can be configured if you're willing to futz with its config file, but it might be a lot easier just to drop the library in one of the standard places, eg, /usr/local/lib... regards, tom lane