I'm trying to cross-compile VLC (from linux to windows) with gnutls support which in turn uses libgmp. I get linking errors for multiple definitions for symbols in libgmp (___gmpz_abs), for example, among countless others). I have in turn traced this back to libgnutls.a having multiple definitions of the same symbol, due to object files in gnutls each having their own definitions of gmp functions. The functions that are multiply defined are ones that libgmp is trying to do something tricky with inlining.
There's a lot of variation with inlining between different compilers, standards, and platforms, from what I can tell. It seems like libgmp is trying to use macros to handle this all properly but is failing. The end result is inline functions defined in gmp.h are getting copied into every object file in gnutls that uses it. I've looked at the actual compiler command lines that mingw is called with to create these object files, and I can't see anything wrong with it:
libtool: compile: i686-w64-mingw32-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I./../../gl -I./../../gl -I./../includes -I./../includes -I./../../gl -I./.. -I./../minitasn1 -I/home/jeremy/vlc/contrib/i686-w64-mingw32/include -I/home/jeremy/vlc/contrib/i686-w64-mingw32/include -g -c mpi.c -o mpi.o
in particular -std=gnu99 was suggested as a solution to similar problems elsewhere online, but obviously this is already being used by default.
It's unclear whose fault this is, mingw's libtool's gnutls's or gmp's
The question I need answered is: What flags or options do I need to configure or make gnutls with so that the inline function definitions will be properly handled?