dyne / frei0r

A large collection of free and portable video plugins
https://frei0r.dyne.org/
GNU General Public License v2.0
419 stars 91 forks source link

filmgrain failed to link on gcc13/msys2/Windows #189

Closed ddennedy closed 1 month ago

ddennedy commented 2 months ago

Using gcc 13.2 from the msys2 project on windows 11, with a cmake build type of Debug I got the following linking error. The funny paths are from a GitHub Actions-based build.

LOG: About to run command: cmake -DCMAKE_INSTALL_PREFIX=/d/a/shotcut/shotcut/build/Shotcut -DWITHOUT_GAVL=1 -DWITHOUT_OPENCV=1 -GNinja -DCMAKE_BUILD_TYPE=Debug
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.

CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
...

[69/305] Linking C shared module src\filter\filmgrain\filmgrain.dll
FAILED: src/filter/filmgrain/filmgrain.dll 
C:\Windows\system32\cmd.exe /C "cd . && D:\a\_temp\msys64\mingw64\bin\cc.exe -g   -shared -o src\filter\filmgrain\filmgrain.dll -Wl,--major-image-version,0,--minor-image-version,0 src/filter/filmgrain/CMakeFiles/filmgrain.dir/filmgrain.c.obj  -lm  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/filter/filmgrain/CMakeFiles/filmgrain.dir/filmgrain.c.obj: in function `f0r_update':
D:/a/_temp/msys64/home/runneradmin/build/src/frei0r/src/filter/filmgrain/filmgrain.c:225:(.text+0x4ea): undefined reference to `random_range_uint8'
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/_temp/msys64/home/runneradmin/build/src/frei0r/src/filter/filmgrain/filmgrain.c:226:(.text+0x53d): undefined reference to `random_range_uint8'
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/_temp/msys64/home/runneradmin/build/src/frei0r/src/filter/filmgrain/filmgrain.c:262:(.text+0x633): undefined reference to `reduce_color_range'
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/_temp/msys64/home/runneradmin/build/src/frei0r/src/filter/filmgrain/filmgrain.c:263:(.text+0x661): undefined reference to `reduce_color_range'
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/_temp/msys64/home/runneradmin/build/src/frei0r/src/filter/filmgrain/filmgrain.c:264:(.text+0x68c): undefined reference to `reduce_color_range'
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/_temp/msys64/home/runneradmin/build/src/frei0r/src/filter/filmgrain/filmgrain.c:266:(.text+0x6ed): undefined reference to `random_range_uint8'
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/_temp/msys64/home/runneradmin/build/src/frei0r/src/filter/filmgrain/filmgrain.c:268:(.text+0x744): undefined reference to `clamp_grain'
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/_temp/msys64/home/runneradmin/build/src/frei0r/src/filter/filmgrain/filmgrain.c:269:(.text+0x79e): undefined reference to `clamp_grain'
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/_temp/msys64/home/runneradmin/build/src/frei0r/src/filter/filmgrain/filmgrain.c:270:(.text+0x7f8): undefined reference to `clamp_grain'
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/_temp/msys64/home/runneradmin/build/src/frei0r/src/filter/filmgrain/filmgrain.c:292:(.text+0x99e): undefined reference to `random_range_uint8'
esmane commented 1 month ago

I'm not using msys2 but it links just fine for me on mingw64 gcc 13.2.

esmane commented 1 month ago

Nevermind I figured it out. The inline functions need to be changed to static inline. For some reason it builds fine on Release as is but fails on Debug with the inline functions.

jaromil commented 1 month ago

should be now fixed by the PR above.