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

MinGW: Failed to build static lib undefined reference to '__imp_pcre2_regcomp' #243

Closed
rockdaboot opened this issue May 1, 2023 · 4 comments · Fixed by #249
Closed

MinGW: Failed to build static lib undefined reference to '__imp_pcre2_regcomp' #243

rockdaboot opened this issue May 1, 2023 · 4 comments · Fixed by #249

Comments

@rockdaboot
Copy link

The issue

pcre2 is a dependency of GNU Wget2.
We have two MinGW CI images to build deps like pcre2, one for dynamic linking and one for static linking.
The static build of pcre2 fails since ~6 months.

The build command sequence is

git clone https://github.com/PCRE2Project/pcre2
cd pcre2
export CFLAGS="-O2 -g"
./autogen.sh
./configure --host=x86_64-w64-mingw32 --prefix=/usr/local/x86_64-w64-mingw32 --disable-shared --enable-static
make

(Please see the Dockerfile below for the ENV variables set)

Error message

...
#25 37.55   CCLD     pcre2posix_test.exe
#25 37.67 /usr/bin/x86_64-w64-mingw32-ld: src/pcre2posix_test-pcre2posix_test.o: in function `main':
#25 37.68 /usr/local/pcre2/src/pcre2posix_test.c:134: undefined reference to `__imp_pcre2_regcomp'

Dockerfile

The failed build is part of a list of dependency builds.

FROM debian:bookworm-slim

LABEL maintainer "Tim Rühsen tim.ruehsen@gmx.de"

WORKDIR /usr/local

RUN apt-get update -y && apt-get install --no-install-recommends -y
git
autoconf
autoconf-archive
autopoint
automake
autogen
libtool
make
wine
flex
bison
gettext
gperf
mingw-w64
pkg-config-mingw-w64-x86-64
ca-certificates
wget
patch
texinfo
gengetopt
curl
lzip
pandoc
rsync
ccache
python3
binfmt-support
bc

ENV PREFIX="x86_64-w64-mingw32"
ENV INSTALLDIR="/usr/local/$PREFIX"
ENV PKG_CONFIG_PATH="$INSTALLDIR/lib/pkgconfig:/usr/$PREFIX/lib/pkgconfig"
PKG_CONFIG_LIBDIR="$INSTALLDIR/lib/pkgconfig"
PKG_CONFIG="/usr/bin/${PREFIX}-pkg-config"
CPPFLAGS="-I$INSTALLDIR/include"
LDFLAGS="-L$INSTALLDIR/lib"
CFLAGS="-O2 -g"
WINEPATH="$INSTALLDIR/bin;$INSTALLDIR/lib;/usr/$PREFIX/bin;/usr/$PREFIX/lib"

RUN git clone --recursive https://gitlab.com/gnuwget/gnulib-mirror.git gnulib
ENV GNULIB_SRCDIR /usr/local/gnulib
ENV GNULIB_TOOL /usr/local/gnulib/gnulib-tool

RUN wget -q -O- https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz | tar xz
RUN cd libiconv-* &&
./configure --build=x86_64-pc-linux-gnu --host=$PREFIX --disable-shared --enable-static --prefix=$INSTALLDIR &&
make -j$(nproc) && make install && cd .. && rm -rf libiconv-*

RUN wget -q -O- https://ftp.gnu.org/gnu/libunistring/libunistring-latest.tar.gz | tar xz
RUN cd libunistring-* &&
./configure --build=x86_64-pc-linux-gnu --host=$PREFIX --disable-shared --enable-static --prefix=$INSTALLDIR &&
make -j$(nproc) && make install && cd .. && rm -rf libunistring-*

RUN wget -q -O- https://ftp.gnu.org/gnu/libidn/libidn2-2.3.3.tar.gz | tar xz
RUN cd libidn2-* &&
./configure --build=x86_64-pc-linux-gnu --host=$PREFIX --disable-shared --enable-static --disable-doc
--disable-gcc-warnings --prefix=$INSTALLDIR &&
make -j$(nproc) && make install && cd .. && rm -rf libidn2-*

