Boost logo

Boost Users :

From: ericd (yg-boost-users_at_[hidden])
Date: 2003-05-23 12:10:33


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net