AOMediaCodec / libavif

libavif - Library for encoding and decoding .avif files
Other
1.53k stars 195 forks source link

Can not cross-compile for Windows #2423

Closed vtorri closed 1 month ago

vtorri commented 1 month ago

libavif 1.1.1, libyuv, libaom and dav1d are installed

cmake + make invokation:

rm -rf builddir && mkdir builddir && cd builddir

cmake \
    -DCMAKE_TOOLCHAIN_FILE=../cross_toolchain.txt \
    -DCMAKE_INSTALL_PREFIX=/opt/libavif \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_SHARED_LIBS=TRUE \
    -DAVIF_CODEC_AOM=SYSTEM \
    -DAVIF_CODEC_DAV1D=SYSTEM \
    -DAVIF_BUILD_APPS:BOOL=OFF \
    -G "Unix Makefiles" \
    .. > ../../config.log 2>&1

make -j  install > ../../make.log 2>&1

cmake output:

-- The C compiler identification is GNU 12.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.0") 
-- Checking for module 'libyuv'
--   Found libyuv, version 1840
-- Found libyuv: /home/vtorri/ewpi_64/bin/libyuv.dll (found version "1840") 
-- libavif: libyuv (1895) found; libyuv-based fast paths enabled.
-- libavif: Enabling warnings for GCC
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Checking for module 'dav1d'
--   Found dav1d, version 1.4.3
-- Found dav1d: /home/vtorri/ewpi_64/bin/libdav1d.dll (found version "1.4.3") 
-- libavif: Codec enabled: dav1d (decode)
-- Checking for module 'aom'
--   Found aom, version 3.9.1
-- Found aom: /home/vtorri/ewpi_64/bin/libaom.dll (found version "3.9.1") 
-- libavif: Codec enabled: aom (encode/decode)
-- The CXX compiler identification is GNU 12.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0111 is not set: An imported target missing its location property
  fails during generation.  Run "cmake --help-policy CMP0111" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  IMPORTED_IMPLIB not set for imported target "yuv::yuv" configuration
  "Release".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0111 is not set: An imported target missing its location property
  fails during generation.  Run "cmake --help-policy CMP0111" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  IMPORTED_IMPLIB not set for imported target "aom" configuration "Release".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0111 is not set: An imported target missing its location property
  fails during generation.  Run "cmake --help-policy CMP0111" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  IMPORTED_IMPLIB not set for imported target "yuv::yuv" configuration
  "Release".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0111 is not set: An imported target missing its location property
  fails during generation.  Run "cmake --help-policy CMP0111" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  IMPORTED_IMPLIB not set for imported target "aom" configuration "Release".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /home/vtorri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir

So there are problems with IMPORTED_IMPLIB, I don't know why

compilation fails:

[  4%] Building C object CMakeFiles/avif_obj.dir/src/alpha.c.obj
[  9%] Building C object CMakeFiles/avif_obj.dir/src/avif.c.obj
[ 13%] Building C object CMakeFiles/avif_obj.dir/src/colr.c.obj
[ 18%] Building C object CMakeFiles/avif_obj.dir/src/colrconvert.c.obj
[ 22%] Building C object CMakeFiles/avif_obj.dir/src/diag.c.obj
[ 27%] Building C object CMakeFiles/avif_obj.dir/src/exif.c.obj
[ 31%] Building C object CMakeFiles/avif_obj.dir/src/io.c.obj
[ 36%] Building C object CMakeFiles/avif_obj.dir/src/mem.c.obj
[ 40%] Building C object CMakeFiles/avif_obj.dir/src/obu.c.obj
[ 45%] Building C object CMakeFiles/avif_obj.dir/src/rawdata.c.obj
[ 50%] Building C object CMakeFiles/avif_obj.dir/src/read.c.obj
[ 54%] Building C object CMakeFiles/avif_obj.dir/src/reformat.c.obj
[ 59%] Building C object CMakeFiles/avif_obj.dir/src/reformat_libsharpyuv.c.obj
[ 63%] Building C object CMakeFiles/avif_obj.dir/src/reformat_libyuv.c.obj
[ 68%] Building C object CMakeFiles/avif_obj.dir/src/scale.c.obj
[ 72%] Building C object CMakeFiles/avif_obj.dir/src/stream.c.obj
[ 77%] Building C object CMakeFiles/avif_obj.dir/src/utils.c.obj
[ 81%] Building C object CMakeFiles/avif_obj.dir/src/write.c.obj
[ 86%] Building C object CMakeFiles/avif_obj.dir/src/codec_dav1d.c.obj
[ 90%] Building C object CMakeFiles/avif_obj.dir/src/codec_aom.c.obj
[ 90%] Built target avif_obj
CMakeFiles/avif.dir/build.make:119: *** le motif de cible ne contient pas « % ». Arrêt.
make[1]: *** [CMakeFiles/Makefile2:144 : CMakeFiles/avif.dir/all] Erreur 2
make[1]: *** Attente des tâches non terminées....
[ 95%] Linking C static library libavif_internal.a
[ 95%] Built target avif_internal
make: *** [Makefile:136 : all] Erreur 2

