[smpeg] SMPEG threading, SMPEG constructors

Doru-Catalin Togea doru-cat at student.matnat.uio.no
Sun Jan 12 15:27:39 EST 2003

On Wed, 8 Jan 2003, Ryan C. Gordon wrote:

> Are you sure that you've got the right library linked in? Put this in
> there:

No, it turned out that I didn't linked to the right library.

I am compiling with the following command:

	g++ `sdl-config --cflags --libs` -I/usr/include/smpeg/  -lsmpeg
	-lSDL -o receiver receiver.cpp

As far as I can tell, the libraries are dinamically loaded in at run-time.

Following somebody else's sugestion, I made a copy of my default linking
script (I used the "ld --verbose > ls.txt" command) and I changed the
order of the SEARCH_DIR statements from the original:

	SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib);


	SEARCH_DIR(/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/lib);

According to info ld I can invoke the linker with the -T option in order
to use my own linker script. The following compiles:

	g++ -Tls.txt `sdl-config --cflags --libs` -lg++
	-I/usr/include/smpeg/ -lsmpeg -lSDL -o receiver receiver.cpp

but the same libraries (from /usr/lib) are linked against at run-time.

info ld suggests that linker options should be enclosed between args
like -Wl (depending on the compiler),
so that the compiler will not discard linker options. So I tried

	g++ -Wl -Tls.txt -Wl `sdl-config --cflags --libs` -lg++
	-I/usr/include/smpeg/ -lsmpeg -lSDL -o receiver receiver.cpp

too, but the compiler does not recognize the -Wl options.

I'm getting confused with all these possibilities; I don't know how to
make both the compiler and the linker happy.

Since the following compiles and the original libraries from /usr/lib are
linked in at run-time

	g++ -Tls.txt `sdl-config --cflags --libs` -lg++
	-I/usr/include/smpeg/ -lsmpeg -lSDL -o receiver receiver.cpp

how do I modify the command so that libraries from /usr/local/lib (or some
other location X) are linked in either statically or dinamically?


	<<<< ================================== >>>>
	<<     We are what we repeatedly do.      >>
	<<  Excellence, therefore, is not an act  >>
	<<             but a habit.               >>
	<<<< ================================== >>>>

More information about the smpeg mailing list