After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 723401 - Nettle fails to build hogweed
Nettle fails to build hogweed
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: packages
unspecified
Other Windows
: Normal critical
: 1.3.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-01-31 22:07 UTC by Kyle
Modified: 2014-06-22 15:56 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Kyle 2014-01-31 22:07:46 UTC
When cross compiling GStreamer with Cerbero on Debian, I get an error at gnutls configure:
configure: error: 
  ***
  *** Libnettle 2.4 was not found. You must compile nettle with gmp support.

This error is because nettle failed to build hogweed:
checking for __gmpz_getlimbn in -lgmp... no
configure: WARNING: GNU MP not found, or not 3.1 or up, see http://gmplib.org/.
Support for public key algorithms will be unavailable.

and from config.log:
configure:7001: i686-w64-mingw32-gcc -o conftest.exe -Wall -g -O2 -DWINVER=0x0501 -D_WIN32_WINNT=0x0501  -L/home/kyle/software/cerbero/builds/win32/1.2.2/lib  conftest.c -lgmp   >&5
/tmp/cciqC89X.o: In function `main':
/home/kyle/cerbero/sources/windows_x86/nettle-2.7.1/conftest.c:39: undefined reference to `__gmpz_getlimbn'
collect2: error: ld returned 1 exit status
configure:7001: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "nettle"
| #define PACKAGE_TARNAME "nettle"
| #define PACKAGE_VERSION "2.7.1"
| #define PACKAGE_STRING "nettle 2.7.1"
| #define PACKAGE_BUGREPORT "nettle-bugs@lists.lysator.liu.se"
| #define PACKAGE_URL ""
| #define uid_t int
| #define gid_t int
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define TIME_WITH_SYS_TIME 1
| #define SIZEOF_LONG 4
| #define ALIGNOF_UINT64_T 8
| #define HAVE_ALLOCA 1
| #define HAVE_MALLOC_H 1
| #define HAVE_STRERROR 1
| #define HAVE_GCC_ATTRIBUTE 1
| /* end confdefs.h.  */
| 
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char __gmpz_getlimbn ();
| int
| main ()
| {
| return __gmpz_getlimbn ();
|   ;
|   return 0;
| }
configure:7010: result: no

This might be a GMP error, or a Nettle error.

I would be happy to provide any further information.
Comment 1 Kyle 2014-02-03 05:58:26 UTC
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
Comment 2 Kyle 2014-02-11 06:41:32 UTC
I was able to fix this issue by adding CXX="" to the self.configure_options in gmp.recipe.

Here is the patch I made:
diff --git a/recipes/gmp.recipe b/recipes/gmp.recipe
index 475ee6d..4d8395b 100644
--- a/recipes/gmp.recipe
+++ b/recipes/gmp.recipe
@@ -11,4 +11,4 @@ class Recipe(recipe.Recipe):
 
     def prepare(self):
         if self.config.target_platform == Platform.WINDOWS:
-            self.configure_options = ' --enable-shared --disable-static'
+            self.configure_options = ' CXX="" --enable-shared --disable-static'
Comment 3 Andoni Morales 2014-02-22 10:04:22 UTC
I think that was fixed in


Author: Andoni Morales Alastruey <ylatuya@gmail.com>
Date:   Tue Feb 11 18:05:29 2014 +0100

    libgmp: fix windows libary names

    gmp is using an old version of libtool generating .lib import
    libraries instead of dll.a and installing dll's in lib instead
    of bin. Autoreconf'ing gmp seems a bit complicated because of
    AM_C_PROTOTYPES, so let's fix it in post_install
Comment 4 Juha Lemmetti 2014-03-13 11:25:21 UTC
Hi,

I think I found the same or similar problem on Windows/mingw with 64-bit build, but it manifests while building hogweed shared dll. Here are some error lines for reference (and for google):

C:\MinGW\msys\1.0\home\jlemm\cerbero\sources\windows_x86\nettle-2.7.1/ecc-ecdsa-verify.c:101: undefined reference to `_imp____gmpn_copyi'
C:\MinGW\msys\1.0\home\jlemm\cerbero\sources\windows_x86\nettle-2.7.1/ecc-ecdsa-verify.c:141: undefined reference to `_imp____gmpn_sub_n'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [libhogweed-2-5.dll] Error 1
make[1]: Leaving directory `/home/jlemm/cerbero/sources/windows_x86/nettle-2.7.1

It seems that the lib/libgmp-10.dll has no _imp_ -prefixes in the names and nettle expects them:
$ nm lib/libgmp-10.dll | grep gmpn_sub_n
6acd7770 T ___gmpn_sub_n
6acd7817 T ___gmpn_sub_nc 

I can confirm that Kyle's solution works also in Windows: move libgmp-10.dll from lib to bin, and rename libgmp.lib -> gmp.lib

BUT: I could not find the commit that you were referring to: was I looking at the wrong place?

(In reply to comment #3)
> I think that was fixed in
> 
> 
> Author: Andoni Morales Alastruey <ylatuya@gmail.com>
> Date:   Tue Feb 11 18:05:29 2014 +0100
> 
>     libgmp: fix windows libary names
> 
>     gmp is using an old version of libtool generating .lib import
>     libraries instead of dll.a and installing dll's in lib instead
>     of bin. Autoreconf'ing gmp seems a bit complicated because of
>     AM_C_PROTOTYPES, so let's fix it in post_install
Comment 5 Andoni Morales 2014-03-13 11:29:29 UTC
This is the link to the commit:

http://cgit.freedesktop.org/gstreamer/cerbero/commit/?id=09b23bbdfb4f4f57923fed2cd908853469d40e79