indeed in CMakeFiles/avif.dir/build.make line 118 and later:

libavif.dll: CMakeFiles/avif.dir/build.make
libavif.dll: yuv::yuv-NOTFOUND
libavif.dll: /home/vtorri/ewpi_64/bin/libdav1d.dll
libavif.dll: aom-NOTFOUND
libavif.dll: CMakeFiles/avif.dir/linkLibs.rsp

I have no idea why it fails and what to do to fix this issue

y-guyon commented 1 month ago

Thank you for reporting this issue.

It sounds like the following is missing IMPORTED_IMPLIB definition:

https://github.com/AOMediaCodec/libavif/blob/db72bb1313a637f9c3aeaf56e3bac43f22254d2d/cmake/Modules/Findlibyuv.cmake#L66

Would the following work for each of the problematic dependencies?

set_target_properties(yuv::yuv
                      PROPERTIES
                        IMPORTED_LOCATION "${LIBYUV_LIBRARY}"
+                       IMPORTED_IMPLIB "/home/vtorri/ewpi_64/bin/libyuv.lib"
                        IMPORTED_SONAME yuv)
vtorri commented 1 month ago

I have to do the same for aom, and the directory is lib, not bin. It would also be nice to remove the full path, but I don't know how to do that.

vtorri commented 1 month ago

actually, doing like Finddav1d.cmake seems to work:

IMPORTED_IMPLIB "${AOM_LIBRARY}")
IMPORTED_IMPLIB "${LIBYUV_LIBRARY}"
y-guyon commented 1 month ago

I have to do the same for aom, and the directory is lib, not bin.

Thanks for trying the solution.

It would also be nice to remove the full path

Yes, I just wanted to check if that was the right fix. We will adapt it into a proper patch soon.

wantehchang commented 4 weeks ago

@vtorri Could you run the make command in verbose mode

make -j VERBOSE=1 install > ../../make.log 2>&1

and post the command line that builds libavif.dll here?

I'd like to see what pathnames of libaom and libyuv are used as inputs when building libavif.dll. Thank you!

vtorri commented 4 weeks ago
[1/23] Building C object CMakeFiles/avif_obj.dir/src/mem.c.obj
[2/23] Building C object CMakeFiles/avif_obj.dir/src/diag.c.obj
[3/23] Building C object CMakeFiles/avif_obj.dir/src/rawdata.c.obj
[4/23] Building C object CMakeFiles/avif_obj.dir/src/io.c.obj
[5/23] Building C object CMakeFiles/avif_obj.dir/src/exif.c.obj
[6/23] Building C object CMakeFiles/avif_obj.dir/src/colrconvert.c.obj
[7/23] Building C object CMakeFiles/avif_obj.dir/src/reformat_libsharpyuv.c.obj
[8/23] Building C object CMakeFiles/avif_obj.dir/src/obu.c.obj
[9/23] Building C object CMakeFiles/avif_obj.dir/src/alpha.c.obj
[10/23] Building C object CMakeFiles/avif_obj.dir/src/colr.c.obj
[11/23] Building C object CMakeFiles/avif_obj.dir/src/scale.c.obj
[12/23] Building C object CMakeFiles/avif_obj.dir/src/codec_dav1d.c.obj
[13/23] Building C object CMakeFiles/avif_obj.dir/src/utils.c.obj
[14/23] Building C object CMakeFiles/avif_obj.dir/src/avif.c.obj
[15/23] Building C object CMakeFiles/avif_obj.dir/src/reformat_libyuv.c.obj
[16/23] Building C object CMakeFiles/avif_obj.dir/src/stream.c.obj
[17/23] Building C object CMakeFiles/avif_obj.dir/src/codec_aom.c.obj
[18/23] Building C object CMakeFiles/avif_obj.dir/src/write.c.obj
[19/23] Building C object CMakeFiles/avif_obj.dir/src/read.c.obj
[20/23] Building C object CMakeFiles/avif_obj.dir/src/reformat.c.obj
[21/23] Linking C static library libavif_internal.a
[22/23] Linking CXX shared library libavif.dll
[22/23] Install the project...
-- Install configuration: "Release"
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/libavif.dll.a
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/bin/libavif.dll
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/cmake/libavif/libavif-config.cmake
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/cmake/libavif/libavif-config-release.cmake
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/cmake/libavif/libavif-config-version.cmake
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/pkgconfig/libavif.pc
-- Up-to-date: C:/Documents/msys2/home/vincent.torri/ewpi_64/include/avif/avif.h
-- Up-to-date: C:/Documents/msys2/home/vincent.torri/ewpi_64/include/avif/avif_cxx.h
vtorri commented 4 weeks ago

