[FWTools] Probably did something stupid...
Mike Toothaker
mtoothaker at milcord.com
Wed Jul 25 15:45:34 EDT 2007
Thanks for your quick response, but for some reason I don't seem to be
able to get the LD_LIBRARY_PATH thing to work. I am using bash on
Fedora 7, g++ v4.1.1, FWTools-linux-1.3.4.tar.gz.
Here is my make file:
CC = g++
CMBN = cmilcordbn
SMILE = /root/Desktop/smile
FWLIB = /root/FWTools/lib
FWINC = /root/FWTools/include
test: milcordbn.o milcordsmilebn.o test.o
$(CC) -o test -L$(FWLIB) test.o \
milcordsmilebn.o milcordbn.o \
$(SMILE)/libsmilearn.a $(SMILE)/libsmilexml.a $(SMILE)/libsmile.a
test.o: test.cpp
$(CC) -c test.cpp -I$(CMBN) -I$(SMILE) -o test.o
milcordsmilebn.o: $(CMBN)/MilcordSmileBN.cpp $(CMBN)/MilcordSmileBN.cpp
milcordbn.o
$(CC) -c $(CMBN)/MilcordSmileBN.cpp -I$(SMILE) -I$(CMBN) -o
milcordsmilebn.o
milcordbn.o: $(CMBN)/MilcordBN.cpp $(CMBN)/MilcordBN.h
$(CC) -c $(CMBN)/MilcordBN.cpp -o milcordbn.o
clean:
rm -rf *.o
rm -f test
Here is a smathering of the errors I get:
/root/Desktop/smile/libsmilearn.a(dataset.o): In function
`MapIndex(std::map<std::basic_string<cha
r, std::char_traits<char>, std::allocator<char> >, int,
std::less<std::basic_string<char, std::cha
r_traits<char>, std::allocator<char> > >,
std::allocator<std::pair<std::basic_string<char, std::ch
ar_traits<char>, std::allocator<char> > const, int> > >&, char const*)':
dataset.cxx:(.text+0x912): undefined reference to
`std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::_Rep::_S_empty_rep_storage'
dataset.cxx:(.text+0x954): undefined reference to
`__gnu_cxx::__exchange_and_add(int volatile*, in
t)'
dataset.cxx:(.text+0x97d): undefined reference to
`__gnu_cxx::__exchange_and_add(int volatile*, in
t)'
I know that the errors do not refer to gdal or any of the FWTools
libraries, etc. so you might say "Well it is something wrong with smile,
not a problem with FWTools..." But here is the kicker, if I take out the
-L$(FWLIB) then it compiles and runs fine. I can also do something
similar where I have code that uses FWTools and not smile and it works
fine. What I don't understand is what I am doing wrong that these two
libraries can't play well together.
Something else that was suggested to me was that maybe it was a problem
with there being libraries with the same names in the FWTools/lib folder
and the /usr/lib folder, could this be the problem? If so how do I go
about fixing that?
Thanks again for any help you can give. I have not spent much time
compiling on Linux, and I have been trying this for 2 days and I don't
have much hair left.
Thanks,
Mike
Frank Warmerdam wrote:
> Mike Toothaker wrote:
>> This is the Makefile for both which will not compile. The problem
>> seems to be connected to the “–Wl,-rpath,$(FWLIB)” part, and the
>> error lines seem to indicate that it is trying to find the libraries
>> for smile even though it cannot. So my question is maybe it is
>> because I am trying to mix shared and static libraries as the smile
>> libraries are .a and the libraries for FWTools are .so, is it
>> possible to get statically built copies of the FWTools libraries? Is
>> there some way that I can have it link in the static libraries for
>> smile and use the shared ones for FWTools at run time? If I leave
>> off the –Wl stuff then I get errors that it has unreferenced function
>> calls for my gdal functions.
> ...
>> test: milcordsmilebn.o milcordbn.o test.cpp
>>
>> $(CC) -o test.exe test.cpp milcordsmilebn.o milcordbn.o \
>>
>> -L$(SMILE) -I$(SMILE) -I$(CMBN) -lsmilearn -lsmilexml
>> -lsmile \
>>
>> -L$(FWLIB) -I$(CMDB) -I$(FWINC) -lgdal -Wl,-rpath,$(FWLIB)
>
> Mike,
>
> I'm a bit fuzzy on the -Wl,-rpath flag. Why do you need this for
> FWTools?
> Can't you just add the FWLIB directory to LD_LIBRARY_PATH?
>
> There is no option to get the static libraries for FWTools.
>
> Best regards,
More information about the FWTools
mailing list