RUN git clone --recursive https://github.com/rockdaboot/libpsl.git
RUN cd libpsl &&
./autogen.sh &&
./configure --build=x86_64-pc-linux-gnu --host=$PREFIX --disable-shared --enable-static
--enable-runtime=libidn2 --enable-builtin --prefix=$INSTALLDIR &&
make -j$(nproc) && make install && cd .. && rm -rf libpsl

RUN git clone https://git.lysator.liu.se/nettle/nettle.git
RUN cd nettle &&
bash .bootstrap &&
./configure --build=x86_64-pc-linux-gnu --host=$PREFIX --enable-mini-gmp --disable-shared --enable-static
--disable-documentation --prefix=$INSTALLDIR &&
make -j$(nproc) && make install && cd .. && rm -rf nettle

RUN wget -q -O- https://www.gnupg.org/ftp/gcrypt/gnutls/v3.7/gnutls-3.7.4.tar.xz | tar x --xz
RUN cd gnutls-* &&
./configure --build=x86_64-pc-linux-gnu --host=$PREFIX --prefix=$INSTALLDIR
--with-nettle-mini --disable-shared --enable-static --with-included-libtasn1
--with-included-unistring --without-p11-kit --disable-doc --disable-tests --disable-full-test-suite
--disable-tools --disable-cxx --disable-maintainer-mode --disable-libdane --disable-hardware-acceleration
--disable-guile &&
make -j$(nproc) && make install && cd .. && rm -rf gnutls-*

RUN git clone https://github.com/zlib-ng/zlib-ng
RUN cd zlib-ng &&
CROSS_PREFIX="x86_64-w64-mingw32-" ARCH="x86_64" CFLAGS="-O2" CC=x86_64-w64-mingw32-gcc
./configure --prefix=$INSTALLDIR --static --64 --zlib-compat &&
make -j$(nproc) && make install && cd .. && rm -rf zlib-ng

RUN git clone https://github.com/google/brotli
RUN cd brotli &&
./bootstrap &&
./configure --host=$PREFIX --prefix=$INSTALLDIR --disable-shared --enable-static &&
make -j$(nproc) && make install && cd .. && rm -rf brotli

RUN git clone https://github.com/PCRE2Project/pcre2
RUN cd pcre2 &&
./autogen.sh &&
./configure --host=$PREFIX --prefix=$INSTALLDIR --disable-shared --enable-static &&
make -j$(nproc) && make install && cd .. && rm -rf pcre2

RUN wget -q -O- https://github.com/nghttp2/nghttp2/releases/download/v1.46.0/nghttp2-1.46.0.tar.gz | tar xz
RUN cd nghttp2-* &&
./configure --build=x86_64-pc-linux-gnu --host=$PREFIX --prefix=$INSTALLDIR --disable-shared --enable-static
--disable-python-bindings --disable-examples --disable-app --disable-failmalloc --disable-hpack-tools &&
make -j$(nproc) && make install && cd .. && rm -rf nghttp2-*

RUN git clone --depth=1 https://github.com/dlfcn-win32/dlfcn-win32.git
RUN cd dlfcn-win32 &&
./configure --prefix=$PREFIX --cc=$PREFIX-gcc &&
make -j$(nproc) &&
cp -p libdl.a $INSTALLDIR/lib/ &&
cp -p src/dlfcn.h $INSTALLDIR/include/ &&
cd .. && rm -rf dlfcn-win32

RUN wget -q -O- https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-latest.tar.gz | tar xz
RUN cd libmicrohttpd-* &&
./configure --build=x86_64-pc-linux-gnu
--host=$PREFIX
--prefix=$INSTALLDIR
--disable-doc
--disable-examples
--disable-shared --enable-static &&
make -j$(nproc) && make install && cd .. && rm -rf libmicrohttpd-*