the result above is with the patch of course

wantehchang commented 4 weeks ago

@vtorri Yes, I'd like the build output with the patch. You did not pass VERBOSE=1 to the make command. Could you try this again with VERBOSE=1? Here is the exact make command line:

make -j VERBOSE=1 install > ../../make.log 2>&1
vtorri commented 4 weeks ago

oupsss sorry

C:/Documents/msys2/mingw64/bin/cmake.exe -SC:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1 -BC:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir --check-build-system CMakeFiles/Makefile.cmake 0
C:/Documents/msys2/mingw64/bin/cmake.exe -E cmake_progress_start C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir/CMakeFiles C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir//CMakeFiles/progress.marks
make  -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
make  -f CMakeFiles/avif_obj.dir/build.make CMakeFiles/avif_obj.dir/depend
make[2]: Entering directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
C:/Documents/msys2/mingw64/bin/cmake.exe -E cmake_depends "Unix Makefiles" C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1 C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1 C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir/CMakeFiles/avif_obj.dir/DependInfo.cmake "--color="
make[2]: Leaving directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
make  -f CMakeFiles/avif_obj.dir/build.make CMakeFiles/avif_obj.dir/build
make[2]: Entering directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
[  4%] Building C object CMakeFiles/avif_obj.dir/src/alpha.c.obj
[  9%] Building C object CMakeFiles/avif_obj.dir/src/avif.c.obj
[ 13%] Building C object CMakeFiles/avif_obj.dir/src/colr.c.obj
[ 18%] Building C object CMakeFiles/avif_obj.dir/src/colrconvert.c.obj
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/alpha.c.obj -MF CMakeFiles/avif_obj.dir/src/alpha.c.obj.d -o CMakeFiles/avif_obj.dir/src/alpha.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/alpha.c
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/avif.c.obj -MF CMakeFiles/avif_obj.dir/src/avif.c.obj.d -o CMakeFiles/avif_obj.dir/src/avif.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/avif.c
[ 22%] Building C object CMakeFiles/avif_obj.dir/src/diag.c.obj
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/colr.c.obj -MF CMakeFiles/avif_obj.dir/src/colr.c.obj.d -o CMakeFiles/avif_obj.dir/src/colr.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/colr.c
[ 27%] Building C object CMakeFiles/avif_obj.dir/src/exif.c.obj
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/colrconvert.c.obj -MF CMakeFiles/avif_obj.dir/src/colrconvert.c.obj.d -o CMakeFiles/avif_obj.dir/src/colrconvert.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/colrconvert.c
[ 31%] Building C object CMakeFiles/avif_obj.dir/src/io.c.obj
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/diag.c.obj -MF CMakeFiles/avif_obj.dir/src/diag.c.obj.d -o CMakeFiles/avif_obj.dir/src/diag.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/diag.c
[ 36%] Building C object CMakeFiles/avif_obj.dir/src/mem.c.obj
[ 40%] Building C object CMakeFiles/avif_obj.dir/src/obu.c.obj
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/exif.c.obj -MF CMakeFiles/avif_obj.dir/src/exif.c.obj.d -o CMakeFiles/avif_obj.dir/src/exif.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/exif.c
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/io.c.obj -MF CMakeFiles/avif_obj.dir/src/io.c.obj.d -o CMakeFiles/avif_obj.dir/src/io.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/io.c
[ 45%] Building C object CMakeFiles/avif_obj.dir/src/rawdata.c.obj
[ 50%] Building C object CMakeFiles/avif_obj.dir/src/read.c.obj
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/mem.c.obj -MF CMakeFiles/avif_obj.dir/src/mem.c.obj.d -o CMakeFiles/avif_obj.dir/src/mem.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/mem.c
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/read.c.obj -MF CMakeFiles/avif_obj.dir/src/read.c.obj.d -o CMakeFiles/avif_obj.dir/src/read.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/read.c
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/obu.c.obj -MF CMakeFiles/avif_obj.dir/src/obu.c.obj.d -o CMakeFiles/avif_obj.dir/src/obu.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/obu.c
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/rawdata.c.obj -MF CMakeFiles/avif_obj.dir/src/rawdata.c.obj.d -o CMakeFiles/avif_obj.dir/src/rawdata.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/rawdata.c
[ 54%] Building C object CMakeFiles/avif_obj.dir/src/reformat.c.obj
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/reformat.c.obj -MF CMakeFiles/avif_obj.dir/src/reformat.c.obj.d -o CMakeFiles/avif_obj.dir/src/reformat.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/reformat.c
[ 59%] Building C object CMakeFiles/avif_obj.dir/src/reformat_libsharpyuv.c.obj
[ 63%] Building C object CMakeFiles/avif_obj.dir/src/reformat_libyuv.c.obj
[ 68%] Building C object CMakeFiles/avif_obj.dir/src/stream.c.obj
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/reformat_libyuv.c.obj -MF CMakeFiles/avif_obj.dir/src/reformat_libyuv.c.obj.d -o CMakeFiles/avif_obj.dir/src/reformat_libyuv.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/reformat_libyuv.c
[ 72%] Building C object CMakeFiles/avif_obj.dir/src/scale.c.obj
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/reformat_libsharpyuv.c.obj -MF CMakeFiles/avif_obj.dir/src/reformat_libsharpyuv.c.obj.d -o CMakeFiles/avif_obj.dir/src/reformat_libsharpyuv.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/reformat_libsharpyuv.c
[ 77%] Building C object CMakeFiles/avif_obj.dir/src/utils.c.obj
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/scale.c.obj -MF CMakeFiles/avif_obj.dir/src/scale.c.obj.d -o CMakeFiles/avif_obj.dir/src/scale.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/scale.c
[ 81%] Building C object CMakeFiles/avif_obj.dir/src/write.c.obj
[ 86%] Building C object CMakeFiles/avif_obj.dir/src/codec_dav1d.c.obj
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/stream.c.obj -MF CMakeFiles/avif_obj.dir/src/stream.c.obj.d -o CMakeFiles/avif_obj.dir/src/stream.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/stream.c
[ 90%] Building C object CMakeFiles/avif_obj.dir/src/codec_aom.c.obj
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/write.c.obj -MF CMakeFiles/avif_obj.dir/src/write.c.obj.d -o CMakeFiles/avif_obj.dir/src/write.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/write.c
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/codec_dav1d.c.obj -MF CMakeFiles/avif_obj.dir/src/codec_dav1d.c.obj.d -o CMakeFiles/avif_obj.dir/src/codec_dav1d.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/codec_dav1d.c
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/utils.c.obj -MF CMakeFiles/avif_obj.dir/src/utils.c.obj.d -o CMakeFiles/avif_obj.dir/src/utils.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/utils.c
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DAVIF_BUILDING_SHARED_LIBS -DAVIF_CODEC_AOM=1 -DAVIF_CODEC_AOM_DECODE=1 -DAVIF_CODEC_AOM_ENCODE=1 -DAVIF_CODEC_DAV1D=1 -DAVIF_DLL -DAVIF_LIBYUV_ENABLED=1 @CMakeFiles/avif_obj.dir/includes_C.rsp -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -std=gnu99 -fvisibility=hidden -Wall -Wextra -MD -MT CMakeFiles/avif_obj.dir/src/codec_aom.c.obj -MF CMakeFiles/avif_obj.dir/src/codec_aom.c.obj.d -o CMakeFiles/avif_obj.dir/src/codec_aom.c.obj -c C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/src/codec_aom.c
make[2]: Leaving directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
[ 90%] Built target avif_obj
make  -f CMakeFiles/avif.dir/build.make CMakeFiles/avif.dir/depend
make  -f CMakeFiles/avif_internal.dir/build.make CMakeFiles/avif_internal.dir/depend
make[2]: Entering directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
C:/Documents/msys2/mingw64/bin/cmake.exe -E cmake_depends "Unix Makefiles" C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1 C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1 C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir/CMakeFiles/avif.dir/DependInfo.cmake "--color="
make[2]: Entering directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
C:/Documents/msys2/mingw64/bin/cmake.exe -E cmake_depends "Unix Makefiles" C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1 C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1 C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir/CMakeFiles/avif_internal.dir/DependInfo.cmake "--color="
make[2]: Leaving directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
make  -f CMakeFiles/avif.dir/build.make CMakeFiles/avif.dir/build
make[2]: Leaving directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
make  -f CMakeFiles/avif_internal.dir/build.make CMakeFiles/avif_internal.dir/build
make[2]: Entering directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
make[2]: Entering directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
[ 95%] Linking CXX shared library libavif.dll
C:/Documents/msys2/mingw64/bin/cmake.exe -E rm -f CMakeFiles/avif.dir/objects.a
[100%] Linking C static library libavif_internal.a
C:/Documents/msys2/mingw64/bin/cmake.exe -P CMakeFiles/avif_internal.dir/cmake_clean_target.cmake
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-ar.exe qc CMakeFiles/avif.dir/objects.a @CMakeFiles/avif.dir/objects1.rsp
C:/Documents/msys2/mingw64/bin/cmake.exe -E cmake_link_script CMakeFiles/avif_internal.dir/link.txt --verbose=1
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-ar.exe qc libavif_internal.a CMakeFiles/avif_obj.dir/src/alpha.c.obj CMakeFiles/avif_obj.dir/src/avif.c.obj CMakeFiles/avif_obj.dir/src/colr.c.obj CMakeFiles/avif_obj.dir/src/colrconvert.c.obj CMakeFiles/avif_obj.dir/src/diag.c.obj CMakeFiles/avif_obj.dir/src/exif.c.obj CMakeFiles/avif_obj.dir/src/io.c.obj CMakeFiles/avif_obj.dir/src/mem.c.obj CMakeFiles/avif_obj.dir/src/obu.c.obj CMakeFiles/avif_obj.dir/src/rawdata.c.obj CMakeFiles/avif_obj.dir/src/read.c.obj CMakeFiles/avif_obj.dir/src/reformat.c.obj CMakeFiles/avif_obj.dir/src/reformat_libsharpyuv.c.obj CMakeFiles/avif_obj.dir/src/reformat_libyuv.c.obj CMakeFiles/avif_obj.dir/src/scale.c.obj CMakeFiles/avif_obj.dir/src/stream.c.obj CMakeFiles/avif_obj.dir/src/utils.c.obj CMakeFiles/avif_obj.dir/src/write.c.obj CMakeFiles/avif_obj.dir/src/codec_dav1d.c.obj CMakeFiles/avif_obj.dir/src/codec_aom.c.obj
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-g++.exe -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -LC:/Documents/msys2/home/vincent.torri/ewpi_64/lib -shared -o libavif.dll -Wl,--out-implib,libavif.dll.a -Wl,--major-image-version,16,--minor-image-version,1 -Wl,--whole-archive CMakeFiles/avif.dir/objects.a -Wl,--no-whole-archive @CMakeFiles/avif.dir/linkLibs.rsp
C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-ranlib.exe libavif_internal.a
make[2]: Leaving directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
[100%] Built target avif_internal
make[2]: Leaving directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
[100%] Built target avif
make[1]: Leaving directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
C:/Documents/msys2/mingw64/bin/cmake.exe -E cmake_progress_start C:/Documents/msys2/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir/CMakeFiles 0
make  -f CMakeFiles/Makefile2 preinstall
make[1]: Entering directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
make[1]: Nothing to be done for 'preinstall'.
make[1]: Leaving directory '/home/vincent.torri/ewpi_64/share/ewpi/packages/libavif/libavif-1.1.1/builddir'
Install the project...
C:/Documents/msys2/mingw64/bin/cmake.exe -P cmake_install.cmake
-- Install configuration: "Release"
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/libavif.dll.a
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/bin/libavif.dll
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/cmake/libavif/libavif-config.cmake
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/cmake/libavif/libavif-config-release.cmake
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/cmake/libavif/libavif-config-version.cmake
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/pkgconfig/libavif.pc
-- Up-to-date: C:/Documents/msys2/home/vincent.torri/ewpi_64/include/avif/avif.h
-- Up-to-date: C:/Documents/msys2/home/vincent.torri/ewpi_64/include/avif/avif_cxx.h
wantehchang commented 4 weeks ago

