Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: compile failure with mingw-w64 #1833

Open
fanquake opened this issue Nov 3, 2023 · 3 comments
Open

build: compile failure with mingw-w64 #1833

fanquake opened this issue Nov 3, 2023 · 3 comments

Comments

@fanquake
Copy link

fanquake commented Nov 3, 2023

Following the instructions on https://capnproto.org/install.html, using the master branch (f553171) and compiling for mingw-w64 on Ubuntu 22.04:

git clone https://github.com/capnproto/capnproto.git
cd capnproto/c++
git checkout master
autoreconf -i
./configure --host=x86_64-w64-mingw32
make -j6 check
...
libtool: compile:  x86_64-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -mthreads -O2 -DNDEBUG -mthreads -DKJ_USE_FIBERS -MT src/kj/filesystem-disk-win32.lo -MD -MP -MF src/kj/.deps/filesystem-disk-win32.Tpo -c src/kj/filesystem-disk-win32.c++ -o src/kj/filesystem-disk-win32.o >/dev/null 2>&1
libtool: compile:  x86_64-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -mthreads -O2 -DNDEBUG -mthreads -DKJ_USE_FIBERS -MT src/capnp/compat/json.lo -MD -MP -MF src/capnp/compat/.deps/json.Tpo -c src/capnp/compat/json.c++ -o src/capnp/compat/json.o >/dev/null 2>&1
/bin/bash ./libtool  --tag=CXX   --mode=link x86_64-w64-mingw32-g++ -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR='"/usr/local/include"' -mthreads -O2 -DNDEBUG -mthreads -DKJ_USE_FIBERS -release 1.1-dev -no-undefined  -o libkj.la -rpath /usr/local/lib src/kj/cidr.lo src/kj/common.lo src/kj/units.lo src/kj/memory.lo src/kj/refcount.lo src/kj/array.lo src/kj/list.lo src/kj/string.lo src/kj/string-tree.lo src/kj/source-location.lo src/kj/hash.lo src/kj/table.lo src/kj/encoding.lo src/kj/exception.lo src/kj/debug.lo src/kj/arena.lo src/kj/io.lo src/kj/mutex.lo src/kj/thread.lo src/kj/time.lo src/kj/filesystem.lo src/kj/filesystem-disk-unix.lo src/kj/filesystem-disk-win32.lo src/kj/test-helpers.lo src/kj/main.lo src/kj/parse/char.lo  
libtool: link: x86_64-w64-mingw32-g++ -shared -nostdlib /usr/lib/gcc/x86_64-w64-mingw32/10-win32/../../../../x86_64-w64-mingw32/lib/dllcrt2.o /usr/lib/gcc/x86_64-w64-mingw32/10-win32/crtbegin.o  src/kj/.libs/cidr.o src/kj/.libs/common.o src/kj/.libs/units.o src/kj/.libs/memory.o src/kj/.libs/refcount.o src/kj/.libs/array.o src/kj/.libs/list.o src/kj/.libs/string.o src/kj/.libs/string-tree.o src/kj/.libs/source-location.o src/kj/.libs/hash.o src/kj/.libs/table.o src/kj/.libs/encoding.o src/kj/.libs/exception.o src/kj/.libs/debug.o src/kj/.libs/arena.o src/kj/.libs/io.o src/kj/.libs/mutex.o src/kj/.libs/thread.o src/kj/.libs/time.o src/kj/.libs/filesystem.o src/kj/.libs/filesystem-disk-unix.o src/kj/.libs/filesystem-disk-win32.o src/kj/.libs/test-helpers.o src/kj/.libs/main.o src/kj/parse/.libs/char.o   -L/usr/lib/gcc/x86_64-w64-mingw32/10-win32 -L/usr/lib/gcc/x86_64-w64-mingw32/10-win32/../../../../x86_64-w64-mingw32/lib -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt /usr/lib/gcc/x86_64-w64-mingw32/10-win32/crtend.o  -mthreads -O2 -mthreads   -mthreads -o .libs/libkj-1-1-dev.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libkj.dll.a
/usr/bin/x86_64-w64-mingw32-ld: src/kj/.libs/cidr.o:cidr.c++:(.text+0x1e5): undefined reference to `__imp_inet_ntop'
/usr/bin/x86_64-w64-mingw32-ld: src/kj/.libs/cidr.o:cidr.c++:(.text+0x447): undefined reference to `__imp_inet_pton'
collect2: error: ld returned 1 exit status
make: *** [Makefile:1940: libkj.la] Error 1
@kentonv
Copy link
Member

kentonv commented Nov 3, 2023

