Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

MSYS2 #1199

Closed
GentleFly opened this issue Mar 16, 2014 · 5 comments
Closed

MSYS2 #1199

GentleFly opened this issue Mar 16, 2014 · 5 comments

Comments

@GentleFly
Copy link

Win7, msys2

$ CC --version
CC (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ uname
MSYS_NT-6.1
$ echo $OS
Windows_NT

I'm trying to:

sh autogen.sh
./configure \
    --build=x86_64-pc-msys \
    --host=x86_64-pc-msys \
    --prefix= \
    --enable-shared \
    --enable-static \
    --disable-dtrace \
    CFLAGS="-D_POSIX_BARRIERS \
            -DPTHREAD_BARRIER_SERIAL_THREAD=-1 \
            "
make

and get:

make  all-am
make[1]: Entering directory '/home/GentleFly/build_soft/libuv/src/libuv-0.11.22'
  CC       src/libuv_la-fs-poll.lo
  CC       src/libuv_la-inet.lo
  CC       src/libuv_la-uv-common.lo
  CC       src/libuv_la-version.lo
  CC       src/unix/libuv_la-async.lo
  CC       src/unix/libuv_la-core.lo
  CC       src/unix/libuv_la-dl.lo
  CC       src/unix/libuv_la-fs.lo
  CC       src/unix/libuv_la-getaddrinfo.lo
  CC       src/unix/libuv_la-loop-watcher.lo
  CC       src/unix/libuv_la-loop.lo
  CC       src/unix/libuv_la-pipe.lo
  CC       src/unix/libuv_la-poll.lo
  CC       src/unix/libuv_la-process.lo
  CC       src/unix/libuv_la-signal.lo
  CC       src/unix/libuv_la-stream.lo
  CC       src/unix/libuv_la-tcp.lo
  CC       src/unix/libuv_la-thread.lo
  CC       src/unix/libuv_la-threadpool.lo
  CC       src/unix/libuv_la-timer.lo
  CC       src/unix/libuv_la-tty.lo
  CC       src/unix/libuv_la-udp.lo
  CCLD     libuv.la
src/unix/.libs/libuv_la-async.o:async.c:(.text+0x7d): undefined reference to `uv__hrtime'
src/unix/.libs/libuv_la-async.o:async.c:(.text+0x7d): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `uv__hrtime'
/usr/lib/gcc/x86_64-pc-msys/4.8.2/../../../../x86_64-pc-msys/bin/ld: src/unix/.libs/libuv_la-async.o: bad reloc address 0x0 in section `.pdata'
collect2: error: ld returned 1 exit status
Makefile:985: recipe for target 'libuv.la' failed
make[1]: *** [libuv.la] Error 1
make[1]: Leaving directory '/home/GentleFly/build_soft/libuv/src/libuv-0.11.22'
Makefile:770: recipe for target 'all' failed
make: *** [all] Error 2

If:

sh autogen.sh
./configure \
    --build=x86_64-pc-msys \
    --host=x86_64-pc-msys \
    --prefix= \
    --enable-shared \
    --enable-static \
    --disable-dtrace \
    CFLAGS="-D_POSIX_BARRIERS \
            -DPTHREAD_BARRIER_SERIAL_THREAD=-1 \
            "
make CFLAGS+=-fPIC

then:


make  all-am
make[1]: Entering directory '/home/GentleFly/build_soft/libuv/src/libuv-0.11.22'
  CC       src/libuv_la-fs-poll.lo
  CC       src/libuv_la-inet.lo
  CC       src/libuv_la-uv-common.lo
src/fs-poll.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
src/inet.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /*
 ^
src/uv-common.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
  CC       src/libuv_la-version.lo
  CC       src/unix/libuv_la-async.lo
  CC       src/unix/libuv_la-core.lo
src/version.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
src/unix/async.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
src/unix/core.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
  CC       src/unix/libuv_la-dl.lo
  CC       src/unix/libuv_la-fs.lo
src/unix/dl.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
src/unix/fs.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
  CC       src/unix/libuv_la-getaddrinfo.lo
  CC       src/unix/libuv_la-loop-watcher.lo
src/unix/getaddrinfo.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
src/unix/loop-watcher.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
  CC       src/unix/libuv_la-loop.lo
  CC       src/unix/libuv_la-pipe.lo
  CC       src/unix/libuv_la-poll.lo
src/unix/loop.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
src/unix/pipe.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
src/unix/poll.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
  CC       src/unix/libuv_la-process.lo
  CC       src/unix/libuv_la-signal.lo
  CC       src/unix/libuv_la-stream.lo
src/unix/process.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
src/unix/signal.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
src/unix/stream.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
  CC       src/unix/libuv_la-tcp.lo
  CC       src/unix/libuv_la-thread.lo
src/unix/tcp.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
  CC       src/unix/libuv_la-threadpool.lo
src/unix/thread.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
  CC       src/unix/libuv_la-timer.lo
src/unix/threadpool.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
  CC       src/unix/libuv_la-tty.lo
src/unix/timer.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
  CC       src/unix/libuv_la-udp.lo
src/unix/tty.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
src/unix/udp.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 ^
  CCLD     libuv.la
src/unix/.libs/libuv_la-core.o:core.c:(.text+0xf1): undefined reference to `uv__fs_event_close'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0xf1): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `uv__fs_event_close'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0x2d6): undefined reference to `uv__hrtime'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0x2d6): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `uv__hrtime'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0x354): undefined reference to `uv__io_poll'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0x354): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `uv__io_poll'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0x516): undefined reference to `uv__hrtime'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0x516): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `uv__hrtime'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0x558): undefined reference to `uv__hrtime'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0x558): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `uv__hrtime'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0x5fe): undefined reference to `uv__hrtime'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0x5fe): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `uv__hrtime'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0x3): undefined reference to `uv__hrtime'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0x3): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `uv__hrtime'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0xf1b): undefined reference to `uv__platform_invalidate_fd'
src/unix/.libs/libuv_la-core.o:core.c:(.text+0xf1b): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `uv__platform_invalidate_fd'
/usr/lib/gcc/x86_64-pc-msys/4.8.2/../../../../x86_64-pc-msys/bin/ld: src/unix/.libs/libuv_la-core.o: bad reloc address 0x0 in section `.pdata'
collect2: error: ld returned 1 exit status
Makefile:985: recipe for target 'libuv.la' failed
make[1]: *** [libuv.la] Error 1
make[1]: Leaving directory '/home/GentleFly/build_soft/libuv/src/libuv-0.11.22'
Makefile:770: recipe for target 'all' failed
make: *** [all] Error 2

If:

 sh autogen.sh
    ./configure \
        --build=x86_64-pc-msys \
        --host=x86_64-pc-msys \
        --prefix= \
        --disable-shared \
        --enable-static \
        --disable-dtrace \
        CFLAGS="-D_POSIX_BARRIERS \
                -DPTHREAD_BARRIER_SERIAL_THREAD=-1 \
                "
    make CFLAGS+=-fPIC

then:

...
...
  CC       test/test-udp-send-and-recv.o
  CC       test/test-walk-handles.o
  CC       test/test-watcher-cross-stop.o
  CC       test/runner-unix.o
  CCLD     test/run-tests.exe
test/run-tests.o:run-tests.c:(.text+0x97): undefined reference to `uv_setup_args'
test/run-tests.o:run-tests.c:(.text+0x97): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `uv_setup_args'
/usr/lib/gcc/x86_64-pc-msys/4.8.2/../../../../x86_64-pc-msys/bin/ld: test/run-tests.o: bad reloc address 0x0 in section `.data'
collect2: error: ld returned 1 exit status
Makefile:1207: recipe for target 'test/run-tests.exe' failed
make[2]: *** [test/run-tests.exe] Error 1
make[2]: Leaving directory '/home/GentleFly/build_soft/libuv/src/libuv-0.11.22'
Makefile:2201: recipe for target 'check-am' failed
make[1]: *** [check-am] Error 2
make[1]: Leaving directory '/home/GentleFly/build_soft/libuv/src/libuv-0.11.22'
Makefile:2204: recipe for target 'check' failed
make: *** [check] Error 2