@vtorri Thanks a lot!

The command that builds libavif.dll is:

C:/Documents/msys2/mingw64/bin/x86_64-w64-mingw32-g++.exe -IC:/Documents/msys2/home/vincent.torri/ewpi_64/include -D__USE_MINGW_ANSI_STDIO=0 -D_WIN32_WINNT=0x0A00 -O2 -pipe -march=native -LC:/Documents/msys2/home/vincent.torri/ewpi_64/lib -shared -o libavif.dll -Wl,--out-implib,libavif.dll.a -Wl,--major-image-version,16,--minor-image-version,1 -Wl,--whole-archive CMakeFiles/avif.dir/objects.a -Wl,--no-whole-archive @CMakeFiles/avif.dir/linkLibs.rsp

It does not have libaom and libyuv as inputs. I guess they are hidden in the CMakeFiles/avif.dir/linkLibs.rsp file. Could you paste the contents of CMakeFiles/avif.dir/linkLibs.rsp?

vtorri commented 4 weeks ago

C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/libyuv.a -lm C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/libdav1d.dll.a C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/libaom.dll.a C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/libvmaf.dll.a C:/Documents/msys2/mingw64/lib/libm.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

wantehchang commented 4 weeks ago

@vtorri Thank you! C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/libyuv.a looks like a static library. Did you install libyuv as a static library?