Thank for the report. Unfortunately I don't have enough bandwidth to debug MinGW build issues but I'll be happy to accept a PR that fixes this if you can figure out the problem. FWIW we build with MinGW in CI, both directly on Windows and cross-compiling, and this issue did not come up there. It looks like CI is configured to test MinGW cross-compiling on Ubuntu 20.04.

@ryanofsky
Copy link
Contributor

FWIW, I asked chatgpt about the error and it said the linker command line needs -lws2_32 (https://chat.openai.com/share/d80fe16c-2ab5-42e6-826e-84653b4f44db)

fanquake added a commit to bitcoin-core/gui that referenced this issue Nov 5, 2023
3333f14 depends: Bump to capnproto-c++-1.0.1 (MarcoFalke)

Pull request description:

  Reasons:
  * Debian is starting to ship this version in Trixie (https://packages.debian.org/trixie/capnproto), which will likely become the version shipped with Ubuntu 24.04 LTS. So testing with this version will help to find any issues before real users start to use those distro packages.
  * The feature is currently experimental, so bumping the version shouldn't cause any production issues.
  * With multiprocess begin a priority project for 27.0, it seems better to do build system changes/bumps early, rather than later, to allow for more time testing them.

ACKs for top commit:
  TheCharlatan:
    Re-ACK 3333f14
  fanquake:
    ACK 3333f14 - the response from upstream is that [if we submit a PR, they can take a look](capnproto/capnproto#1833 (comment)), so if anyone would like this to work for Windows, I'd suggest sending a patch.
  ryanofsky:
    Code review ACK 3333f14

Tree-SHA512: 7d53ad1536f042ab43dbc7847126b826e7fc76694f173c348b835fd1067b8f3dd682c5bcb4887f09ee85bab69130721cd7f8fb96b2e82053d4e28bd5c38bdc5f
@kentonv
Copy link
Member

kentonv commented Nov 6, 2023

Ah hah, the -lws2_32 link is present in configure.ac but only applied to libkj-async, not libkj, and it appears that the cidr library landed in libkj. It probably should have been in libkj-async instead, or maybe we need to link ws2_32 either way:

ASYNC_LIBS="-lws2_32"

Probably wasn't caught in tests because I think our tests only build static libraries -- I honestly never could get DLLs working with MinGW...

chriku added a commit to chriku/xmake-repo that referenced this issue Jul 29, 2024
chriku added a commit to chriku/xmake-repo that referenced this issue Jul 29, 2024
chriku added a commit to chriku/xmake-repo that referenced this issue Jul 29, 2024
chriku added a commit to chriku/xmake-repo that referenced this issue Jul 29, 2024
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this issue Sep 27, 2024
BACKPORT NOTICE: excludes ci/test/00_setup_env_i686_multiprocess.sh changes, however, these do not satisfy enough this to be partial to me

3333f14 depends: Bump to capnproto-c++-1.0.1 (MarcoFalke)

Pull request description:

  Reasons:
  * Debian is starting to ship this version in Trixie (https://packages.debian.org/trixie/capnproto), which will likely become the version shipped with Ubuntu 24.04 LTS. So testing with this version will help to find any issues before real users start to use those distro packages.
  * The feature is currently experimental, so bumping the version shouldn't cause any production issues.
  * With multiprocess begin a priority project for 27.0, it seems better to do build system changes/bumps early, rather than later, to allow for more time testing them.

ACKs for top commit:
  TheCharlatan:
    Re-ACK 3333f14
  fanquake:
    ACK 3333f14 - the response from upstream is that [if we submit a PR, they can take a look](capnproto/capnproto#1833 (comment)), so if anyone would like this to work for Windows, I'd suggest sending a patch.
  ryanofsky:
    Code review ACK 3333f14

Tree-SHA512: 7d53ad1536f042ab43dbc7847126b826e7fc76694f173c348b835fd1067b8f3dd682c5bcb4887f09ee85bab69130721cd7f8fb96b2e82053d4e28bd5c38bdc5f
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this issue Sep 27, 2024
BACKPORT NOTICE: excludes ci/test/00_setup_env_i686_multiprocess.sh changes, however, these do not satisfy enough this to be partial to me

3333f14 depends: Bump to capnproto-c++-1.0.1 (MarcoFalke)

Pull request description:

  Reasons:
  * Debian is starting to ship this version in Trixie (https://packages.debian.org/trixie/capnproto), which will likely become the version shipped with Ubuntu 24.04 LTS. So testing with this version will help to find any issues before real users start to use those distro packages.
  * The feature is currently experimental, so bumping the version shouldn't cause any production issues.
  * With multiprocess begin a priority project for 27.0, it seems better to do build system changes/bumps early, rather than later, to allow for more time testing them.

ACKs for top commit:
  TheCharlatan:
    Re-ACK 3333f14
  fanquake:
    ACK 3333f14 - the response from upstream is that [if we submit a PR, they can take a look](capnproto/capnproto#1833 (comment)), so if anyone would like this to work for Windows, I'd suggest sending a patch.
  ryanofsky:
    Code review ACK 3333f14

Tree-SHA512: 7d53ad1536f042ab43dbc7847126b826e7fc76694f173c348b835fd1067b8f3dd682c5bcb4887f09ee85bab69130721cd7f8fb96b2e82053d4e28bd5c38bdc5f
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this issue Sep 27, 2024
BACKPORT NOTICE: excludes ci/test/00_setup_env_i686_multiprocess.sh changes, however, these do not satisfy enough this to be partial to me

3333f14 depends: Bump to capnproto-c++-1.0.1 (MarcoFalke)

Pull request description:

  Reasons:
  * Debian is starting to ship this version in Trixie (https://packages.debian.org/trixie/capnproto), which will likely become the version shipped with Ubuntu 24.04 LTS. So testing with this version will help to find any issues before real users start to use those distro packages.
  * The feature is currently experimental, so bumping the version shouldn't cause any production issues.
  * With multiprocess begin a priority project for 27.0, it seems better to do build system changes/bumps early, rather than later, to allow for more time testing them.

ACKs for top commit:
  TheCharlatan:
    Re-ACK 3333f14
  fanquake:
    ACK 3333f14 - the response from upstream is that [if we submit a PR, they can take a look](capnproto/capnproto#1833 (comment)), so if anyone would like this to work for Windows, I'd suggest sending a patch.
  ryanofsky:
    Code review ACK 3333f14

Tree-SHA512: 7d53ad1536f042ab43dbc7847126b826e7fc76694f173c348b835fd1067b8f3dd682c5bcb4887f09ee85bab69130721cd7f8fb96b2e82053d4e28bd5c38bdc5f
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this issue Sep 28, 2024
BACKPORT NOTICE: excludes ci/test/00_setup_env_i686_multiprocess.sh changes, however, these do not satisfy enough this to be partial to me

3333f14 depends: Bump to capnproto-c++-1.0.1 (MarcoFalke)

Pull request description:

  Reasons:
  * Debian is starting to ship this version in Trixie (https://packages.debian.org/trixie/capnproto), which will likely become the version shipped with Ubuntu 24.04 LTS. So testing with this version will help to find any issues before real users start to use those distro packages.
  * The feature is currently experimental, so bumping the version shouldn't cause any production issues.
  * With multiprocess begin a priority project for 27.0, it seems better to do build system changes/bumps early, rather than later, to allow for more time testing them.

ACKs for top commit:
  TheCharlatan:
    Re-ACK 3333f14
  fanquake:
    ACK 3333f14 - the response from upstream is that [if we submit a PR, they can take a look](capnproto/capnproto#1833 (comment)), so if anyone would like this to work for Windows, I'd suggest sending a patch.
  ryanofsky:
    Code review ACK 3333f14

Tree-SHA512: 7d53ad1536f042ab43dbc7847126b826e7fc76694f173c348b835fd1067b8f3dd682c5bcb4887f09ee85bab69130721cd7f8fb96b2e82053d4e28bd5c38bdc5f
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this issue Oct 1, 2024
BACKPORT NOTICE: excludes ci/test/00_setup_env_i686_multiprocess.sh changes, however, these do not satisfy enough this to be partial to me

3333f14 depends: Bump to capnproto-c++-1.0.1 (MarcoFalke)

Pull request description:

  Reasons:
  * Debian is starting to ship this version in Trixie (https://packages.debian.org/trixie/capnproto), which will likely become the version shipped with Ubuntu 24.04 LTS. So testing with this version will help to find any issues before real users start to use those distro packages.
  * The feature is currently experimental, so bumping the version shouldn't cause any production issues.
  * With multiprocess begin a priority project for 27.0, it seems better to do build system changes/bumps early, rather than later, to allow for more time testing them.

ACKs for top commit:
  TheCharlatan:
    Re-ACK 3333f14
  fanquake:
    ACK 3333f14 - the response from upstream is that [if we submit a PR, they can take a look](capnproto/capnproto#1833 (comment)), so if anyone would like this to work for Windows, I'd suggest sending a patch.
  ryanofsky:
    Code review ACK 3333f14

Tree-SHA512: 7d53ad1536f042ab43dbc7847126b826e7fc76694f173c348b835fd1067b8f3dd682c5bcb4887f09ee85bab69130721cd7f8fb96b2e82053d4e28bd5c38bdc5f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants