This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with Shared Library Archives


	I'm trying to make an archive of some shared libraries I made, but I
can't seem to get it to work correctly.  I'm using gcc on Red Hat 6, but I'd
also like to get it to work using gcc on Irix.  The problem I'm having is
that the executable wants to use the original .so files to link at runtime
rather than the .a archive I created, even though I linked with the .a
file.

	Here's part of the makefile I'm using:

CXX = g++ 
ARCHIVES = libsay1.a libsay2.a 
S1 = hello1.so bye1.so 
S2 = hello2.so bye2.so 
OBJECTS = main.o 
APPNAME = test 

all :  $(OBJECTS) $(ARCHIVES)
	cp libsay2.a libsay.a
	rm *.so
	${CXX} $(OBJECTS) libsay.a -fpic -o $(APPNAME) 

%.o:%.c
	${CXX} -fpic -c $< %.so:%.o
	${CXX} -shared -o $@ -fpic $< 

libsay1.a: $(S1)
	ar -rs $@ $(S1) 

libsay2.a: $(S2)
	ar -rs $@ $(S2)


	There are two different sets of libraries because I wanted to
test how the program would work if I switched out one library and swapped
in another.  Here's the error message I get in Irix:

Fatal Error: Cannot Successfully map soname 'bye2.so' under any of the filenames...

	And here's the one from Linux:

test: error in loading shared libraries: hello2.so: cannot open shared object file: No such file or directory

	Any help would be appreciated.

-- 
Brian Robinson 
brobinso@ist.ucf.edu 
Institute for Simulation and Training 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]