@y-guyon Yannis: This shows your fix https://github.com/AOMediaCodec/libavif/pull/2425 has the desired effects, even though the IMPORTED_IMPLIB property is not set to the pathname of the import library ("the location of the .lib part of the DLL"). The import libraries, which have the .dll.a suffix instead of the .lib suffix in mingw, are used when building libavif.dll.

vtorri commented 4 weeks ago

there are both shared and static libs:

$ find ~/ewpi_64/{bin,lib} -name "libyuv*"
/home/vincent.torri/ewpi_64/bin/libyuv.dll
/home/vincent.torri/ewpi_64/lib/libyuv.a
/home/vincent.torri/ewpi_64/lib/pkgconfig/libyuv.pc

the import lib of libyuv is missing though

vtorri commented 4 weeks ago

I have installed the import lib of libyuv and here is the content of linkLibs.rsp:

 C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/libyuv.dll.a -lm C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/libdav1d.dll.a C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/libaom.dll.a C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/libvmaf.dll.a C:/Documents/msys2/mingw64/lib/libm.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 

the import lib of libyuv is now used

it seems that libyuv is installing the dll, but not the import lib, i had to do it by hand

wantehchang commented 4 weeks ago

@vtorri Thank you for looking into your libyuv installation. I looked at libyuv's CMakeLists.txt and researched this issue on the Web. I found a relevant StackOverflow article: https://stackoverflow.com/questions/77826068/keep-cmake-from-from-installing-the-import-library-when-installing-a-shared-libr

