Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

windows: cross-compiling tests with mingw32 fails #381

Closed
bnoordhuis opened this Issue · 8 comments

3 participants

@bnoordhuis

Not sure if it matters but I'll post it anyway.

$ make test MSVC=1 AR=i586-mingw32msvc-ar CC=i586-mingw32msvc-cc
i586-mingw32msvc-cc -Iinclude -Iinclude/uv-private -Iinclude -Iinclude/uv-private -g --std=gnu89 -D_WIN32_WINNT=0x0600 -Isrc/ares/config_win32 -D_GNU_SOURCE  -o test/run-tests test/run-tests.c \
                test/runner.c test/runner-win.c test/blackhole-server.c test/echo-server.c test/test-*.c uv.a -lws2_32 -lpsapi -liphlpapi -lm
uv.a(fs.o): In function `fs__ftruncate':
/home/bnoordhuis/src/libuv-win/src/win/fs.c:580: undefined reference to `__chsize_s'
uv.a(getaddrinfo.o): In function `getaddrinfo_thread_proc':
/home/bnoordhuis/src/libuv-win/src/win/getaddrinfo.c:88: undefined reference to `__imp__GetAddrInfoW@16'
uv.a(getaddrinfo.o): In function `uv_process_getaddrinfo_req':
/home/bnoordhuis/src/libuv-win/src/win/getaddrinfo.c:215: undefined reference to `__imp__FreeAddrInfoW@4'
collect2: ld returned 1 exit status
make: *** [test/run-tests.exe] Error 1

Compiling master with MSVC works but I have 16 failing tests (almost all fs related but counters_init and pipe_connect_to_file are in there too).

@piscisaureus piscisaureus was assigned
@luislavena

@bnoordhuis that was master?

The undefined references I believe was merged from pull #333 in c344277 for GetAdaptersAddresses and GetProcessMemoryInfo

@luislavena

Hello @bnoordhuis and @piscisaureus I think this can be closed as the issue mentioned in #382 has been addressed.

@bnoordhuis

The issue with _chsize_s has been fixed but I'm still seeing the same link-time errors with mingw32 on ubuntu 10.04. It's not a terribly high-priority issue but I would like to get it fixed eventually, if only so I don't have to come out of my comfort zone (the UNIX shell).

@luislavena
@bnoordhuis

It's gcc 4.4.2.

$ i586-mingw32msvc-gcc -v
Using built-in specs.
Target: i586-mingw32msvc
Configured with: /build/buildd/gcc-mingw32-4.4.2/build-tree/gcc-4.4.2/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --libexecdir='/usr/lib/' --disable-multilib --enable-threads --enable-sjlj-exceptions --enable-version-specific-runtime-libs --disable-shared --target=i586-mingw32msvc --enable-languages=c,c++,fortran : (reconfigured) /build/buildd/gcc-mingw32-4.4.2/build-tree/gcc-4.4.2/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --libexecdir='/usr/lib/' --disable-multilib --enable-threads --enable-sjlj-exceptions --enable-version-specific-runtime-libs --disable-shared --target=i586-mingw32msvc --enable-languages=c,c++,fortran
Thread model: win32
gcc version 4.4.2 (GCC) 
@luislavena

Hmm, getting a different result:

ubuntu@ubuntu:~/projects/oss/joyent/libuv$ make MSVC=1 PREFIX=i586-mingw32msvc-
i586-mingw32msvc-gcc -Iinclude -Iinclude/uv-private -g --std=gnu89 -D_WIN32_WINNT=0x0600 -Isrc/ares/config_win32 -o src/win/async.o -c src/win/async.c
In file included from src/win/internal.h:29,
                 from src/win/async.c:25:
src/win/winapi.h:32: error: redefinition of typedef ‘NTSTATUS’
include/uv-private/uv-win.h:132: error: previous declaration of ‘NTSTATUS’ was here
src/win/winapi.h:33: error: redefinition of typedef ‘PNTSTATUS’
include/uv-private/uv-win.h:133: error: previous declaration of ‘PNTSTATUS’ was here
make: *** [src/win/async.o] Error 1
ubuntu@ubuntu:~/projects/oss/joyent/libuv$ i586-mingw32msvc-gcc -v
Using built-in specs.
Target: i586-mingw32msvc
Configured with: /build/buildd/mingw32-4.2.1.dfsg/build_dir/src/gcc-4.2.1-2-dfsg/configure -v --prefix=/usr --target=i586-mingw32msvc --enable-languages=c,c++ --enable-threads --enable-sjlj-exceptions --disable-multilib --enable-version-specific-runtime-libs
Thread model: win32
gcc version 4.2.1-sjlj (mingw32-2)

Maybe because I'm using a 64bits host? but the error seems to be different.

Anyhow, after removing the NTSTATUS definition from winapi.h got this when tried to compile the tests:

uv.a(getaddrinfo.o): In function `getaddrinfo_thread_proc':
/home/ubuntu/projects/oss/joyent/libuv/src/win/getaddrinfo.c:88: undefined reference to `__imp__GetAddrInfoW@16'
uv.a(getaddrinfo.o): In function `uv_process_getaddrinfo_req':
/home/ubuntu/projects/oss/joyent/libuv/src/win/getaddrinfo.c:215: undefined reference to `__imp__FreeAddrInfoW@4'

FreeAddrInfoW is supposed to be in ws2_32:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms737912(v=vs.85).aspx

But in the export library is missing:

ubuntu@ubuntu:~/projects/oss/joyent/libuv$ i586-mingw32msvc-nm /usr/i586-mingw32msvc/lib/libws2_32.a | grep FreeAddrInfo

Such function is defined in both MinGW and mingw-w64 def files.

Seems to me a bug on the Ubuntu recipes.

@bnoordhuis

Seems to me a bug on the Ubuntu recipes.

I agree. They're not in any of the libs in /usr/i586-mingw32msvc/lib. I'll close the issue, thanks for trying.

@bnoordhuis bnoordhuis closed this
@luislavena

@bnoordhuis mingw-w64 project provides builds for both 32 and 64bits cross-compilers.

I'll collect the latest release, build some instructions and send it over, so perhaps others can use it to cross-compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.