Hi all, I have compiled the boost::filesystem using bjam and that seemed to have gone well. The first question I have concerning this is if it is normal NOT to have a libfilesystem.so. I can only find the libfilesystem.a. The path where this lives is quite deep. /usr/local/boost_1_30_0/boost/libs/filesystem/build/bin/libboost_filesystem.a/gcc/release/runtime-link-dynamic and /usr/local/boost_1_30_0/boost/libs/filesystem/build/bin/libboost_filesystem.a/gcc/debug/runtime-link-dynamic My current setup is an Ultra 80 running Solaris 9. I use both gcc version 3.2.3 for compiling and linking. The version of Boost is 1.30.0. For my second question. Having this built, I have tried to use it but come up with undefined symbols The output follows: g++ -lboost_filesystem -o io main.o Undefined first referenced symbol in file boost::filesystem::path::native_directory_string() constmain.o boost::filesystem::path::native_file_string() constmain.o boost::filesystem::path::path[in-charge](char const*, boost::filesystem::path_fo rmat)main.o boost::filesystem::directory_iterator::directory_iterator[in-charge](boost::file system::path const&)main.o boost::filesystem::path::leaf() constmain.o boost::filesystem::initial_path() main.o boost::filesystem::system_complete(boost::filesystem::path const&)main.o boost::filesystem::directory_iterator::m_inc() main.o boost::filesystem::directory_iterator::directory_iterator[in-charge]()main.o boost::filesystem::is_directory(boost::filesystem::path const&)main.o boost::filesystem::directory_iterator::m_deref() constmain.o boost::filesystem::exists(boost::filesystem::path const&)main.o ld: fatal: Symbol referencing errors. No output written to io Now I am quite sure that the path to the filesystem library is correct and therefore, cannot figure out why this will not link properly. But then again, I might be mistaken. Here is a snip from my makefile. On second thought, here is the whole thing: SHELL = /bin/sh # PROJECTLOCATION = /home/ericd/Projects/FileSystemTest EXEDIR = $(PROJECTLOCATION)/bin # LIBPATH = -L/usr/local/lib # Sources, includes and the likes.. also output names SELFTESTSRC = main.cpp INCLUDE = -I/usr/local/boost_1_30_0/boost SELFTEST = io # ifeq (,$(filter _%,$(notdir $(CURDIR)))) include target.mk else VPATH = $(SRCDIR) # Compiler Linker Defines for test exe CXX = g++ LD = g++ DEBUG = -g CXXSELFTEST = $(DEBUG) $(INCLUDE) -c -O2 -W -Wall -Wno-unused -Wno-multichar -fexceptions LDSELFTESTFLAGS = -lboost_filesystem # Building options all: test test: CXXFLAGS = $(CXXSELFTEST) test: $(SELFTEST) # SELFTESTOBJ = $(SELFTESTSRC:.cpp=.o) # pull in dependency info for *existing* .o files -include $(SELFTESTOBJ:.o=.d) # Compile and generate dependency info %.o: %.cpp $(CXX) $(CXXFLAGS) -MMD $(SRCDIR)/$*.cpp -o $@ @mv -f $*.d $*.d.tmp @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $*.d @rm -f $*.d.tmp # Link all Object Files and copy them over to our bin $(SELFTEST): $(SELFTESTOBJ) $(LD) $(LDSELFTESTFLAGS) -o $(SELFTEST) $(SELFTESTOBJ) cp $(SELFTEST) $(EXEDIR)/$(SELFTEST) # endif I have added in my .cshrc at the LD_LIBRARY_PATH var the location of my filesystem library. Being relatively new to gcc my guess is that something has to be wrong with the flags I give it. I did do an nm -C libfilesystem.a and all missing symbols reported by the link are there. Does anyone have any clue as to why this aint working? Thanks in advance for your input, Eric
I am also trying unsuccessfully to use the boost filesystem library. I am getting an undefined symbol error when attempting to link the example simple_ls.c program. I am also puzzled by the lack of .so libraries, but I can use only .a's if necessary. Could someone post a command line that will compile and link simple_ls.c on any linux with any gcc ? I think I could work my way forward from that, if I had it. I copied the libs/filesystem/build/bin/libboost_filesystem.a/gcc/debug/runtime-link-dynamic/libboost_filesystem.a file to /usr/lib. I also have the boost header files copied to /usr/include/boost. I have been trying variations on this command line and been getting pretty much the same error: [code] rgristroph-austin| g++ -lboost_filesystem -o simple_ls simple_ls.cpp /tmp/rgr/cckWE2oM.o: In function `main': /tmp/rgr/cckWE2oM.o(.text+0x19): undefined reference to `boost::filesystem::initial_path()' /tmp/rgr/cckWE2oM.o(.text+0x4c): undefined reference to `boost::filesystem::path::path[in-charge](char const*, boost::filesystem::path_format)' /tmp/rgr/cckWE2oM.o(.text+0x5c): undefined reference to `boost::filesystem::system_complete(boost::filesystem::path const&)' /tmp/rgr/cckWE2oM.o(.text+0x111): undefined reference to `boost::filesystem::exists(boost::filesystem::path const&)' /tmp/rgr/cckWE2oM.o(.text+0x134): undefined reference to `boost::filesystem::path::native_file_string() const' /tmp/rgr/cckWE2oM.o(.text+0x1b7): undefined reference to `boost::filesystem::is_directory(boost::filesystem::path const&)' /tmp/rgr/cckWE2oM.o(.text+0x1da): undefined reference to `boost::filesystem::path::native_directory_string() const' /tmp/rgr/cckWE2oM.o(.text+0x242): undefined reference to `boost::filesystem::directory_iterator::directory_iterator[in-charge]()' /tmp/rgr/cckWE2oM.o(.text+0x255): undefined reference to `boost::filesystem::directory_iterator::directory_iterator[in-charge](boost::filesystem::path const&)' /tmp/rgr/cckWE2oM.o(.text+0x289): undefined reference to `boost::filesystem::is_directory(boost::filesystem::path const&)' /tmp/rgr/cckWE2oM.o(.text+0x2bd): undefined reference to `boost::filesystem::path::leaf() const' /tmp/rgr/cckWE2oM.o(.text+0x33f): undefined reference to `boost::filesystem::path::leaf() const' /tmp/rgr/cckWE2oM.o(.text+0x401): undefined reference to `boost::filesystem::path::leaf() const' /tmp/rgr/cckWE2oM.o(.text+0x56f): undefined reference to `boost::filesystem::path::native_file_string() const' /tmp/rgr/cckWE2oM.o: In function `boost::filesystem::directory_iterator::operator*() const': /tmp/rgr/cckWE2oM.o(.gnu.linkonce.t._ZNK5boost10filesystem18directory_iteratordeEv+0xd): undefined reference to `boost::filesystem::directory_iterator::m_deref() const' /tmp/rgr/cckWE2oM.o: In function `boost::filesystem::directory_iterator::operator->() const': /tmp/rgr/cckWE2oM.o(.gnu.linkonce.t._ZNK5boost10filesystem18directory_iteratorptEv+0xd): undefined reference to `boost::filesystem::directory_iterator::m_deref() const' /tmp/rgr/cckWE2oM.o: In function `boost::filesystem::directory_iterator::operator++()': /tmp/rgr/cckWE2oM.o(.gnu.linkonce.t._ZN5boost10filesystem18directory_iteratorppEv+0xd): undefined reference to `boost::filesystem::directory_iterator::m_inc()' collect2: ld returned 1 exit status [code] rgristroph-austin| Many thanks for any help, --Rob
yg-boost-users@m.gmane.org wrote:
I am also trying unsuccessfully to use the boost filesystem library. I am getting an undefined symbol error when attempting to link the example simple_ls.c program. I am also puzzled by the lack of .so libraries, but I can use only .a's if necessary.
[snip]
I have been trying variations on this command line and been getting pretty much the same error:
[code] rgristroph-austin| g++ -lboost_filesystem -o simple_ls [simple_ls.cpp /tmp/rgr/cckWE2oM.o: In function `main': /tmp/rgr/cckWE2oM.o(.text+0x19): undefined reference to
The command you gave fails to me, as well. However, g++ -o simple_ls simple_ls.cpp -lboost_filesystem works. The order you specify libraries is important. Ain't it fun ;-) - Volodya
"Vladimir" == Vladimir Prus
writes: Vladimir> Vladimir> yg-boost-users@m.gmane.org wrote: I am also trying unsuccessfully to use the boost filesystem library. I am getting an undefined symbol error when attempting to link the example simple_ls.c program. I am also puzzled by the lack of .so libraries, but I can use only .a's if necessary. Vladimir> Vladimir> The command you gave fails to me, as well. However, Vladimir> Vladimir> g++ -o simple_ls simple_ls.cpp -lboost_filesystem Vladimir> Vladimir> works. The order you specify libraries is important. Ain't it fun ;-) Vladimir> Vladimir> - Volodya
That worked for me. I should have experimented more before giving up. Many thanks for the advice ! --Rob P.S. Is there a page in the wiki that we should add this to ?
participants (3)
-
ericd
-
Vladimir Prus
-
yg-boost-users@m.gmane.org