Full logs

``` #24 [21/28] RUN git clone https://github.com/PCRE2Project/pcre2 #24 0.251 Cloning into 'pcre2'... #24 DONE 5.9s #25 [22/28] RUN cd pcre2 && ./autogen.sh && ./configure --host=x86_64-w64-mingw32 --prefix=/usr/local/x86_64-w64-mingw32 --disable-shared --enable-static && make -j$(nproc) && make install && cd .. && rm -rf pcre2 #25 0.242 Looking for a version of libtoolize (which can have different names)... #25 0.243 Did not find glibtoolize #25 0.243 Did not find libtoolize15 #25 0.244 Did not find libtoolize14 #25 0.254 Found libtoolize #25 0.255 + libtoolize -c -f #25 0.334 libtoolize: putting auxiliary files in '.'. #25 0.335 libtoolize: copying file './ltmain.sh' #25 0.367 libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'. #25 0.367 libtoolize: copying file 'm4/libtool.m4' #25 0.374 libtoolize: copying file 'm4/ltoptions.m4' #25 0.380 libtoolize: copying file 'm4/ltsugar.m4' #25 0.386 libtoolize: copying file 'm4/ltversion.m4' #25 0.393 libtoolize: copying file 'm4/lt~obsolete.m4' #25 0.405 + rm -rf autom4te.cache Makefile.in aclocal.m4 #25 0.408 + aclocal --force -I m4 #25 4.335 + autoconf -f -W all,no-obsolete #25 4.903 + autoheader -f -W all #25 5.389 + automake -a -c -f -W all,no-portability #25 5.740 configure.ac:61: installing './ar-lib' #25 5.744 configure.ac:45: installing './compile' #25 5.747 configure.ac:67: installing './config.guess' #25 5.749 configure.ac:67: installing './config.sub' #25 5.751 configure.ac:28: installing './install-sh' #25 5.754 configure.ac:28: installing './missing' #25 5.779 Makefile.am: installing './INSTALL' #25 5.826 Makefile.am: installing './depcomp' #25 5.982 parallel-tests: installing './test-driver' #25 6.036 + rm -rf autom4te.cache #25 6.040 + exit 0 #25 6.138 checking for a BSD-compatible install... /usr/bin/install -c #25 6.149 checking whether build environment is sane... yes #25 6.161 checking for x86_64-w64-mingw32-strip... x86_64-w64-mingw32-strip #25 6.163 checking for a race-free mkdir -p... /usr/bin/mkdir -p #25 6.166 checking for gawk... no #25 6.167 checking for mawk... mawk #25 6.168 checking whether make sets $(MAKE)... yes #25 6.180 checking whether make supports nested variables... yes #25 6.189 checking whether make supports nested variables... (cached) yes #25 6.190 checking for x86_64-w64-mingw32-gcc... x86_64-w64-mingw32-gcc #25 6.224 checking whether the C compiler works... yes #25 6.283 checking for C compiler default output file name... a.exe #25 6.286 checking for suffix of executables... .exe #25 6.340 checking whether we are cross compiling... yes #25 6.405 checking for suffix of object files... o #25 6.434 checking whether the compiler supports GNU C... yes #25 6.461 checking whether x86_64-w64-mingw32-gcc accepts -g... yes #25 6.486 checking for x86_64-w64-mingw32-gcc option to enable C11 features... none needed #25 6.551 checking whether x86_64-w64-mingw32-gcc understands -c and -o together... yes #25 6.597 checking whether make supports the include directive... yes (GNU style) #25 6.606 checking dependency style of x86_64-w64-mingw32-gcc... gcc3 #25 6.643 checking for stdio.h... yes #25 6.673 checking for stdlib.h... yes #25 6.706 checking for string.h... yes #25 6.741 checking for inttypes.h... yes #25 6.779 checking for stdint.h... yes #25 6.816 checking for strings.h... yes #25 6.852 checking for sys/stat.h... yes #25 6.893 checking for sys/types.h... yes #25 6.931 checking for unistd.h... yes #25 6.972 checking for wchar.h... yes #25 7.020 checking for minix/config.h... no #25 7.063 checking whether it is safe to define __EXTENSIONS__... yes #25 7.113 checking whether _XOPEN_SOURCE should be defined... no #25 7.152 checking for x86_64-w64-mingw32-ar... x86_64-w64-mingw32-ar #25 7.153 checking the archiver (x86_64-w64-mingw32-ar) interface... ar #25 7.176 checking for int64_t... yes #25 7.275 checking build system type... x86_64-pc-linux-gnu #25 7.334 checking host system type... x86_64-w64-mingw32 #25 7.342 checking how to print strings... printf #25 7.345 checking for a sed that does not truncate output... /usr/bin/sed #25 7.352 checking for grep that handles long lines and -e... /usr/bin/grep #25 7.355 checking for egrep... /usr/bin/grep -E #25 7.358 checking for fgrep... /usr/bin/grep -F #25 7.361 checking for ld used by x86_64-w64-mingw32-gcc... /usr/bin/x86_64-w64-mingw32-ld #25 7.373 checking if the linker (/usr/bin/x86_64-w64-mingw32-ld) is GNU ld... yes #25 7.377 checking for BSD- or MS-compatible name lister (nm)... /usr/bin/x86_64-w64-mingw32-nm -B #25 7.382 checking the name lister (/usr/bin/x86_64-w64-mingw32-nm -B) interface... BSD nm #25 7.407 checking whether ln -s works... yes #25 7.408 checking the maximum length of command line arguments... 1572864 #25 7.417 checking how to convert x86_64-pc-linux-gnu file names to x86_64-w64-mingw32 format... func_convert_file_nix_to_w32 #25 7.418 checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop #25 7.419 checking for /usr/bin/x86_64-w64-mingw32-ld option to reload object files... -r #25 7.420 checking for x86_64-w64-mingw32-file... no #25 7.421 checking for file... file #25 7.422 configure: WARNING: using cross tools not prefixed with host triplet #25 7.423 checking for x86_64-w64-mingw32-objdump... x86_64-w64-mingw32-objdump #25 7.424 checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL #25 7.427 checking for x86_64-w64-mingw32-dlltool... x86_64-w64-mingw32-dlltool #25 7.428 checking how to associate runtime and link libraries... func_cygming_dll_for_implib #25 7.432 checking for x86_64-w64-mingw32-ar... (cached) x86_64-w64-mingw32-ar #25 7.433 checking for archiver @file support... @ #25 7.468 checking for x86_64-w64-mingw32-strip... (cached) x86_64-w64-mingw32-strip #25 7.469 checking for x86_64-w64-mingw32-ranlib... x86_64-w64-mingw32-ranlib #25 7.470 checking command to parse /usr/bin/x86_64-w64-mingw32-nm -B output from x86_64-w64-mingw32-gcc object... ok #25 7.569 checking for sysroot... no #25 7.570 checking for a working dd... /usr/bin/dd #25 7.578 checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1 #25 7.584 checking for x86_64-w64-mingw32-mt... no #25 7.585 checking for mt... no #25 7.586 checking if : is a manifest tool... no #25 7.592 checking for dlfcn.h... no #25 7.636 checking for x86_64-w64-mingw32-as... x86_64-w64-mingw32-as #25 7.637 checking for x86_64-w64-mingw32-dlltool... (cached) x86_64-w64-mingw32-dlltool #25 7.638 checking for x86_64-w64-mingw32-objdump... (cached) x86_64-w64-mingw32-objdump #25 7.640 checking for objdir... .libs #25 7.727 checking if x86_64-w64-mingw32-gcc supports -fno-rtti -fno-exceptions... no #25 7.752 checking for x86_64-w64-mingw32-gcc option to produce PIC... -DDLL_EXPORT -DPIC #25 7.753 checking if x86_64-w64-mingw32-gcc PIC flag -DDLL_EXPORT -DPIC works... yes #25 7.777 checking if x86_64-w64-mingw32-gcc static flag -static works... yes #25 7.828 checking if x86_64-w64-mingw32-gcc supports -c -o file.o... yes #25 7.860 checking if x86_64-w64-mingw32-gcc supports -c -o file.o... (cached) yes #25 7.861 checking whether the x86_64-w64-mingw32-gcc linker (/usr/bin/x86_64-w64-mingw32-ld) supports shared libraries... yes #25 7.872 checking dynamic linker characteristics... Win32 ld.exe #25 7.890 checking how to hardcode library paths into programs... immediate #25 7.891 checking whether stripping libraries is possible... yes #25 7.894 checking if libtool supports shared libraries... yes #25 7.895 checking whether to build shared libraries... no #25 7.896 checking whether to build static libraries... yes #25 7.897 checking whether ln -s works... yes #25 7.898 checking for special C compiler options needed for large files... no #25 7.899 checking for _FILE_OFFSET_BITS value needed for large files... 64 #25 7.958 checking whether the -Werror option is usable... yes #25 7.986 checking for simple visibility declarations... yes #25 8.018 checking for __builtin_mul_overflow()... yes #25 8.079 checking for __attribute__((uninitialized))... yes #25 8.109 checking for limits.h... yes #25 8.151 checking for sys/types.h... (cached) yes #25 8.153 checking for sys/stat.h... (cached) yes #25 8.154 checking for dirent.h... yes #25 8.198 checking for windows.h... yes #25 9.366 checking for sys/wait.h... no #25 9.411 checking for an ANSI C-conforming const... yes #25 9.441 checking for size_t... yes #25 9.534 checking for bcopy... no #25 9.596 checking for memfd_create... no #25 9.659 checking for memmove... yes #25 9.722 checking for mkostemp... no #25 9.784 checking for secure_getenv... no #25 9.845 checking for strerror... yes #25 9.907 checking for realpath... no #25 9.974 checking for zlib.h... yes #25 10.02 checking for gzopen in -lz... yes #25 10.10 checking for bzlib.h... no #25 10.14 checking for libbz2... no #25 10.20 checking whether Intel CET is enabled... no #25 10.27 checking that generated files are newer than configure... done #25 10.27 configure: creating ./config.status #25 10.82 config.status: creating Makefile #25 10.84 config.status: creating libpcre2-8.pc #25 10.86 config.status: creating libpcre2-16.pc #25 10.87 config.status: creating libpcre2-32.pc #25 10.89 config.status: creating libpcre2-posix.pc #25 10.90 config.status: creating pcre2-config #25 10.92 config.status: creating src/pcre2.h #25 10.94 config.status: creating src/config.h #25 10.95 config.status: executing depfiles commands #25 11.37 config.status: executing libtool commands #25 11.38 config.status: executing script-chmod commands #25 11.39 config.status: executing delete-old-chartables commands #25 11.39 #25 11.39 pcre2-10.43-DEV configuration summary: #25 11.39 #25 11.39 Install prefix ..................... : /usr/local/x86_64-w64-mingw32 #25 11.39 C preprocessor ..................... : #25 11.39 C compiler ......................... : x86_64-w64-mingw32-gcc #25 11.39 Linker ............................. : /usr/bin/x86_64-w64-mingw32-ld #25 11.39 C preprocessor flags ............... : -I/usr/local/x86_64-w64-mingw32/include #25 11.39 C compiler flags ................... : -O2 -g -fvisibility=hidden #25 11.39 Linker flags ....................... : -L/usr/local/x86_64-w64-mingw32/lib #25 11.39 Extra libraries .................... : #25 11.39 #25 11.39 Build 8-bit pcre2 library .......... : yes #25 11.39 Build 16-bit pcre2 library ......... : no #25 11.39 Build 32-bit pcre2 library ......... : no #25 11.39 Include debugging code ............. : no #25 11.39 Enable JIT compiling support ....... : no #25 11.39 Use SELinux allocator in JIT ....... : unsupported #25 11.39 Enable Unicode support ............. : yes #25 11.39 Newline char/sequence .............. : lf #25 11.39 \R matches only ANYCRLF ............ : no #25 11.39 \C is disabled ..................... : no #25 11.39 EBCDIC coding ...................... : no #25 11.39 EBCDIC code for NL ................. : n/a #25 11.39 Rebuild char tables ................ : no #25 11.39 Internal link size ................. : 2 #25 11.39 Nested parentheses limit ........... : 250 #25 11.39 Heap limit ......................... : 20000000 kibibytes #25 11.39 Match limit ........................ : 10000000 #25 11.39 Match depth limit .................. : MATCH_LIMIT #25 11.39 Build shared libs .................. : no #25 11.39 Build static libs .................. : yes #25 11.39 Use JIT in pcre2grep ............... : no #25 11.39 Enable callouts in pcre2grep ....... : yes #25 11.39 Enable fork in pcre2grep callouts .. : yes #25 11.39 Initial buffer size for pcre2grep .. : 20480 #25 11.39 Maximum buffer size for pcre2grep .. : 1048576 #25 11.39 Link pcre2grep with libz ........... : no #25 11.39 Link pcre2grep with libbz2 ......... : no #25 11.39 Link pcre2test with libedit ........ : no #25 11.39 Link pcre2test with libreadline .... : no #25 11.39 Valgrind support ................... : no #25 11.39 Code coverage ...................... : no #25 11.39 Fuzzer support ..................... : no #25 11.39 Use %zu and %td .................... : auto #25 11.39 #25 11.46 rm -f src/pcre2_chartables.c #25 11.46 ln -s /usr/local/pcre2/src/pcre2_chartables.c.dist /usr/local/pcre2/src/pcre2_chartables.c #25 11.47 make all-am #25 11.47 make[1]: Entering directory '/usr/local/pcre2' #25 11.49 CC src/pcre2grep-pcre2grep.o #25 13.32 CC src/libpcre2_8_la-pcre2_auto_possess.lo #25 13.74 CC src/libpcre2_8_la-pcre2_chkdint.lo #25 13.84 CC src/libpcre2_8_la-pcre2_compile.lo #25 17.73 CC src/libpcre2_8_la-pcre2_config.lo #25 17.84 CC src/libpcre2_8_la-pcre2_context.lo #25 18.03 CC src/libpcre2_8_la-pcre2_convert.lo #25 18.79 CC src/libpcre2_8_la-pcre2_dfa_match.lo #25 21.28 CC src/libpcre2_8_la-pcre2_error.lo #25 21.39 CC src/libpcre2_8_la-pcre2_extuni.lo #25 21.56 CC src/libpcre2_8_la-pcre2_find_bracket.lo #25 21.68 CC src/libpcre2_8_la-pcre2_jit_compile.lo #25 21.80 CC src/libpcre2_8_la-pcre2_maketables.lo #25 21.94 CC src/libpcre2_8_la-pcre2_match.lo #25 31.10 CC src/libpcre2_8_la-pcre2_match_data.lo #25 31.22 CC src/libpcre2_8_la-pcre2_newline.lo #25 31.37 CC src/libpcre2_8_la-pcre2_ord2utf.lo #25 31.48 CC src/libpcre2_8_la-pcre2_pattern_info.lo #25 31.63 CC src/libpcre2_8_la-pcre2_script_run.lo #25 31.82 CC src/libpcre2_8_la-pcre2_serialize.lo #25 31.98 CC src/libpcre2_8_la-pcre2_string_utils.lo #25 32.12 CC src/libpcre2_8_la-pcre2_study.lo #25 32.63 CC src/libpcre2_8_la-pcre2_substitute.lo #25 33.13 CC src/libpcre2_8_la-pcre2_substring.lo #25 33.34 CC src/libpcre2_8_la-pcre2_tables.lo #25 33.44 CC src/libpcre2_8_la-pcre2_ucd.lo #25 33.62 CC src/libpcre2_8_la-pcre2_valid_utf.lo #25 33.76 CC src/libpcre2_8_la-pcre2_xclass.lo #25 33.98 CC src/libpcre2_8_la-pcre2_chartables.lo #25 34.07 CCLD libpcre2-8.la #25 34.15 libtool: warning: undefined symbols not allowed in x86_64-w64-mingw32 shared libraries; building static only #25 34.22 CCLD pcre2grep.exe #25 34.37 CC src/pcre2test-pcre2test.o #25 37.01 CC src/libpcre2_posix_la-pcre2posix.lo #25 37.17 CCLD libpcre2-posix.la #25 37.24 libtool: warning: undefined symbols not allowed in x86_64-w64-mingw32 shared libraries; building static only #25 37.29 CCLD pcre2test.exe #25 37.46 CC src/pcre2posix_test-pcre2posix_test.o #25 37.55 CCLD pcre2posix_test.exe #25 37.67 /usr/bin/x86_64-w64-mingw32-ld: src/pcre2posix_test-pcre2posix_test.o: in function `main': #25 37.68 /usr/local/pcre2/src/pcre2posix_test.c:134: undefined reference to `__imp_pcre2_regcomp' #25 37.68 /usr/bin/x86_64-w64-mingw32-ld: /usr/local/pcre2/src/pcre2posix_test.c:158: undefined reference to `__imp_pcre2_regexec' #25 37.68 /usr/bin/x86_64-w64-mingw32-ld: /usr/local/pcre2/src/pcre2posix_test.c:195: undefined reference to `__imp_pcre2_regerror' #25 37.68 /usr/bin/x86_64-w64-mingw32-ld: /usr/local/pcre2/src/pcre2posix_test.c:150: undefined reference to `__imp_pcre2_regerror' #25 37.68 /usr/bin/x86_64-w64-mingw32-ld: /usr/local/pcre2/src/pcre2posix_test.c:202: undefined reference to `__imp_pcre2_regfree' #25 37.69 collect2: error: ld returned 1 exit status #25 37.69 make[1]: *** [Makefile:1843: pcre2posix_test.exe] Error 1 #25 37.69 make[1]: Leaving directory '/usr/local/pcre2' #25 37.70 make: *** [Makefile:1456: all] Error 2 ```
@PhilipHazel
Copy link
Collaborator

The failure is when trying to link pcre2posix_test, a new test program that was added about 6 months ago, which fits with your timing. I don't know anything about MinGW or Dockerfiles. It seems as if it is failing to include the pcre2posix library when linking this test, but I have no idea why, because, needless to say, the ./autogen.sh; ./configure; make sequence works on my Linux box. The new test program is in the 10.42 release, and we've had no other reports of this failure (but maybe few people do static builds, though the pre-release test script does include a static-only build).

rockdaboot added a commit to rockdaboot/pcre2 that referenced this issue May 6, 2023
@rockdaboot
Copy link
Author

Thanks @PhilipHazel, that was hint enough to make a quick fix 😄

@carenas
Copy link
Contributor

carenas commented May 6, 2023

maybe few people do static builds,

the CI does a static build for windows but configuring with cmake and that seems to be working fine, but probably just because of pure luck, since it also uses the Microsoft compiler that doesn't support the visibility attribute.

it seems the problem is wider, since setting the visibility attribute (when supported by the compiler) will conflict with setting the correct "magic" needed in Windows to link with the right type of library.

@rockdaboot
Copy link
Author

Thanks for fixing the issue 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants