It's not actually clear if the ZLIB_PE_CFLAGS and ZLIB_PE_LIBS introduced in 2929aa3c74 were meant for this purpose, given the number of ways in which they're broken. Nevertheless, it would be really quite nice to have, so this series aims to provide that. After these patches I'm able to compile wine using distribution static libraries, with the following configure flags:
configure ZLIB_PE_CFLAGS="$(x86_64-w64-mingw32-pkg-config --cflags zlib)" ZLIB_PE_LIBS="-Wl,-Bstatic $(x86_64-w64-mingw32-pkg-config --static --libs zlib) -Wl,-Bdynamic" PNG_PE_CFLAGS="$(x86_64-w64-mingw32-pkg-config --cflags libpng16)" PNG_PE_LIBS="-Wl,-Bstatic $(x86_64-w64-mingw32-pkg-config --static --libs libpng16) -lmingwex -lmingw32 -Wl,-Bdynamic"
Patches 5-6 are necessary to allow static linking of libpng16. Patch 4 is probably desirable on its own anyway.
This is also a first step to actually acquiescing to what distributions have asked for. After this I intend to submit patches to:
* allow automatic detection of distribution packages via MinGW pkg-config, which is pretty well standardized;
* allow the use of dynamic libraries using the approach demonstrated in [1].
[1] https://www.winehq.org/pipermail/wine-devel/2021-September/195543.html
Zebediah Figura (6): makefiles: Allow using external system headers in PE libraries. winegcc: Allow explicit static and dynamic linking. makefiles: Allow using *_PE_LIBS to specify linker flags to external static libraries. include: Add DECLSPEC_RETURNS_TWICE. ucrtbase: Export _setjmp() from the import library. ucrtbase: Export atexit() from the import library.
aclocal.m4 | 5 ++++- configure.ac | 2 +- dlls/cabinet/Makefile.in | 3 ++- dlls/dbghelp/Makefile.in | 3 ++- dlls/opcservices/Makefile.in | 3 ++- dlls/ucrtbase/Makefile.in | 2 ++ dlls/ucrtbase/atexit.c | 31 +++++++++++++++++++++++++++++++ dlls/ucrtbase/setjmp.c | 32 ++++++++++++++++++++++++++++++++ dlls/user32/Makefile.in | 3 ++- dlls/windowscodecs/Makefile.in | 3 ++- dlls/wininet/Makefile.in | 3 ++- include/msvcrt/corecrt.h | 18 ++++++++++++++++++ include/msvcrt/setjmp.h | 8 ++------ include/wine/exception.h | 4 ++-- include/wine/unixlib.h | 4 ++-- include/winnt.h | 8 ++++++++ tools/makedep.c | 14 ++------------ tools/winegcc/winegcc.c | 16 ++++++++++++---- 18 files changed, 128 insertions(+), 34 deletions(-) create mode 100644 dlls/ucrtbase/atexit.c create mode 100644 dlls/ucrtbase/setjmp.c
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- tools/makedep.c | 10 ---------- 1 file changed, 10 deletions(-)
diff --git a/tools/makedep.c b/tools/makedep.c index a7a7924a20b..2a7cbcad051 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -1406,16 +1406,6 @@ static struct file *open_include_file( const struct makefile *make, struct incl_ return file; }
- if (pFile->type == INCL_SYSTEM && pFile->use_msvcrt && - !make->extlib && !pFile->included_by->is_external) - { - if (!strcmp( pFile->name, "stdarg.h" )) return NULL; - if (!strcmp( pFile->name, "x86intrin.h" )) return NULL; - fprintf( stderr, "%s:%d: error: system header %s cannot be used with msvcrt\n", - pFile->included_by->file->name, pFile->included_line, pFile->name ); - exit(1); - } - if (pFile->type == INCL_SYSTEM) return NULL; /* ignore system files we cannot find */
/* try in src file directory */
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- tools/winegcc/winegcc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index 5204553f739..c8bf5681fb0 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -2002,7 +2002,14 @@ int main(int argc, char **argv) if (!strcmp(Wl.str[j], "--whole-archive") || !strcmp(Wl.str[j], "--no-whole-archive") || !strcmp(Wl.str[j], "--start-group") || - !strcmp(Wl.str[j], "--end-group")) + !strcmp(Wl.str[j], "--end-group") || + !strcmp(Wl.str[j], "-Bdynamic") || + !strcmp(Wl.str[j], "-Bstatic") || + !strcmp(Wl.str[j], "-dn") || + !strcmp(Wl.str[j], "-dy") || + !strcmp(Wl.str[j], "-call_shared") || + !strcmp(Wl.str[j], "-non_shared") || + !strcmp(Wl.str[j], "-static")) { strarray_add( &opts.files, strmake( "-Wl,%s", Wl.str[j] )); continue; @@ -2012,7 +2019,6 @@ int main(int argc, char **argv) opts.out_implib = strdup( Wl.str[++j] ); continue; } - if (!strcmp(Wl.str[j], "-static")) linking = -1; strarray_add(&opts.linker_args, strmake("-Wl,%s",Wl.str[j])); } raw_compiler_arg = raw_linker_arg = 0; @@ -2033,7 +2039,10 @@ int main(int argc, char **argv) break; case '-': if (strcmp("-static", opts.args.str[i]+1) == 0) - linking = -1; + { + strarray_add( &opts.files, opts.args.str[i] ); + raw_compiler_arg = raw_linker_arg = 0; + } else if (is_option( &opts, i, "--sysroot", &option_arg )) { opts.sysroot = option_arg; @@ -2092,7 +2101,6 @@ int main(int argc, char **argv) }
if (opts.processor == proc_cpp) linking = 0; - if (linking == -1) error("Static linking is not supported\n");
if (!opts.wine_objdir && is_pe_target( &opts )) opts.use_msvcrt = 1;
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- IMPORTS does not expect flags. That could be changed instead, however, as an alternative to this patch.
aclocal.m4 | 5 ++++- configure.ac | 2 +- dlls/cabinet/Makefile.in | 3 ++- dlls/dbghelp/Makefile.in | 3 ++- dlls/opcservices/Makefile.in | 3 ++- dlls/user32/Makefile.in | 3 ++- dlls/windowscodecs/Makefile.in | 3 ++- dlls/wininet/Makefile.in | 3 ++- tools/makedep.c | 4 ++-- 9 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4 index 2487df7a314..1682b2e0ec8 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -131,12 +131,15 @@ dnl AC_DEFUN([WINE_EXTLIB_FLAGS], [AS_VAR_PUSHDEF([ac_cflags],[[$1]_PE_CFLAGS])dnl AS_VAR_PUSHDEF([ac_libs],[[$1]_PE_LIBS])dnl +AS_VAR_PUSHDEF([ac_imports],[[$1]_PE_IMPORTS])dnl AC_ARG_VAR(ac_cflags, [C compiler flags for the PE $2, overriding the bundled version])dnl AC_ARG_VAR(ac_libs, [Linker flags for the PE $2, overriding the bundled version])dnl AS_VAR_IF([ac_cflags],[],[ac_cflags=$4],[enable_$2=no]) -AS_VAR_IF([ac_libs],[],[ac_libs=$3],[enable_$2=no]) +AS_VAR_IF([ac_libs],[],[AC_SUBST(ac_imports,[$3])],[enable_$2=no]) AS_ECHO(["$as_me:${as_lineno-$LINENO}: $2 cflags: $ac_cflags"]) >&AS_MESSAGE_LOG_FD +AS_ECHO(["$as_me:${as_lineno-$LINENO}: $2 imports: $ac_imports"]) >&AS_MESSAGE_LOG_FD AS_ECHO(["$as_me:${as_lineno-$LINENO}: $2 libs: $ac_libs"]) >&AS_MESSAGE_LOG_FD +AS_VAR_POPDEF([ac_imports])dnl AS_VAR_POPDEF([ac_libs])dnl AS_VAR_POPDEF([ac_cflags])])dnl
diff --git a/configure.ac b/configure.ac index 2fb43fe2689..0dfe36c50b1 100644 --- a/configure.ac +++ b/configure.ac @@ -2592,7 +2592,7 @@ AC_CONFIG_COMMANDS([include/stamp-h], [echo timestamp > include/stamp-h]) AS_ECHO_N("creating Makefile rules...") >&AS_MESSAGE_FD
AC_SUBST([ALL_VARS_RULES], -"m4_set_foreach([_AC_SUBST_VARS],[var],[m4_if(m4_bregexp(m4_defn([var]),[(_CFLAGS|_LIBS)$]),-1,,[var = $var +"m4_set_foreach([_AC_SUBST_VARS],[var],[m4_if(m4_bregexp(m4_defn([var]),[(_CFLAGS|_LIBS|_IMPORTS)$]),-1,,[var = $var ])])")
makedep_flags="" diff --git a/dlls/cabinet/Makefile.in b/dlls/cabinet/Makefile.in index 4ee406480ac..e4188b58f44 100644 --- a/dlls/cabinet/Makefile.in +++ b/dlls/cabinet/Makefile.in @@ -1,7 +1,8 @@ MODULE = cabinet.dll IMPORTLIB = cabinet -IMPORTS = $(ZLIB_PE_LIBS) +IMPORTS = $(ZLIB_PE_IMPORTS) EXTRAINCL = $(ZLIB_PE_CFLAGS) +EXTRADLLFLAGS = $(ZLIB_PE_LIBS)
C_SRCS = \ cabinet_main.c \ diff --git a/dlls/dbghelp/Makefile.in b/dlls/dbghelp/Makefile.in index 22be2612eeb..bd656521f67 100644 --- a/dlls/dbghelp/Makefile.in +++ b/dlls/dbghelp/Makefile.in @@ -1,7 +1,8 @@ MODULE = dbghelp.dll IMPORTLIB = dbghelp -IMPORTS = $(ZLIB_PE_LIBS) +IMPORTS = $(ZLIB_PE_IMPORTS) EXTRAINCL = $(ZLIB_PE_CFLAGS) +EXTRADLLFLAGS = $(ZLIB_PE_LIBS) EXTRADEFS = -D_IMAGEHLP_SOURCE_ DELAYIMPORTS = version
diff --git a/dlls/opcservices/Makefile.in b/dlls/opcservices/Makefile.in index 0867b1bd882..7eb5fe300d0 100644 --- a/dlls/opcservices/Makefile.in +++ b/dlls/opcservices/Makefile.in @@ -1,6 +1,7 @@ MODULE = opcservices.dll -IMPORTS = $(ZLIB_PE_LIBS) uuid ole32 advapi32 urlmon xmllite oleaut32 +IMPORTS = $(ZLIB_PE_IMPORTS) uuid ole32 advapi32 urlmon xmllite oleaut32 EXTRAINCL = $(ZLIB_PE_CFLAGS) +EXTRADLLFLAGS = $(ZLIB_PE_LIBS)
C_SRCS = \ compress.c \ diff --git a/dlls/user32/Makefile.in b/dlls/user32/Makefile.in index 54feab3400f..aaded54e814 100644 --- a/dlls/user32/Makefile.in +++ b/dlls/user32/Makefile.in @@ -1,8 +1,9 @@ EXTRADEFS = -D_USER32_ -D_WINABLE_ MODULE = user32.dll IMPORTLIB = user32 -IMPORTS = $(PNG_PE_LIBS) setupapi gdi32 version sechost advapi32 kernelbase win32u +IMPORTS = $(PNG_PE_IMPORTS) setupapi gdi32 version sechost advapi32 kernelbase win32u EXTRAINCL = $(PNG_PE_CFLAGS) +EXTRADLLFLAGS = $(PNG_PE_LIBS) DELAYIMPORTS = hid imm32
C_SRCS = \ diff --git a/dlls/windowscodecs/Makefile.in b/dlls/windowscodecs/Makefile.in index 5a84ccbb9f2..d285efa0064 100644 --- a/dlls/windowscodecs/Makefile.in +++ b/dlls/windowscodecs/Makefile.in @@ -1,8 +1,9 @@ MODULE = windowscodecs.dll IMPORTLIB = windowscodecs -IMPORTS = $(PNG_PE_LIBS) windowscodecs uuid ole32 oleaut32 propsys rpcrt4 shlwapi user32 gdi32 advapi32 +IMPORTS = $(PNG_PE_IMPORTS) windowscodecs uuid ole32 oleaut32 propsys rpcrt4 shlwapi user32 gdi32 advapi32 EXTRAINCL = $(PNG_PE_CFLAGS) $(JPEG_CFLAGS) $(TIFF_CFLAGS) EXTRALIBS = $(APPLICATIONSERVICES_LIBS) +EXTRADLLFLAGS = $(PNG_PE_LIBS)
C_SRCS = \ bitmap.c \ diff --git a/dlls/wininet/Makefile.in b/dlls/wininet/Makefile.in index 7e8111f811d..d1dd5ca2db0 100644 --- a/dlls/wininet/Makefile.in +++ b/dlls/wininet/Makefile.in @@ -1,7 +1,8 @@ MODULE = wininet.dll IMPORTLIB = wininet -IMPORTS = $(ZLIB_PE_LIBS) mpr shlwapi shell32 user32 ws2_32 advapi32 +IMPORTS = $(ZLIB_PE_IMPORTS) mpr shlwapi shell32 user32 ws2_32 advapi32 EXTRAINCL = $(ZLIB_PE_CFLAGS) +EXTRADLLFLAGS = $(ZLIB_PE_LIBS) DELAYIMPORTS = secur32 crypt32 cryptui dhcpcsvc iphlpapi
C_SRCS = \ diff --git a/tools/makedep.c b/tools/makedep.c index 2a7cbcad051..fa848972ba6 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -3220,9 +3220,9 @@ static void output_module( struct makefile *make ) output_filename( "-shared" ); output_filename( spec_file ); } - output_filenames( make->extradllflags ); output_filenames_obj_dir( make, make->is_cross ? make->crossobj_files : make->object_files ); output_filenames_obj_dir( make, make->res_files ); + output_filenames( make->extradllflags ); if (debug_file) output_filename( strmake( "-Wl,--debug-file,%s", obj_dir_path( make, debug_file ))); output_filenames( all_libs ); output_filename( make->is_cross ? "$(CROSSLDFLAGS)" : "$(LDFLAGS)" ); @@ -3448,9 +3448,9 @@ static void output_test_module( struct makefile *make ) output_file = strmake( "%s%s", obj_dir_path( make, testmodule ), ext ); output( "%s:\n", output_file ); output_winegcc_command( make, make->is_cross ); - output_filenames( make->extradllflags ); output_filenames_obj_dir( make, make->is_cross ? make->crossobj_files : make->object_files ); output_filenames_obj_dir( make, make->res_files ); + output_filenames( make->extradllflags ); if ((debug_file = get_debug_file( make, testmodule ))) output_filename( strmake( "-Wl,--debug-file,%s", obj_dir_path( make, debug_file ))); output_filenames( all_libs );
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=100411
Your paranoid android.
=== debiant2 (build log) ===
/home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2362: undefined reference to `adler32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2363: undefined reference to `adler32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2375: undefined reference to `crc32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2376: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:130: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:173: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:980: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngread.c:979: undefined reference to `inflateEnd' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:407: undefined reference to `inflateReset2' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:416: undefined reference to `inflateInit2_' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:429: undefined reference to `inflateValidate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:662: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwrite.c:945: undefined reference to `deflateEnd' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:395: undefined reference to `deflateEnd' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:417: undefined reference to `deflateInit2_' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:413: undefined reference to `deflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:580: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:981: undefined reference to `deflate' collect2: error: ld returned 1 exit status Task: The win32 Wine build failed
=== debiant2 (build log) ===
/home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2362: undefined reference to `adler32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2363: undefined reference to `adler32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2375: undefined reference to `crc32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2376: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:130: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:173: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:980: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngread.c:979: undefined reference to `inflateEnd' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:407: undefined reference to `inflateReset2' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:416: undefined reference to `inflateInit2_' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:429: undefined reference to `inflateValidate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:662: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwrite.c:945: undefined reference to `deflateEnd' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:395: undefined reference to `deflateEnd' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:417: undefined reference to `deflateInit2_' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:413: undefined reference to `deflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:580: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:981: undefined reference to `deflate' collect2: error: ld returned 1 exit status Task: The wow64 Wine build failed
Zebediah Figura zfigura@codeweavers.com writes:
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
IMPORTS does not expect flags. That could be changed instead, however, as an alternative to this patch.
Yes that's my plan, I was going to do something like this:
diff --git a/tools/makedep.c b/tools/makedep.c index d7bc210302a9..ce70f9857bba 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -1411,6 +1411,7 @@ static struct file *open_include_file( const struct makefile *make, struct incl_ { if (!strcmp( pFile->name, "stdarg.h" )) return NULL; if (!strcmp( pFile->name, "x86intrin.h" )) return NULL; + if (make->include_paths.count) return NULL; fprintf( stderr, "%s:%d: error: system header %s cannot be used with msvcrt\n", pFile->included_by->file->name, pFile->included_line, pFile->name ); exit(1); @@ -1961,6 +1962,7 @@ static struct strarray get_local_dependencies( const struct makefile *make, cons static const char *get_static_lib( const struct makefile *make, const char *name ) { if (!make->staticlib) return NULL; + if (make->disabled) return NULL; if (strncmp( make->staticlib, "lib", 3 )) return NULL; if (strncmp( make->staticlib + 3, name, strlen(name) )) return NULL; if (strcmp( make->staticlib + 3 + strlen(name), ".a" )) return NULL; @@ -2079,9 +2081,20 @@ static struct strarray add_import_libs( const struct makefile *make, struct stra
for (i = 0; i < imports.count; i++) { - const char *name = get_base_name( imports.str[i] ); + const char *name = imports.str[i]; const char *lib = NULL;
+ if (name[0] == '-') + { + switch (name[1]) + { + case 'L': strarray_add( &ret, name ); continue; + case 'l': name += 2; break; + default: continue; + } + } + else name = get_base_name( name ); + for (j = 0; j < subdirs.count; j++) { if (submakes[j]->importlib && !strcmp( submakes[j]->importlib, name ))
On 10/19/21 10:57, Alexandre Julliard wrote:
Zebediah Figura zfigura@codeweavers.com writes:
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
IMPORTS does not expect flags. That could be changed instead, however, as an alternative to this patch.
Yes that's my plan, I was going to do something like this:
Do you have a plan for any of the other problems preventing use of external libraries, then? I notice the below diff doesn't by itself allow for use of static libraries (and dynamic libraries also require some more work than what's currently upstream).
diff --git a/tools/makedep.c b/tools/makedep.c index d7bc210302a9..ce70f9857bba 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -1411,6 +1411,7 @@ static struct file *open_include_file( const struct makefile *make, struct incl_ { if (!strcmp( pFile->name, "stdarg.h" )) return NULL; if (!strcmp( pFile->name, "x86intrin.h" )) return NULL;
if (make->include_paths.count) return NULL; fprintf( stderr, "%s:%d: error: system header %s cannot be used with msvcrt\n", pFile->included_by->file->name, pFile->included_line, pFile->name ); exit(1);
@@ -1961,6 +1962,7 @@ static struct strarray get_local_dependencies( const struct makefile *make, cons static const char *get_static_lib( const struct makefile *make, const char *name ) { if (!make->staticlib) return NULL;
- if (make->disabled) return NULL; if (strncmp( make->staticlib, "lib", 3 )) return NULL; if (strncmp( make->staticlib + 3, name, strlen(name) )) return NULL; if (strcmp( make->staticlib + 3 + strlen(name), ".a" )) return NULL;
@@ -2079,9 +2081,20 @@ static struct strarray add_import_libs( const struct makefile *make, struct stra
for (i = 0; i < imports.count; i++) {
const char *name = get_base_name( imports.str[i] );
const char *name = imports.str[i]; const char *lib = NULL;
if (name[0] == '-')
{
switch (name[1])
{
case 'L': strarray_add( &ret, name ); continue;
case 'l': name += 2; break;
default: continue;
}
}
else name = get_base_name( name );
for (j = 0; j < subdirs.count; j++) { if (submakes[j]->importlib && !strcmp( submakes[j]->importlib, name ))
"Zebediah Figura (she/her)" zfigura@codeweavers.com writes:
On 10/19/21 10:57, Alexandre Julliard wrote:
Zebediah Figura zfigura@codeweavers.com writes:
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
IMPORTS does not expect flags. That could be changed instead, however, as an alternative to this patch.
Yes that's my plan, I was going to do something like this:
Do you have a plan for any of the other problems preventing use of external libraries, then? I notice the below diff doesn't by itself allow for use of static libraries (and dynamic libraries also require some more work than what's currently upstream).
I don't think static libraries are going to work, because of the msvcrt version issue. For dynamic libraries, if you mean finding them at runtime etc. then no, I'm not working on that part. But you should be able to link to them and test them by copying them into the prefix.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- include/msvcrt/corecrt.h | 18 ++++++++++++++++++ include/msvcrt/setjmp.h | 8 ++------ include/wine/exception.h | 4 ++-- include/wine/unixlib.h | 4 ++-- include/winnt.h | 8 ++++++++ 5 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h index e61a22dccd7..7e0cd8a548a 100644 --- a/include/msvcrt/corecrt.h +++ b/include/msvcrt/corecrt.h @@ -152,6 +152,24 @@ # endif #endif
+#ifndef DECLSPEC_NOTHROW +# if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS) +# define DECLSPEC_NOTHROW __declspec(nothrow) +# elif defined(__GNUC__) +# define DECLSPEC_NOTHROW __attribute__((nothrow)) +# else +# define DECLSPEC_NOTHROW +# endif +#endif + +#ifndef DECLSPEC_RETURNS_TWICE +# if defined(__GNUC__) +# define DECLSPEC_RETURNS_TWICE __attribute__((returns_twice)) +# else +# define DECLSPEC_RETURNS_TWICE +# endif +#endif + #ifndef DECLSPEC_ALIGN # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS) # define DECLSPEC_ALIGN(x) __declspec(align(x)) diff --git a/include/msvcrt/setjmp.h b/include/msvcrt/setjmp.h index 6576605cf1b..410852734cd 100644 --- a/include/msvcrt/setjmp.h +++ b/include/msvcrt/setjmp.h @@ -152,7 +152,7 @@ _ACRTIMP void __cdecl longjmp(jmp_buf,int); # define _setjmpex __intrinsic_setjmpex # endif # if defined(__GNUC__) || defined(__clang__) -_ACRTIMP int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmpex(jmp_buf,void*); +_ACRTIMP int DECLSPEC_NOTHROW DECLSPEC_RETURNS_TWICE __cdecl _setjmpex(jmp_buf,void*); # define setjmp(buf) _setjmpex(buf,__builtin_frame_address(0)) # define setjmpex(buf) _setjmpex(buf,__builtin_frame_address(0)) # endif @@ -160,11 +160,7 @@ _ACRTIMP int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmpex(j # ifdef _UCRT # define _setjmp __intrinsic_setjmp # endif -# if defined(__GNUC__) || defined(__clang__) -_ACRTIMP int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmp(jmp_buf); -# else -_ACRTIMP int __cdecl _setjmp(jmp_buf); -# endif +_ACRTIMP int DECLSPEC_NOTHROW DECLSPEC_RETURNS_TWICE __cdecl _setjmp(jmp_buf); #endif /* _WIN64 */
#ifndef setjmp diff --git a/include/wine/exception.h b/include/wine/exception.h index 812b4641d62..4d42d84dbd3 100644 --- a/include/wine/exception.h +++ b/include/wine/exception.h @@ -104,8 +104,8 @@ typedef struct { __int64 reg[24]; } __wine_jmp_buf; typedef struct { int reg; } __wine_jmp_buf; #endif
-extern int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) __wine_setjmpex( __wine_jmp_buf *buf, - EXCEPTION_REGISTRATION_RECORD *frame ) DECLSPEC_HIDDEN; +extern int DECLSPEC_NOTHROW DECLSPEC_RETURNS_TWICE __cdecl __wine_setjmpex( __wine_jmp_buf *buf, + EXCEPTION_REGISTRATION_RECORD *frame ) DECLSPEC_HIDDEN; extern void DECLSPEC_NORETURN __cdecl __wine_longjmp( __wine_jmp_buf *buf, int retval ) DECLSPEC_HIDDEN; extern void DECLSPEC_NORETURN __cdecl __wine_rtl_unwind( EXCEPTION_REGISTRATION_RECORD* frame, EXCEPTION_RECORD *record, void (*target)(void) ) DECLSPEC_HIDDEN; diff --git a/include/wine/unixlib.h b/include/wine/unixlib.h index 920e3d32dc5..e85ee1303b7 100644 --- a/include/wine/unixlib.h +++ b/include/wine/unixlib.h @@ -49,8 +49,8 @@ typedef struct { __int64 reg[24]; } __wine_jmp_buf; typedef struct { int reg; } __wine_jmp_buf; #endif
-extern int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) __wine_setjmpex( __wine_jmp_buf *buf, - EXCEPTION_REGISTRATION_RECORD *frame ); +extern int DECLSPEC_NOTHROW DECLSPEC_RETURNS_TWICE __cdecl __wine_setjmpex( __wine_jmp_buf *buf, + EXCEPTION_REGISTRATION_RECORD *frame ); extern void DECLSPEC_NORETURN __cdecl __wine_longjmp( __wine_jmp_buf *buf, int retval ); extern void ntdll_set_exception_jmp_buf( __wine_jmp_buf *jmp );
diff --git a/include/winnt.h b/include/winnt.h index ef731e29c52..d0558935ed9 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -93,6 +93,14 @@ extern "C" { # endif #endif
+#ifndef DECLSPEC_RETURNS_TWICE +# if defined(__GNUC__) +# define DECLSPEC_RETURNS_TWICE __attribute__((returns_twice)) +# else +# define DECLSPEC_RETURNS_TWICE +# endif +#endif + #ifndef DECLSPEC_CACHEALIGN # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128) #endif
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=100412
Your paranoid android.
=== debiant2 (build log) ===
/home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2362: undefined reference to `adler32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2363: undefined reference to `adler32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2375: undefined reference to `crc32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2376: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:130: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:173: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:980: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngread.c:979: undefined reference to `inflateEnd' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:407: undefined reference to `inflateReset2' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:416: undefined reference to `inflateInit2_' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:429: undefined reference to `inflateValidate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:662: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwrite.c:945: undefined reference to `deflateEnd' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:395: undefined reference to `deflateEnd' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:417: undefined reference to `deflateInit2_' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:413: undefined reference to `deflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:580: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:981: undefined reference to `deflate' collect2: error: ld returned 1 exit status Task: The win32 Wine build failed
=== debiant2 (build log) ===
/home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2362: undefined reference to `adler32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2363: undefined reference to `adler32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2375: undefined reference to `crc32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2376: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:130: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:173: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:980: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngread.c:979: undefined reference to `inflateEnd' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:407: undefined reference to `inflateReset2' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:416: undefined reference to `inflateInit2_' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:429: undefined reference to `inflateValidate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:662: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwrite.c:945: undefined reference to `deflateEnd' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:395: undefined reference to `deflateEnd' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:417: undefined reference to `deflateInit2_' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:413: undefined reference to `deflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:580: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:981: undefined reference to `deflate' collect2: error: ld returned 1 exit status Task: The wow64 Wine build failed
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ucrtbase/Makefile.in | 1 + dlls/ucrtbase/setjmp.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 dlls/ucrtbase/setjmp.c
diff --git a/dlls/ucrtbase/Makefile.in b/dlls/ucrtbase/Makefile.in index bf7f62ada8a..e7d0759072c 100644 --- a/dlls/ucrtbase/Makefile.in +++ b/dlls/ucrtbase/Makefile.in @@ -36,6 +36,7 @@ C_SRCS = \ printf.c \ process.c \ scanf.c \ + setjmp.c \ sincos.c \ string.c \ thread.c \ diff --git a/dlls/ucrtbase/setjmp.c b/dlls/ucrtbase/setjmp.c new file mode 100644 index 00000000000..fb76b91c5a8 --- /dev/null +++ b/dlls/ucrtbase/setjmp.c @@ -0,0 +1,32 @@ +/* + * Copyright 2021 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* these functions are part of the import lib for compatibility with the Mingw runtime */ +#if 0 +#pragma makedep implib +#endif + +#include <setjmp.h> + +#undef _setjmp +extern int DECLSPEC_NOTHROW DECLSPEC_RETURNS_TWICE __cdecl __intrinsic_setjmp(jmp_buf); + +int DECLSPEC_NOTHROW DECLSPEC_RETURNS_TWICE __cdecl _setjmp(jmp_buf buf) +{ + return __intrinsic_setjmp(buf); +}
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=100413
Your paranoid android.
=== debiant2 (build log) ===
/home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2362: undefined reference to `adler32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2363: undefined reference to `adler32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2375: undefined reference to `crc32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2376: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:130: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:173: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:980: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngread.c:979: undefined reference to `inflateEnd' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:407: undefined reference to `inflateReset2' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:416: undefined reference to `inflateInit2_' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:429: undefined reference to `inflateValidate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:662: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwrite.c:945: undefined reference to `deflateEnd' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:395: undefined reference to `deflateEnd' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:417: undefined reference to `deflateInit2_' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:413: undefined reference to `deflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:580: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:981: undefined reference to `deflate' collect2: error: ld returned 1 exit status /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2362: undefined reference to `adler32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2363: undefined reference to `adler32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2375: undefined reference to `crc32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2376: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:130: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:173: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:980: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngread.c:979: undefined reference to `inflateEnd' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:407: undefined reference to `inflateReset2' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:416: undefined reference to `inflateInit2_' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:429: undefined reference to `inflateValidate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:662: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwrite.c:945: undefined reference to `deflateEnd' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:395: undefined reference to `deflateEnd' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:417: undefined reference to `deflateInit2_' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:413: undefined reference to `deflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:580: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:981: undefined reference to `deflate' collect2: error: ld returned 1 exit status Task: The win32 Wine build failed
=== debiant2 (build log) ===
/home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2362: undefined reference to `adler32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2363: undefined reference to `adler32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2375: undefined reference to `crc32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2376: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:130: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:173: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:980: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngread.c:979: undefined reference to `inflateEnd' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:407: undefined reference to `inflateReset2' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:416: undefined reference to `inflateInit2_' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:429: undefined reference to `inflateValidate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:662: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwrite.c:945: undefined reference to `deflateEnd' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:395: undefined reference to `deflateEnd' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:417: undefined reference to `deflateInit2_' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:413: undefined reference to `deflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:580: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:981: undefined reference to `deflate' collect2: error: ld returned 1 exit status /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2362: undefined reference to `adler32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2363: undefined reference to `adler32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2375: undefined reference to `crc32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2376: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:130: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:173: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:980: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngread.c:979: undefined reference to `inflateEnd' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:407: undefined reference to `inflateReset2' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:416: undefined reference to `inflateInit2_' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:429: undefined reference to `inflateValidate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:662: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwrite.c:945: undefined reference to `deflateEnd' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:395: undefined reference to `deflateEnd' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:417: undefined reference to `deflateInit2_' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:413: undefined reference to `deflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:580: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:981: undefined reference to `deflate' collect2: error: ld returned 1 exit status Task: The wow64 Wine build failed
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ucrtbase/Makefile.in | 1 + dlls/ucrtbase/atexit.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 dlls/ucrtbase/atexit.c
diff --git a/dlls/ucrtbase/Makefile.in b/dlls/ucrtbase/Makefile.in index e7d0759072c..9d6483ef450 100644 --- a/dlls/ucrtbase/Makefile.in +++ b/dlls/ucrtbase/Makefile.in @@ -6,6 +6,7 @@ DELAYIMPORTS = advapi32 user32 PARENTSRC = ../msvcrt
C_SRCS = \ + atexit.c \ console.c \ cpp.c \ crt_gccmain.c \ diff --git a/dlls/ucrtbase/atexit.c b/dlls/ucrtbase/atexit.c new file mode 100644 index 00000000000..48ff1c177ba --- /dev/null +++ b/dlls/ucrtbase/atexit.c @@ -0,0 +1,31 @@ +/* + * Copyright 2021 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* these functions are part of the import lib for compatibility with the Mingw runtime */ +#if 0 +#pragma makedep implib +#endif + +#include <stdlib.h> + +extern int __cdecl _crt_atexit(void (__cdecl *func)(void)); + +int __cdecl atexit(void (__cdecl *func)(void)) +{ + return _crt_atexit(func); +}
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=100414
Your paranoid android.
=== debiant2 (build log) ===
/home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2362: undefined reference to `adler32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2363: undefined reference to `adler32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2375: undefined reference to `crc32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2376: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:130: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:173: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:980: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngread.c:979: undefined reference to `inflateEnd' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:407: undefined reference to `inflateReset2' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:416: undefined reference to `inflateInit2_' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:429: undefined reference to `inflateValidate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:662: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwrite.c:945: undefined reference to `deflateEnd' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:395: undefined reference to `deflateEnd' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:417: undefined reference to `deflateInit2_' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:413: undefined reference to `deflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:580: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:981: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2362: undefined reference to `adler32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2363: undefined reference to `adler32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2375: undefined reference to `crc32' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:2376: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:130: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:173: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/png.c:980: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngread.c:979: undefined reference to `inflateEnd' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:407: undefined reference to `inflateReset2' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:416: undefined reference to `inflateInit2_' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:429: undefined reference to `inflateValidate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:662: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwrite.c:945: undefined reference to `deflateEnd' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:395: undefined reference to `deflateEnd' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:417: undefined reference to `deflateInit2_' /usr/bin/i686-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:413: undefined reference to `deflateReset' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:580: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-win32/../wine/libs/png/pngwutil.c:981: undefined reference to `deflate' collect2: error: ld returned 1 exit status collect2: error: ld returned 1 exit status Task: The win32 Wine build failed
=== debiant2 (build log) ===
/home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2362: undefined reference to `adler32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2363: undefined reference to `adler32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2375: undefined reference to `crc32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2376: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:130: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:173: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:980: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngread.c:979: undefined reference to `inflateEnd' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:407: undefined reference to `inflateReset2' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:416: undefined reference to `inflateInit2_' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:429: undefined reference to `inflateValidate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:662: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwrite.c:945: undefined reference to `deflateEnd' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:395: undefined reference to `deflateEnd' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:417: undefined reference to `deflateInit2_' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:413: undefined reference to `deflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:580: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:981: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2362: undefined reference to `adler32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2363: undefined reference to `adler32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2375: undefined reference to `crc32' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:2376: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:130: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:173: undefined reference to `crc32' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/png.c:980: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngread.c:979: undefined reference to `inflateEnd' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:407: undefined reference to `inflateReset2' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:416: undefined reference to `inflateInit2_' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:429: undefined reference to `inflateValidate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:662: undefined reference to `inflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngrutil.c:467: undefined reference to `inflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwrite.c:945: undefined reference to `deflateEnd' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:395: undefined reference to `deflateEnd' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:417: undefined reference to `deflateInit2_' /usr/bin/x86_64-w64-mingw32-ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:413: undefined reference to `deflateReset' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:580: undefined reference to `deflate' /home/winetest/tools/testbot/var/wine-wow64/../wine/libs/png/pngwutil.c:981: undefined reference to `deflate' collect2: error: ld returned 1 exit status collect2: error: ld returned 1 exit status Task: The wow64 Wine build failed
Zebediah Figura zfigura@codeweavers.com writes:
It's not actually clear if the ZLIB_PE_CFLAGS and ZLIB_PE_LIBS introduced in 2929aa3c74 were meant for this purpose, given the number of ways in which they're broken. Nevertheless, it would be really quite nice to have, so this series aims to provide that. After these patches I'm able to compile wine using distribution static libraries, with the following configure flags:
configure ZLIB_PE_CFLAGS="$(x86_64-w64-mingw32-pkg-config --cflags zlib)" ZLIB_PE_LIBS="-Wl,-Bstatic $(x86_64-w64-mingw32-pkg-config --static --libs zlib) -Wl,-Bdynamic" PNG_PE_CFLAGS="$(x86_64-w64-mingw32-pkg-config --cflags libpng16)" PNG_PE_LIBS="-Wl,-Bstatic $(x86_64-w64-mingw32-pkg-config --static --libs libpng16) -lmingwex -lmingw32 -Wl,-Bdynamic"
Patches 5-6 are necessary to allow static linking of libpng16.
I don't think that's going to work in general. The linked C runtime needs to match the version that was used when compiling.