NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.38k stars 14.33k forks source link

Libjpeg build fails on mingw due to `__attribute__((weak))` patch #178863

Open maj0e opened 2 years ago

maj0e commented 2 years ago

Steps To Reproduce

Cross-compiling libjpeg for mingwW64 and mingw32 fails with undefined references:

nix-build "<nixpkgs>" -A pkgsCross.mingwW64.libjpeg

or

nix-build "<nixpkgs>" -A pkgsCross.mingw32.libjpeg

Build log

mjoerg@DMZ044:~/Development/MCSoftware/rfpcrt_legacy$ nix-build "<nixpkgs>" -A pkgsCross.mingw32.libjpeg
this derivation will be built:
  /nix/store/mx5qhmkqyjcl3vj9aanbi9zzpyrmxy5y-libjpeg-turbo-i686-w64-mingw32-2.1.3.drv
building '/nix/store/mx5qhmkqyjcl3vj9aanbi9zzpyrmxy5y-libjpeg-turbo-i686-w64-mingw32-2.1.3.drv'...
unpacking sources
unpacking source archive /nix/store/vqw1xzn093z53ssxzgdljrkyn7qgg311-source
source root is source
patching sources
applying patch /nix/store/njzhjvw048dpycza6qfacgvsri98b8dd-0001-Compile-transupp.c-as-part-of-the-library.patch
patching file CMakeLists.txt
Hunk #1 succeeded at 544 (offset 11 lines).
Hunk #2 succeeded at 1515 (offset 26 lines).
patching file transupp.c
Hunk #1 succeeded at 1388 (offset 2 lines).
Hunk #2 succeeded at 1488 (offset 2 lines).
Hunk #3 succeeded at 2035 (offset 2 lines).
Hunk #4 succeeded at 2154 (offset 2 lines).
Hunk #5 succeeded at 2266 (offset 2 lines).
Hunk #6 succeeded at 2305 (offset 2 lines).
Hunk #7 succeeded at 2337 (offset 6 lines).
applying patch /nix/store/xqqvlnh2lpjv0xp5jjx3mc7hbbdn2b49-mingw-boolean.patch
patching file jmorecfg.h
Hunk #1 succeeded at 199 with fuzz 1 (offset -25 lines).
configuring
fixing cmake files...
cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/xlpgsmga7k2r43hy50cx17skkisd3piy-libjpeg-turbo-i686-w64-mingw32-2.1.3/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/xlpgsmga7k2r43hy50cx17skkisd3piy-libjpeg-turbo-i686-w64-mingw32-2.1.3/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/xlpgsmga7k2r43hy50cx17skkisd3piy-libjpeg-turbo-i686-w64-mingw32-2.1.3/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/53k49545pv4fv21nq76ihwq545l6v7kh-libjpeg-turbo-i686-w64-mingw32-2.1.3-doc/share/doc/libjpeg-turbo -DCMAKE_INSTALL_INFODIR=/nix/store/3fd7ql60vzd647spk06g8vjjn86jbx78-libjpeg-turbo-i686-w64-mingw32-2.1.3-bin/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/q9vr90dnp4666d0l5p6f9agqasbwmdcc-libjpeg-turbo-i686-w64-mingw32-2.1.3-man/share/man -DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/k9izyiw7dfyadvrrk6lv6pkqdnyk3d21-libjpeg-turbo-i686-w64-mingw32-2.1.3-dev/include -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/k9izyiw7dfyadvrrk6lv6pkqdnyk3d21-libjpeg-turbo-i686-w64-mingw32-2.1.3-dev/include -DCMAKE_INSTALL_SBINDIR=/nix/store/3fd7ql60vzd647spk06g8vjjn86jbx78-libjpeg-turbo-i686-w64-mingw32-2.1.3-bin/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/3fd7ql60vzd647spk06g8vjjn86jbx78-libjpeg-turbo-i686-w64-mingw32-2.1.3-bin/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/xlpgsmga7k2r43hy50cx17skkisd3piy-libjpeg-turbo-i686-w64-mingw32-2.1.3/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_OSX_SYSROOT= -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/4jg6mib2pp2l903xhkzdinwrd3pqr6ip-i686-w64-mingw32-stage-final-gcc-debug-wrapper-10.3.0/bin/i686-w64-mingw32-strip -DCMAKE_RANLIB=/nix/store/5xbypnb27vzlyjcq7cm62hs5kcxhv850-i686-w64-mingw32-binutils-2.38/bin/i686-w64-mingw32-ranlib -DCMAKE_AR=/nix/store/5xbypnb27vzlyjcq7cm62hs5kcxhv850-i686-w64-mingw32-binutils-2.38/bin/i686-w64-mingw32-ar -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++ -DCMAKE_INSTALL_PREFIX=/nix/store/xlpgsmga7k2r43hy50cx17skkisd3piy-libjpeg-turbo-i686-w64-mingw32-2.1.3 -DENABLE_STATIC=0 -DENABLE_SHARED=1 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR=i686 -DCMAKE_HOST_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_PROCESSOR=x86_64 
-- The C compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /nix/store/4jg6mib2pp2l903xhkzdinwrd3pqr6ip-i686-w64-mingw32-stage-final-gcc-debug-wrapper-10.3.0/bin/i686-w64-mingw32-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- CMAKE_BUILD_TYPE = Release
-- VERSION = 2.1.3, BUILD = 19800101
-- 32-bit build (i386)
-- CMAKE_INSTALL_PREFIX = /nix/store/xlpgsmga7k2r43hy50cx17skkisd3piy-libjpeg-turbo-i686-w64-mingw32-2.1.3
-- CMAKE_INSTALL_BINDIR = /nix/store/3fd7ql60vzd647spk06g8vjjn86jbx78-libjpeg-turbo-i686-w64-mingw32-2.1.3-bin/bin
-- CMAKE_INSTALL_DATAROOTDIR = share (/nix/store/xlpgsmga7k2r43hy50cx17skkisd3piy-libjpeg-turbo-i686-w64-mingw32-2.1.3/share)
-- CMAKE_INSTALL_DOCDIR = /nix/store/53k49545pv4fv21nq76ihwq545l6v7kh-libjpeg-turbo-i686-w64-mingw32-2.1.3-doc/share/doc/libjpeg-turbo
-- CMAKE_INSTALL_INCLUDEDIR = /nix/store/k9izyiw7dfyadvrrk6lv6pkqdnyk3d21-libjpeg-turbo-i686-w64-mingw32-2.1.3-dev/include
-- CMAKE_INSTALL_LIBDIR = /nix/store/xlpgsmga7k2r43hy50cx17skkisd3piy-libjpeg-turbo-i686-w64-mingw32-2.1.3/lib
-- Shared libraries enabled (ENABLE_SHARED = 1)
-- Static libraries disabled (ENABLE_STATIC = 0)
-- 12-bit JPEG support disabled (WITH_12BIT = 0)
-- Arithmetic decoding support enabled (WITH_ARITH_DEC = 1)
-- Arithmetic encoding support enabled (WITH_ARITH_ENC = 1)
-- TurboJPEG API library enabled (WITH_TURBOJPEG = 1)
-- TurboJPEG Java wrapper disabled (WITH_JAVA = 0)
-- In-memory source/destination managers enabled (WITH_MEM_SRCDST = 1)
-- Emulating libjpeg API/ABI v6.2 (WITH_JPEG7 = 0, WITH_JPEG8 = 0)
-- libjpeg API shared library version = 62.3.0
-- Compiler flags =  -O3 -DNDEBUG
-- Linker flags =  
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of size_t
-- Check size of size_t - done
-- Check size of unsigned long
-- Check size of unsigned long - done
-- Performing Test HAVE_BUILTIN_CTZL
-- Performing Test HAVE_BUILTIN_CTZL - Success
-- Performing Test INLINE_WORKS
-- Performing Test INLINE_WORKS - Success
-- INLINE = __inline__ __attribute__((always_inline)) (FORCE_INLINE = 1)
-- Performing Test HAVE_THREAD_LOCAL
-- Performing Test HAVE_THREAD_LOCAL - Success
-- THREAD_LOCAL = __thread
-- CMAKE_EXECUTABLE_SUFFIX = .exe
-- Looking for a ASM_NASM compiler
-- Looking for a ASM_NASM compiler - /nix/store/70ij88lq47r2vvag86jk07nwifna5rd2-nasm-2.15.05/bin/nasm
-- The ASM_NASM compiler identification is NASM
-- Found assembler: /nix/store/70ij88lq47r2vvag86jk07nwifna5rd2-nasm-2.15.05/bin/nasm
-- CMAKE_ASM_NASM_COMPILER = /nix/store/70ij88lq47r2vvag86jk07nwifna5rd2-nasm-2.15.05/bin/nasm
-- CMAKE_ASM_NASM_OBJECT_FORMAT = win32
-- CMAKE_ASM_NASM_FLAGS =  -DWIN32 
-- SIMD extensions: i386 (WITH_SIMD = 1)
-- FLOATTEST = sse
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_TESTING
    CMAKE_CXX_COMPILER
    CMAKE_EXPORT_NO_PACKAGE_REGISTRY
    CMAKE_FIND_USE_PACKAGE_REGISTRY
    CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY

