GNOME Bugzilla – Bug 720415
multiple definition of `__gmpn_sub_n'
Last modified: 2014-02-03 17:16:51 UTC
I'm trying to cross-compile GStreamer with Cerbero (http://cgit.freedesktop.org/gstreamer/sdk/cerbero) I'm compiling on Debian 64-bit for Windows 32-bit. I get the following error during compiling nettle: i686-w64-mingw32-gcc -Wall -g -O2 -DWINVER=0x0501 -ggdb3 -Wno-pointer-sign -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wbad-function-cast -Wnested-externs -L.. -L/home/kyle/software/cerbero/builds/win32/2013.12.13/lib ecc-modinv-test.o testutils.o ../nettle-internal.o -lhogweed -lnettle -lgmp -o ecc-modinv-test.exe /home/kyle/software/cerbero/builds/win32/2013.12.13/lib/libgmp.a(sub_n.o):/home/kyle/cerbero/sources/windows_x86/gmp-5.0.5/mpn/tmp-sub_n.s:82: multiple definition of `__gmpn_sub_n' ../libhogweed.dll.a(d000129.o):(.text+0x0): first defined here I would be happy to provide further information if needed.
The library name is the main issue. It is possible to create a link to a .dll file with ln -s, but the link name needs to be in the format gmp.lib, and not libgmp.lib. Renaming the lib to gmp.lib solves the issue. For more information about linking dll files: https://sourceware.org/binutils/docs/ld/WIN32.html#index-direct-linking-to-a-dll-700 This all might be because Cerbero is not running gen_library_file for the recipe gmp. For most other recipes there are xxx.lib files for each, generated with gen_library_file. I see two solutions: 1. Have Cerbero generate the lib file using gendef and dlltool and discard the link that make install creates 2. Patch gmp to create a gmp.lib link to libgmp-10.dll, NOT libgmp.lib
I apologize for the above post, it somehow made it onto the wrong bug. This bug can be marked as resolved, because I cannot reproduce it with the latest Cerbero.