Based on that StackOverflow article and libaom's build/cmake/aom_install.cmake file, I think we can fix this by adding ARCHIVE DESTINATION lib to this install() command in libyuv's CMakeLists.txt:

install ( TARGETS ${ly_lib_shared} LIBRARY              DESTINATION lib RUNTIME DESTINATION bin )

Could you please give this a try? (See the patch below.)

I also have a question. The title of this issue says "Can not cross-compile for Windows", but I see Windows drive letter C:/ in the pathnames of your build log, so it looks like you are on a Windows computer. Are you cross-compiling (on a Linux or Mac computer) for Windows?

Here is the patch for libyuv's CMakeLists.txt:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a20941d..5223d4c3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -213,7 +213,7 @@ endif()
 # install the conversion tool, .so, .a, and all the header files
 install ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert                      DESTINATION bin )
 install ( TARGETS ${ly_lib_static}                                             DESTINATION lib )
-install ( TARGETS ${ly_lib_shared} LIBRARY                             DESTINATION lib RUNTIME DESTINATION bin )
+install ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib )
 install ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/             DESTINATION include )

 # create the .deb and .rpm packages using cpack
vtorri commented 4 weeks ago

about cross compilation, here are the explanations : i (cross-)compile with msys2 + mingw, with a cross compilation file. When everything works, I create a NSIS installer for a project on linux by cross-compilation in a VM (to avoid viruses). The problem arises in both cases.