-- Build files have been written to: /build/source/build
cmake: enabled parallel building
building
build flags: -j24 -l24 SHELL=/nix/store/zwjm0gln1vk7x1akpyz0yxjsd1yc46gi-bash-5.1-p16/bin/bash
[  1%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jfdctflt-3dn.asm.obj
[  2%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jdcolor-mmx.asm.obj
[  3%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jquant-3dn.asm.obj
[  3%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jsimdcpu.asm.obj
[  4%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jdsample-mmx.asm.obj
[  4%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jccolor-mmx.asm.obj
[  4%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jdmerge-mmx.asm.obj
[  4%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jidctfst-mmx.asm.obj
[  4%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jidctflt-3dn.asm.obj
[  5%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jidctred-mmx.asm.obj
[  5%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jfdctflt-sse.asm.obj
[  5%] Building C object md5/CMakeFiles/md5cmp.dir/md5.c.obj
[  5%] Building C object md5/CMakeFiles/md5cmp.dir/md5cmp.c.obj
[  7%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jidctflt-sse.asm.obj
[  7%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jfdctint-mmx.asm.obj
[  8%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jcgray-mmx.asm.obj
[  8%] Building C object CMakeFiles/wrjpgcom.dir/wrjpgcom.c.obj
[  8%] Building C object CMakeFiles/strtest.dir/strtest.c.obj
[  8%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jcsample-mmx.asm.obj
[  9%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jidctint-mmx.asm.obj
[  9%] Building C object CMakeFiles/rdjpgcom.dir/rdjpgcom.c.obj
[  9%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jfdctfst-mmx.asm.obj
[ 10%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jquant-mmx.asm.obj
[ 10%] Building C object md5/CMakeFiles/md5cmp.dir/md5hl.c.obj
[ 10%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jquant-sse.asm.obj
[ 11%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jccolor-sse2.asm.obj
[ 11%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jcgray-sse2.asm.obj
[ 12%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jcphuff-sse2.asm.obj
[ 13%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jdcolor-sse2.asm.obj
[ 13%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jcsample-sse2.asm.obj
[ 14%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jdsample-sse2.asm.obj
[ 15%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jfdctint-sse2.asm.obj
[ 12%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jchuff-sse2.asm.obj
[ 15%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jdmerge-sse2.asm.obj
[ 15%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jfdctfst-sse2.asm.obj
[ 16%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jidctfst-sse2.asm.obj
[ 16%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jidctflt-sse2.asm.obj
[ 16%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jidctint-sse2.asm.obj
[ 16%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jquantf-sse2.asm.obj
[ 17%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jidctred-sse2.asm.obj
[ 17%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jccolor-avx2.asm.obj
[ 18%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jquanti-sse2.asm.obj
[ 18%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jcsample-avx2.asm.obj
[ 19%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jcgray-avx2.asm.obj
[ 20%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jdcolor-avx2.asm.obj
[ 20%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jdmerge-avx2.asm.obj
[ 21%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jdsample-avx2.asm.obj
[ 21%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jfdctint-avx2.asm.obj
[ 22%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jidctint-avx2.asm.obj
[ 22%] Building ASM_NASM object simd/CMakeFiles/simd.dir/i386/jquanti-avx2.asm.obj
[ 23%] Building C object simd/CMakeFiles/simd.dir/i386/jsimd.c.obj
[ 24%] Linking C executable strtest.exe
[ 25%] Linking C executable md5cmp.exe
[ 26%] Linking C executable rdjpgcom.exe
[ 27%] Linking C executable wrjpgcom.exe
[ 27%] Built target strtest
[ 27%] Built target md5cmp
[ 27%] Built target rdjpgcom
[ 27%] Built target wrjpgcom
[ 27%] Built target simd
[ 27%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcapimin.c.obj
[ 27%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcicc.c.obj
[ 28%] Building C object CMakeFiles/turbojpeg.dir/jccolor.c.obj
[ 28%] Building C object CMakeFiles/turbojpeg.dir/jcapimin.c.obj
[ 28%] Building C object CMakeFiles/turbojpeg.dir/jcdctmgr.c.obj
[ 28%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcmainct.c.obj
[ 29%] Building C object CMakeFiles/turbojpeg.dir/jcapistd.c.obj
[ 30%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jchuff.c.obj
[ 30%] Building C object CMakeFiles/turbojpeg.dir/jccoefct.c.obj
[ 30%] Building C object CMakeFiles/turbojpeg.dir/jcmaster.c.obj
[ 31%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jccolor.c.obj
[ 31%] Building C object CMakeFiles/turbojpeg.dir/jcmainct.c.obj
[ 32%] Building C object CMakeFiles/turbojpeg.dir/jcinit.c.obj
[ 32%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcmaster.c.obj
[ 33%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jccoefct.c.obj
[ 33%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcinit.c.obj
[ 34%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcapistd.c.obj
[ 36%] Building C object CMakeFiles/turbojpeg.dir/jcmarker.c.obj
[ 36%] Building C object CMakeFiles/turbojpeg.dir/jchuff.c.obj
[ 36%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcdctmgr.c.obj
[ 37%] Building C object CMakeFiles/turbojpeg.dir/jcicc.c.obj
[ 37%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcmarker.c.obj
[ 38%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcomapi.c.obj
[ 39%] Building C object CMakeFiles/turbojpeg.dir/jcomapi.c.obj
[ 39%] Building C object CMakeFiles/turbojpeg.dir/jcparam.c.obj
[ 40%] Building C object CMakeFiles/turbojpeg.dir/jcphuff.c.obj
[ 41%] Building C object CMakeFiles/turbojpeg.dir/jcsample.c.obj
[ 41%] Building C object CMakeFiles/turbojpeg.dir/jcprepct.c.obj
[ 41%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcparam.c.obj
[ 42%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcphuff.c.obj
[ 42%] Building C object CMakeFiles/turbojpeg.dir/jctrans.c.obj
[ 42%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcprepct.c.obj
[ 43%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcsample.c.obj
[ 44%] Building C object CMakeFiles/turbojpeg.dir/jdapimin.c.obj
[ 44%] Building C object CMakeFiles/turbojpeg.dir/jdapistd.c.obj
[ 45%] Building C object CMakeFiles/turbojpeg.dir/jdatadst.c.obj
[ 45%] Building C object CMakeFiles/turbojpeg.dir/jdatasrc.c.obj
[ 45%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jctrans.c.obj
[ 46%] Building C object CMakeFiles/turbojpeg.dir/jdcoefct.c.obj
[ 46%] Building C object CMakeFiles/turbojpeg.dir/jdcolor.c.obj
[ 47%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdapimin.c.obj
[ 48%] Building C object CMakeFiles/turbojpeg.dir/jddctmgr.c.obj
[ 48%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdapistd.c.obj
[ 48%] Building C object CMakeFiles/turbojpeg.dir/jdhuff.c.obj
[ 49%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdatadst.c.obj
[ 50%] Building C object CMakeFiles/turbojpeg.dir/jdicc.c.obj
[ 50%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdatasrc.c.obj
[ 50%] Building C object CMakeFiles/turbojpeg.dir/jdinput.c.obj
[ 51%] Building C object CMakeFiles/turbojpeg.dir/jdmainct.c.obj
[ 52%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdcoefct.c.obj
[ 52%] Building C object CMakeFiles/turbojpeg.dir/jdmarker.c.obj
[ 52%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdcolor.c.obj
[ 54%] Building C object CMakeFiles/turbojpeg.dir/jdmaster.c.obj
[ 54%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jddctmgr.c.obj
[ 54%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdhuff.c.obj
[ 54%] Building C object CMakeFiles/turbojpeg.dir/jdmerge.c.obj
[ 55%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdicc.c.obj
[ 55%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdinput.c.obj
[ 56%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdmainct.c.obj
[ 57%] Building C object CMakeFiles/turbojpeg.dir/jdphuff.c.obj
[ 57%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdmarker.c.obj
[ 57%] Building C object CMakeFiles/turbojpeg.dir/jdpostct.c.obj
[ 58%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdmaster.c.obj
[ 59%] Building C object CMakeFiles/turbojpeg.dir/jdsample.c.obj
[ 59%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdmerge.c.obj
[ 59%] Building C object CMakeFiles/turbojpeg.dir/jdtrans.c.obj
[ 60%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdphuff.c.obj
[ 60%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdpostct.c.obj
[ 61%] Building C object CMakeFiles/turbojpeg.dir/jerror.c.obj
[ 62%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdsample.c.obj
[ 62%] Building C object CMakeFiles/turbojpeg.dir/jfdctflt.c.obj
[ 63%] Building C object CMakeFiles/turbojpeg.dir/jfdctfst.c.obj
[ 63%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdtrans.c.obj
[ 64%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jerror.c.obj
[ 64%] Building C object CMakeFiles/turbojpeg.dir/jfdctint.c.obj
[ 64%] Building C object CMakeFiles/turbojpeg.dir/jidctfst.c.obj
[ 65%] Building C object CMakeFiles/turbojpeg.dir/jidctflt.c.obj
[ 65%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jfdctflt.c.obj
[ 66%] Building C object CMakeFiles/turbojpeg.dir/jidctint.c.obj
[ 66%] Building C object CMakeFiles/turbojpeg.dir/jidctred.c.obj
[ 67%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jfdctfst.c.obj
[ 68%] Building C object CMakeFiles/turbojpeg.dir/jquant1.c.obj
[ 68%] Building C object CMakeFiles/turbojpeg.dir/jquant2.c.obj
[ 69%] Building C object CMakeFiles/turbojpeg.dir/jutils.c.obj
[ 69%] Building C object CMakeFiles/turbojpeg.dir/jmemmgr.c.obj
[ 70%] Building C object CMakeFiles/turbojpeg.dir/jmemnobs.c.obj
[ 70%] Building C object CMakeFiles/turbojpeg.dir/transupp.c.obj
[ 70%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jfdctint.c.obj
[ 71%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jidctflt.c.obj
[ 71%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jidctfst.c.obj
[ 72%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jidctint.c.obj
[ 72%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jidctred.c.obj
[ 73%] Building C object CMakeFiles/turbojpeg.dir/jaricom.c.obj
[ 74%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jquant1.c.obj
[ 74%] Building C object CMakeFiles/turbojpeg.dir/jcarith.c.obj
[ 75%] Building C object CMakeFiles/turbojpeg.dir/jdarith.c.obj
[ 75%] Building C object CMakeFiles/turbojpeg.dir/turbojpeg.c.obj
[ 76%] Building C object CMakeFiles/turbojpeg.dir/jdatadst-tj.c.obj
[ 76%] Building C object CMakeFiles/turbojpeg.dir/jdatasrc-tj.c.obj
[ 76%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jquant2.c.obj
[ 77%] Building C object CMakeFiles/turbojpeg.dir/rdbmp.c.obj
[ 78%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jutils.c.obj
[ 78%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jmemmgr.c.obj
[ 79%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jmemnobs.c.obj
[ 79%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/transupp.c.obj
[ 79%] Building C object CMakeFiles/turbojpeg.dir/rdppm.c.obj
[ 80%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jaricom.c.obj
[ 81%] Building C object CMakeFiles/turbojpeg.dir/wrbmp.c.obj
[ 81%] Building C object CMakeFiles/turbojpeg.dir/wrppm.c.obj
[ 81%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jcarith.c.obj
[ 82%] Building C object sharedlib/CMakeFiles/jpeg.dir/__/jdarith.c.obj
[ 83%] Linking C shared library libturbojpeg.dll
[ 83%] Linking C shared library ../libjpeg-62.dll
/nix/store/5xbypnb27vzlyjcq7cm62hs5kcxhv850-i686-w64-mingw32-binutils-2.38/bin/i686-w64-mingw32-ld: CMakeFiles/turbojpeg.dir/objects.a(turbojpeg.c.obj):turbojpeg.c:(.text+0x72a1): undefined reference to `jcopy_markers_setup'
/nix/store/5xbypnb27vzlyjcq7cm62hs5kcxhv850-i686-w64-mingw32-binutils-2.38/bin/i686-w64-mingw32-ld: CMakeFiles/turbojpeg.dir/objects.a(turbojpeg.c.obj):turbojpeg.c:(.text+0x7335): undefined reference to `jtransform_request_workspace'
/nix/store/5xbypnb27vzlyjcq7cm62hs5kcxhv850-i686-w64-mingw32-binutils-2.38/bin/i686-w64-mingw32-ld: CMakeFiles/turbojpeg.dir/objects.a(turbojpeg.c.obj):turbojpeg.c:(.text+0x758a): undefined reference to `jtransform_adjust_parameters'
/nix/store/5xbypnb27vzlyjcq7cm62hs5kcxhv850-i686-w64-mingw32-binutils-2.38/bin/i686-w64-mingw32-ld: CMakeFiles/turbojpeg.dir/objects.a(turbojpeg.c.obj):turbojpeg.c:(.text+0x75ed): undefined reference to `jcopy_markers_execute'
/nix/store/5xbypnb27vzlyjcq7cm62hs5kcxhv850-i686-w64-mingw32-binutils-2.38/bin/i686-w64-mingw32-ld: CMakeFiles/turbojpeg.dir/objects.a(turbojpeg.c.obj):turbojpeg.c:(.text+0x760d): undefined reference to `jtransform_execute_transform'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/turbojpeg.dir/build.make:1176: libturbojpeg.dll] Error 1
make[1]: *** [CMakeFiles/Makefile2:164: CMakeFiles/turbojpeg.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 83%] Built target jpeg
make: *** [Makefile:146: all] Error 2
error: builder for '/nix/store/mx5qhmkqyjcl3vj9aanbi9zzpyrmxy5y-libjpeg-turbo-i686-w64-mingw32-2.1.3.drv' failed with exit code 2

Additional context

While cross-compiling embree2 statically for mingwW64, I encountered that the build already fails for its dependency libjpeg, with an undefined reference to some functions. I saw that the patch 0001-Compile-transupp.c-as-part-of-the-library.patch is applied to make these functions part of the library. The additional attribute((weak)) attribute is assigned to these function declarations in this patch, which according to this isn't supported by mingw. Therefore the build fails at the linking stage.

Unfortunately I don't know of a mingw specific fix or workaround.

Notify maintainers

Maintainers: @vcunat @colemickens @kamadorueda

Author of the mentioned patch: @L-as

Metadata

mjoerg@DMZ044:~/Development/MCSoftware/rfpcrt_legacy$ nix-shell -p nix-info --run "nix-info -m"
this path will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/ym48rw2727g45akp4bd6bgng9wwil5y5-nix-info
copying path '/nix/store/ym48rw2727g45akp4bd6bgng9wwil5y5-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 5.13.0-51-generic, Ubuntu, 20.04.4 LTS (Focal Fossa), nobuild`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.5.1`
 - channels(mjoerg): `"nixpkgs-22.11pre386147.e0a42267f73"`
 - nixpkgs: `/home/mjoerg/.nix-defexpr/channels/nixpkgs`
ramirez7 commented 1 year ago

I'm running into this too. libjpeg-turbo is a dependency of SDL2_image in my case. I'm not cross-compiling static, but I am cross compiling (nix-build -A pkgsCross.mingwW64.libjpeg_turbo)

I tried editing the patch to not include the __attribute__((weak)) but I still got the same failure.

My overlay & patches can be found in this MR for my project.

L-as commented 1 year ago

IIRC there was a good reason for making it weak. Cant' remember what it was though.