Hi, Has anyone succeeded to build oggenc and oggdec on Mac OS X with static linking? I can build libogg and libvorbis and install them as dynamic libraries (by running ./configure, make and then make install). Then oggenc and oggdec will load them in runtime and use them. That works fine. But I'd like to build these two command line tools so they're linked with all the libraries they need. So one doesn't have to rely on dynamic libraries if the command line tools are used on another computer. The output from the configure script says something about using the libtool. Should I convert the dynamic libraries in /usr/local/lib to static ones and then build oggenc/oggdec? Or how's it supposed to be done? /Mike
On Tue, Nov 15, 2005 at 06:01:12PM +0100, Mikael Hillborg wrote:> Has anyone succeeded to build oggenc and oggdec on > Mac OS X with static linking?Apple doesn't support static linking on MacOS X. It used to work, but around v10.2 they forgot to ship a static version of one of the system libs, which breaks the normal -static linker flags. Bug reports on this have been wontfixed. If you want to use them from the gui you can wrap them in bundles, otherwise you're going to have to either install separate .dylibs or...I've never tried it, but you ought to be able to statically link in the ogg and vorbis libs while building a normal dynamically linked executable with respect to everything else. Probably just requires a custom link line with all the library .o's stuck in in liu of the normal -l directives. HTH, -r
>Has anyone succeeded to build oggenc and oggdec on >Mac OS X with static linking? I can build libogg >and libvorbis and install them as dynamic libraries >(by running ./configure, make and then make install). >Then oggenc and oggdec will load them in runtime >and use them. That works fine. > >But I'd like to build these two command line tools >so they're linked with all the libraries they need.I installed libogg and libvorbis through DarwinPorts, and I have both static (.a) and dynamic (.dylib) versions of the libraries. So that shows that it is quite possible to build the libs statically. You should be able to link the static libs into your program directly. You'll still need to be dynamically linked to the system stuff. - Josh
Hi,> I installed libogg and libvorbis through DarwinPorts, and I have both > static (.a) and dynamic (.dylib) versions of the libraries. So that > shows that it is quite possible to build the libs statically. You > should be able to link the static libs into your program directly. > You'll still need to be dynamically linked to the system stuff.Yes, the .a libs are built when you run "make all" on the libogg and libvorbis distributions from a console. But how do you build the vorbistools oggenc and oggdec to link against these .a libs and not in runtime using the .dylibs? That's the question. I don't want to link against Apple's system libs. There's no need for that. Just to link against the ogg and vorbis libs which are static (.a) and reside under /usr/local/lib/. How do I build the oggenc and oggdec tools so they're linked with the .a libs and not the .dylibs? For example I want to link with /usr/local/lib/libogg.a and not the /usr/local/lib/libogg.0.5.2.dylib. The latter is the default. In other words, linking to the dynamic lib is the default behaviour. It should be possible to change somewhere in the Makefile or in the configure file to override the default. But I cannot find the place. Anyone? I noticed that the configure script has some options. Can it be specified that way? Another problem... I tried building with Xcode instead, using the project file (vorbis.pbproj) in libvorbis-1.1.1 to see if I can build and link as static libs. But the project file refers to misc.c and .cvsignore. There are no such files in the distribution. Neither in libogg-1.1.2 nor in vorbis-tools-1.1.1. Compiling without them, in Xcode, results in a number of error messages. Anyone has a clue why? Mike
"Adam D. Moss" wrote:> > Daniel Mario Vega wrote: > >> gcc -o oggenc oggenc.o foo.o /usr/local/lib/libvorbisenc.a \ > >> /usr/local/lib/libvorbis.a /usr/local/lib/libogg.a -lm > >> > >> Try variations on that and see if you can get something to work. > >> > > That should work, the only problem is that the full library is included > > in the final executable instead of only the needed/used library object > > files (as a normal static linking would work). > > That should not be true - at least, it is not true here on x86 > with a really crusty old gnu ld and toolchain, where only objects > with referenced symbols end up in the executable. > > --AdamThe objects (libs) are indeed referenced (that's why they need to be included, because they are referenced). So they are included. The executable is 28 KB when it's linked dynamic and 500 KB when it's linked static. And I have tested the static one by uninstalling all dynamic and static libraries after the executable was built, just to ensure that the libs were included and it works fine. Mike
Possibly Parallel Threads
- [xiph-commits] r15069 - in trunk/vorbis-tools: oggdec oggenc
- oggdec.exe crash
- vorbis-tools 1.3.0 BETA - Help testing.
- oggdec and ogg123 playing audio from an Ogg Theora+Vorbis file?
- vorbis-tools-1.1.1 build mechanism stubbornly refuses to build with FLAC, ogg123, speex