I'll try the patch soon, this evening

wantehchang commented 4 weeks ago

Thank you. I have submitted my patch to the libyuv project for approval: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5837740

vtorri commented 4 weeks ago

about libyuv, failure with file not found in cmake_install.cmake line 41 (yuvconvert not found i guess). If I replace yuvconvert with yuvconvert.exe, which exists, it works.

I know nothing about cmake, so if you can find a patch for this.

maybe also add an option to remove the build of the tool would be nice

that's why i prefer meson over cmake, no such hack should be done. You create a shared lib, the import lib is automatically built and installed.

vtorri commented 4 weeks ago

you can also propose a libyuv.pc which version is extracted from include/libyuv/version.h

vtorri commented 4 weeks ago

you can also look at https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-libyuv/cmake-mingw.patch

kmilos commented 4 weeks ago

you can also look at ...

Yep, definitely the right way to do it, and should be upstreamed.

you can also propose a libyuv.pc

Also created in https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-libyuv and should be upstreamed.

wantehchang commented 4 weeks ago

@vtorri @kmilos Thank you both for your comments.

My patch for libyuv has been merged: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5837740

@vtorri Could you please confirm whether it fixed the libyuv.dll.a installation problem for you?

The mingw fix for the libyuv.dll.a installation problem will break the installation of libyuv.so on Unix platforms, if I understand it correctly. So we need to use my patch.

The mingw fix for the yuvconvert installation problem looks correct to me, so we should be able to use that fix.

kmilos commented 4 weeks ago

The mingw fix for the libyuv.dll.a installation problem will break the installation of libyuv.so on Unix platforms, if I understand it correctly. So we need to use my patch.

Indeed, the full cross-platform fix is to specify all of the LIBRARY, ARCHIVE, and RUNTIME for a shared object.

vtorri commented 4 weeks ago

@wantehchang libyuv.dll.a is indeed installed.

it remains the yuvconvert issue.

wantehchang commented 4 weeks ago

@kmilos @vtorri Thank you for reviewing my fix for the libyuv.dll.a installation problem and verifying that it works.

I will try to upstream the fix for the yuvconvert.exe installation problem today or tomorrow.

wantehchang commented 3 weeks ago

I sent a patch to the libyuv project for for the yuvconvert.exe installation problem: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5840469

@kmilos To upstream the libyuv.pc fix in mingw, it would be cleaner to have the original author submit a patch (changelist) to the libyuv project. Alternatively, if you know who the author is, I can try using git --author= to upstream the fix for the author.

vtorri commented 3 weeks ago

your patch was merged. It works:

[ 96%] Linking CXX executable yuvconstants.exe

[ 98%] Linking CXX executable cpuid.exe

[100%] Linking CXX executable yuvconvert.exe

[100%] Built target yuvconstants

[100%] Built target cpuid

[100%] Built target yuvconvert

Install the project...

-- Install configuration: "Release"
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/bin/yuvconvert.exe
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/libyuv.a
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/lib/libyuv.dll.a
-- Installing: C:/Documents/msys2/home/vincent.torri/ewpi_64/bin/libyuv.dll

for libyuv.pc, the last commit was a rename:

https://github.com/msys2/MINGW-packages/commit/a0db2f64990cb2be367cf90c06e211043ed58a14#diff-edfd37efd1c12d520ad8068f9f88faef3abf76bf405814bb419962df696f9ea7

wantehchang commented 3 weeks ago

@vtorri Thank you for testing my libyuv patch! I will try to write libyuv.pc independently.

@kmilos Could you remove the following three lines from mingw-w64-aom/PKGBUILD?

  if [[ "${CARCH}" == "aarch64" ]]; then
      extra_config+=("-DCONFIG_RUNTIME_CPU_DETECT=0")
  fi

Runrtime CPU detection works now for aarch64.

kmilos commented 3 weeks ago

Runrtime CPU detection works now for aarch64.

Done, thanks. Might take some time to propagate...