bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Trouble with gethostname and mingw-w64 x86_64


From: T J
Subject: RE: Trouble with gethostname and mingw-w64 x86_64
Date: Mon, 18 May 2015 23:50:23 +0800

I have a follow-up to this.

What was happening is that in the check for `gethostname`, it tries to compile without linking against ws2_32. Note that unistd.h includes winsock2.h on my platform. Now, normally this check will fail (at linking), BUT since a check has been made before for linking to X11 (which links to ws2_32), ws2_32 is being implicitly linked:

> x86_64-w64-mingw32-gcc -std=gnu99 -std=gnu99 -o conftest.exe -DWIN32 -I/home/tanjj/ffbuild/target/mingw64//include -I/mingw64/include -I/usr/local/include -I/include -g -DWIN32 -I/home/tanjj/ffbuild/target/mingw64//include -I/mingw64/include -I/usr/local/include -I/include -g -I${top_builddir} -I${top_srcdir} -L/home/tanjj/ffbuild/target/mingw64//lib -L/mingw64/lib -L/usr/local/lib -L/lib -lws2_32 conftest.c -lX11 -lltdl -lws2_32 >&5

Which means that this check succeeds when it should not.

I have attached a patch to gethostname.m4 which reorders the check - if Winsock is found, try to compile by linking to it first. If that fails, then try the normal way. The patch works for me, but I know practically nothing about m4, so I have no idea if I'm doing the right thing or not.

Thanks,
Jeremy


From: address@hidden
To: address@hidden
Subject: Trouble with gethostname and mingw-w64 x86_64
Date: Wed, 12 Nov 2014 19:53:40 +0800

I've been having some difficulty building FontForge on Windows (8.1 64bit) using msys2 and mingw-w64 (64-bit target). Up until a few months ago, everything was building fine, but now I'm facing an issue which I believe has to do with Gnulib. I can't say that I understand much of how gnulib acutually works, so forgive me if this is a basic error.

I'll start off by saying that building with a 32-bit target works fine. FontForge has `gethostname` as a requirement, so the `gethostname` module is set from Gnulib. When building on 32-bit and when running the configure script, the detection for `gethostname` fails (not present) and so I believe gnulib does its own implementation and everything works.

However, when building for 64-bit, the `gethostname` detection succeeds (it is available http://msdn.microsoft.com/en-us/library/windows/desktop/ms738527%28v=vs.85%29.aspx but not on XP).

I believe this is where things go wrong. When building, Gnulib replaces instances of `gethostname` with `rpl_gethostname`, but `rpl_gethostname` is never compiled into the support library. For that matter, even though I can see `gethostname.c` under `lib/`, it is completely ignored when compiling. Thus when it comes to the linking stage, it falls over, with:

.libs/libgutils_la-gnetwork.o: In function `ff_gethostname':
C:\msys64\home\box\ffbuild\work\mingw64\fontforge\gutils/gnetwork.c:57: undefined reference to `rpl_gethostname'

I have attached two files - one is the build log for 32-bit (which succeeds in building) and another for 64-bit (which fails to build).

So, with that said does anyone know where to go from here? Any help in resolving this issue would be greatly appreciated.

Thanks,
Jeremy


Attachment: 0001-Reorder-the-check-for-gethostname-if-Winsock-is-pres.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]