[XviD-devel] Linked errors cross-compiling for x64 Windows on x64 Linux

Leo Izen leo.izen at gmail.com
Wed Feb 16 05:05:25 CET 2011

I'm getting linker errors cross-compiling xvidcore. My build is x86_64-unknown-linux-gnu and my host is x86_64-w64-mingw32 using a recent (4.6.0) Mingw-w64 gcc for linux. I grabbed the latest cvs, cd'd to xvidcore/build/generic/ and ran

./configure --host=x86_64-w64-mingw32 --prefix=/usr/local/x86_64-w64-mingw32

I had to manually patch the platform.inc to remove the -mno-cygwin compiler and linker flags. I also edited the $STATIC_LIBRARY to include lib before the name. My CPPFLAGS variable points to the headers I've already installed and my CFLAGS is -w (no warnings). I can compile all the files to object no problem with make. The issue becomes linking. Building the static library wasn't an issue because all it does is ar and ranlib. But building the dynamic library spits out all kinds of undefined reference errors. However, I nm'd the static library after the error but before make clean and piped it into grep and the symbols WERE in the library. My LDFLAGS are "-static -L/usr/local/x86_64-w64-mingw32/lib". That directory contains other libraries such as libpthread.a that I built with the cross-compiler toolchain. That directory is also in LD_LIBRARY_PATH to be extra sure.

The type of linker errors I'm getting persist even without the shared lib. i.e. I edited the Makefile (I know I shouldn't do that) to remove the target $(SHARED_LIB) from make all and make install. I then built the static lib and ran make install. Now, however, when I try to compile a simple front-end with -lxvidcore, I get the same undefined reference errors even though nm says they're there. What's even weirder is that the error says: libxvidcore.a: undefined reference to ... Not frontend.o: undefined reference to ...

Can someone help me fix this? Thanx.

More information about the Xvid-devel mailing list