Sorry for my English.

@saghul
Copy link
Contributor

saghul commented Mar 18, 2014

Hi,

I wasn't aware that there was a MSYS2 thing. Sigh, Windows is hard. I am able to successfully compile libuv using just sh autogen.sh && ./configure && make on a MinGW environment. Unfortunately I don't have a MSYS2 environment where I could try to reproduce this.

@GentleFly
Copy link
Author

I took it here: http://sourceforge.net/projects/msys2/
Maybe: http://msys2.github.io/

Sorry for my English.

@vtjnash
Copy link
Contributor

vtjnash commented May 10, 2014

The Julia fork of libuv has been building in the msys2 environment since before it's release, so it is definitely possible. The issue you are likely encountering is that msys2 can be launched either as msys2 or mingw32. As msys2, it declares its name as msys2 (aka --build=x86_64-pc-msys), which most versions of configure incorrectly interpret as unix. As mingw32, it declares its name as mingw32 (aka --build=x86_64-w64-mingw32, which is the same behavior as msys1 had.

@tkelman
Copy link
Contributor

tkelman commented May 10, 2014

You'll notice there are multiple bat files you can use to start up an MSYS2 shell: msys2_shell.bat results in

$ uname
MSYS_NT-6.1

whereas mingw32_shell.bat results in

$ uname
MINGW32_NT-6.1

The latter is more likely to be properly recognized by config.guess than the former, so for now you should use mingw32_shell.bat for building things like libuv with autotools. Or you can provide --build=x86_64-w64-mingw32 every time you call configure.

Wherever libuv's configure makes the decision to go down the Unix path or the Windows path could also be modified to choose Windows for x86_64-pc-msys, I suspect that would work.

@saghul
Copy link
Contributor

saghul commented Jun 23, 2014

Just tested this myself. What @vtjnash and @tkelman have said: it works just fine if you use the right launcher. Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants