dbry / WavPack

WavPack encode/decode library, command-line programs, and several plugins
BSD 3-Clause "New" or "Revised" License
371 stars 67 forks source link

Cannot find source file: wavpackdll/wavpackdll.rc #116

Open jonaski opened 2 years ago

jonaski commented 2 years ago

I'm getting the following error when compiling on Windows with MSVC (Visual Studio 2019).

C:\Data\Projects\strawberry\strawberry-dependencies\msvc\sources\wavpack-5.4.0\build>cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="c:\msvc_x86_64" -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DWAVPACK_BUILD_DOCS=OFF -DWAVPACK_BUILD_PROGRAMS=OFF -DWAVPACK_ENABLE_ASM=OFF -DWAVPACK_ENABLE_LEGACY=OFF -DWAVPACK_BUILD_WINAMP_PLUGIN=OFF -DWAVPACK_BUILD_COOLEDIT_PLUGIN=OFF
-- The C compiler identification is MSVC 19.29.30141.0
-- The CXX compiler identification is MSVC 19.29.30141.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for a ASM compiler
-- Looking for a ASM compiler - C:/Strawberry/c/bin/gcc.exe
-- The ASM compiler identification is GNU
-- Found assembler: C:/Strawberry/c/bin/gcc.exe
-- The ASM_MASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/ml64.exe
-- Found OpenSSL: C:/msvc_x86_64/lib/libcrypto.lib (found version "3.0.1")
-- Looking for cos in m
-- Looking for cos in m - not found
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found Iconv: C:/msvc_x86_64/lib/libiconv.lib
-- Could NOT find LibXslt (missing: LIBXSLT_LIBRARIES) (found version "1.1.33")
-- Performing Test HAVE___BUILTIN_CLZ
-- Performing Test HAVE___BUILTIN_CLZ - Failed
-- Checking large files support...
-- 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
-- Checking size of off_t without any definitions:
-- Check size of off_t
-- Check size of off_t - done
-- Checking of off_t without any definitions: 4
-- Checking size of off_t with _FILE_OFFSET_BITS=64:
-- Check size of off_t
-- Check size of off_t - done
-- Checking size of off_t with _FILE_OFFSET_BITS=64: 4
-- Checking size of off_t with _LARGE_FILES:
-- Check size of off_t
-- Check size of off_t - done
-- Checking size of off_t with _LARGE_FILES: 4
-- Checking size of off_t with _LARGEFILE_SOURCE:
-- Check size of off_t
-- Check size of off_t - done
-- Checking size of off_t with _LARGEFILE_SOURCE: 4
Result of checking large files support: not supported
-- Looking for fseeko
-- Looking for fseeko - not found
-- The following features have been enabled:

 * BUILD_SHARED_LIBS, Build shared library.
 * ENABLE_DSD, Enable support for WavPack DSD files.
 * INSTALL_CMAKE_MODULE, Generate and install CMake package configuration module.
 * ENABLE_LIBCRYPTO, Use OpenSSL::Crypto library.
 * INSTALL_DOCS, Install documentation.
 * INSTALL_PKGCONFIG_MODULE, Generate and install wavpack.pc.

-- The following OPTIONAL packages have been found:

 * Threads, Threads library
   Required to build tests.

-- The following RECOMMENDED packages have been found:

 * Iconv, converts from one character encoding to another through Unicode conversion
   Required to build programs.
 * OpenSSL, TLS/SSL and crypto library
   Can be used to build wavpack library.

-- The following features have been disabled:

 * BUILD_TESTING, Build tests.
 * ENABLE_LEGACY, Decode legacy (< 4.0) WavPack files.
 * ENABLE_ASM, Enable assembly optimizations.
 * BUILD_PROGRAMS, Build programs.
 * BUILD_COOLEDIT_PLUGIN, Build CoolEdit plugin.
 * BUILD_WINAMP_PLUGIN, Build WinAmp plugin.
 * BUILD_DOCS, Build documentation.

-- The following OPTIONAL packages have not been found:

 * LibXslt,  XSLT C library developed for the GNOME project.
   Required to generate documentation.

-- Configuring done
CMake Error at CMakeLists.txt:159 (add_library):
  Cannot find source file:

    wavpackdll/wavpackdll.rc

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .h .hh .h++
  .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .ispc

CMake Error at CMakeLists.txt:159 (add_library):
  No SOURCES given to target: wavpack

CMake Generate step failed.  Build files cannot be regenerated correctly.

If I remove "wavpackdll/wavpackdll.rc" from CMakeLists.txt: sed -i '/wavpackdll.rc/d' wavpack-5.4.0/CMakeLists.txt

CMake configuration completes and I end up with a linking error:

C:\Data\Projects\strawberry\strawberry-dependencies\msvc\sources\wavpack-5.4.0\build>cmake --build .
[  4%] Building C object CMakeFiles/wavpack.dir/src/common_utils.c.obj
common_utils.c
[  8%] Building C object CMakeFiles/wavpack.dir/src/decorr_utils.c.obj
decorr_utils.c
[ 12%] Building C object CMakeFiles/wavpack.dir/src/entropy_utils.c.obj
entropy_utils.c
[ 16%] Building C object CMakeFiles/wavpack.dir/src/extra1.c.obj
extra1.c
[ 20%] Building C object CMakeFiles/wavpack.dir/src/extra2.c.obj
extra2.c
[ 25%] Building C object CMakeFiles/wavpack.dir/src/open_utils.c.obj
open_utils.c
[ 29%] Building C object CMakeFiles/wavpack.dir/src/open_filename.c.obj
open_filename.c
[ 33%] Building C object CMakeFiles/wavpack.dir/src/open_legacy.c.obj
open_legacy.c
[ 37%] Building C object CMakeFiles/wavpack.dir/src/open_raw.c.obj
open_raw.c
[ 41%] Building C object CMakeFiles/wavpack.dir/src/pack.c.obj
pack.c
[ 45%] Building C object CMakeFiles/wavpack.dir/src/pack_dns.c.obj
pack_dns.c
[ 50%] Building C object CMakeFiles/wavpack.dir/src/pack_floats.c.obj
pack_floats.c
[ 54%] Building C object CMakeFiles/wavpack.dir/src/pack_utils.c.obj
pack_utils.c
[ 58%] Building C object CMakeFiles/wavpack.dir/src/read_words.c.obj
read_words.c
[ 62%] Building C object CMakeFiles/wavpack.dir/src/tags.c.obj
tags.c
[ 66%] Building C object CMakeFiles/wavpack.dir/src/tag_utils.c.obj
tag_utils.c
[ 70%] Building C object CMakeFiles/wavpack.dir/src/unpack.c.obj
unpack.c
[ 75%] Building C object CMakeFiles/wavpack.dir/src/unpack_floats.c.obj
unpack_floats.c
[ 79%] Building C object CMakeFiles/wavpack.dir/src/unpack_seek.c.obj
unpack_seek.c
[ 83%] Building C object CMakeFiles/wavpack.dir/src/unpack_utils.c.obj
unpack_utils.c
[ 87%] Building C object CMakeFiles/wavpack.dir/src/write_words.c.obj
write_words.c
[ 91%] Building C object CMakeFiles/wavpack.dir/src/pack_dsd.c.obj
pack_dsd.c
[ 95%] Building C object CMakeFiles/wavpack.dir/src/unpack_dsd.c.obj
unpack_dsd.c
[100%] Linking C shared library libwavpackdll.dll
LINK: command "C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\wavpack.dir\objects1.rsp /out:libwavpackdll.dll /implib:libwavpackdll.dll.a /pdb:C:\Data\Projects\strawberry\strawberry-dependencies\msvc\sources\wavpack-5.4.0\build\libwavpackdll.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO libwavpack.def C:\msvc_x86_64\lib\libcrypto.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:libwavpackdll.dll.manifest" failed (exit code 1107) with the following output:
libwavpack.def : fatal error LNK1107: invalid or corrupt file: cannot read at 0x7E9
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.

Removing libwavpack.def from the link command works, but there is no .lib file. (Or removing it from sources here: https://github.com/dbry/WavPack/blob/master/CMakeLists.txt#L337)

I have tried the latest code from git, same issue. Samme issue in GitHub Actions CI.

Another issue is that wavpack.h is installed directly in include instead of include/wavpack

jonaski commented 2 years ago

Never mind the second error, it's caused by gcc being set as ASM compiler

dbry commented 2 years ago

Hi, and thanks for reporting this! Unfortunately, the Cmake stuff is one of the areas I know very little about and from the output you posted it looks like the system is still trying to do a *nix-style build rather than MSVC. Have you tried using the MSVC solution file directly, or is there a reason that doesn't work for you?

@evpobr can you provide any more insight into this? Thanks!

evpobr commented 2 years ago

Hi. Ok, I will take a look.

evpobr commented 2 years ago

Cannot reproduce bug:

``` D:\source\repos\WavPack\build>cmake --build . Scanning dependencies of target wavpack [ 4%] Building C object CMakeFiles/wavpack.dir/src/common_utils.c.obj common_utils.c [ 8%] Building C object CMakeFiles/wavpack.dir/src/decorr_utils.c.obj decorr_utils.c [ 12%] Building C object CMakeFiles/wavpack.dir/src/entropy_utils.c.obj entropy_utils.c [ 16%] Building C object CMakeFiles/wavpack.dir/src/extra1.c.obj extra1.c [ 20%] Building C object CMakeFiles/wavpack.dir/src/extra2.c.obj extra2.c [ 24%] Building C object CMakeFiles/wavpack.dir/src/open_utils.c.obj open_utils.c [ 28%] Building C object CMakeFiles/wavpack.dir/src/open_filename.c.obj open_filename.c [ 32%] Building C object CMakeFiles/wavpack.dir/src/open_legacy.c.obj open_legacy.c [ 36%] Building C object CMakeFiles/wavpack.dir/src/open_raw.c.obj open_raw.c [ 40%] Building C object CMakeFiles/wavpack.dir/src/pack.c.obj pack.c [ 44%] Building C object CMakeFiles/wavpack.dir/src/pack_dns.c.obj pack_dns.c [ 48%] Building C object CMakeFiles/wavpack.dir/src/pack_floats.c.obj pack_floats.c [ 52%] Building C object CMakeFiles/wavpack.dir/src/pack_utils.c.obj pack_utils.c [ 56%] Building C object CMakeFiles/wavpack.dir/src/read_words.c.obj read_words.c [ 60%] Building C object CMakeFiles/wavpack.dir/src/tags.c.obj tags.c [ 64%] Building C object CMakeFiles/wavpack.dir/src/tag_utils.c.obj tag_utils.c [ 68%] Building C object CMakeFiles/wavpack.dir/src/unpack.c.obj unpack.c [ 72%] Building C object CMakeFiles/wavpack.dir/src/unpack_floats.c.obj unpack_floats.c [ 76%] Building C object CMakeFiles/wavpack.dir/src/unpack_seek.c.obj unpack_seek.c [ 80%] Building C object CMakeFiles/wavpack.dir/src/unpack_utils.c.obj unpack_utils.c [ 84%] Building C object CMakeFiles/wavpack.dir/src/write_words.c.obj write_words.c [ 88%] Building C object CMakeFiles/wavpack.dir/src/pack_dsd.c.obj pack_dsd.c [ 92%] Building C object CMakeFiles/wavpack.dir/src/unpack_dsd.c.obj unpack_dsd.c [ 96%] Building RC object CMakeFiles/wavpack.dir/wavpackdll/wavpackdll.rc.res Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384 Copyright (C) Microsoft Corporation. All rights reserved. [100%] Linking C shared library wavpackdll.dll [100%] Built target wavpack ```

Are you running the configuration from VS command prompt?

``` ** Visual Studio 2019 Developer Command Prompt v16.11.11 ** Copyright (c) 2021 Microsoft Corporation ********************************************************************** [vcvarsall.bat] Environment initialized for: 'x86' C:\Program Files (x86)\Microsoft Visual Studio\2019\Community>d: D:\>cd source\repos\WavPack\build D:\source\repos\WavPack\build>cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="c:\msvc_x86_64" -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DWAVPACK_BUILD_DOCS=OFF -DWAVPACK_BUILD_PROGRAMS=OFF -DWAVPACK_ENABLE_ASM=OFF -DWAVPACK_ENABLE_LEGACY=OFF -DWAVPACK_BUILD_WINAMP_PLUGIN=OFF -DWAVPACK_BUILD_COOLEDIT_PLUGIN=OFF ```
evpobr commented 2 years ago

I also advise, if possible, always use package managers. For example Vcpkg:

``` PS C:\Users\evpob> vcpkg install wavpack:x64-windows Computing installation plan... The following packages will be built and installed: wavpack[core]:x64-windows -> 5.4.0#1 Detecting compiler hash for triplet x64-windows... Restored 0 packages from C:\Users\evpob\AppData\Local\vcpkg\archives in 1.705 ms. Use --debug to see more details. Starting package 1/1: wavpack:x64-windows Building package wavpack[core]:x64-windows... -- Downloading https://github.com/dbry/WavPack/archive/5.4.0.tar.gz -> dbry-WavPack-5.4.0.tar.gz... -- Extracting source D:/source/repos/vcpkg/downloads/dbry-WavPack-5.4.0.tar.gz -- Applying patch OpenSSL.patch -- Applying patch fix-symbol-exports.patch -- Using source at D:/source/repos/vcpkg/buildtrees/wavpack/src/5.4.0-582c220836.clean -- Found external ninja('1.10.2'). -- Configuring x64-windows -- Building x64-windows-dbg -- Building x64-windows-rel -- Installing: D:/source/repos/vcpkg/packages/wavpack_x64-windows/share/wavpack/copyright -- Fixing pkgconfig file: D:/source/repos/vcpkg/packages/wavpack_x64-windows/lib/pkgconfig/wavpack.pc -- Using cached msys-mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst. -- Using cached msys-mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst. -- Using msys root at D:/source/repos/vcpkg/downloads/tools/msys2/9a1ec3f33446b195 -- Fixing pkgconfig file: D:/source/repos/vcpkg/packages/wavpack_x64-windows/debug/lib/pkgconfig/wavpack.pc -- Performing post-build validation -- Performing post-build validation done Stored binary cache: C:\Users\evpob\AppData\Local\vcpkg\archives\32\326b88ddbee3f7e2d8374e849db8a0c15fdb078a6f4663a1858b3356449816bb.zip Installing package wavpack[core]:x64-windows... Elapsed time for package wavpack:x64-windows: 30.79 s Total elapsed time: 37.34 s The package wavpack provides CMake targets: find_package(wavpack CONFIG REQUIRED) target_link_libraries(main PRIVATE WavPack::wavpack) ```
jonaski commented 2 years ago

wavpackdll/wavpackdll.rc is missing from wavpack-5.4.0.tar.xz, git works. The linking error was caused by a MinGW installation in PATH, so that's not a bug.

evpobr commented 2 years ago

So it's ok now?

jonaski commented 2 years ago

Yeah but you might want to include wavpackdll.rc in the tarball

dbry commented 2 years ago

@jonaski Thanks for reporting this!

@evpobr @SoapGentoo So is the correct and complete way to fix this to simply add wavpackdll/wavpackdll.rc to the EXTRA_DIST section of Makefile.am? It looks like packages generated from the Cmake system already include everything.

SoapGentoo commented 2 years ago

@dbry yes, given that the .rc is not part of any native Automake rule, adding it to EXTRA_DIST should pick it up for the tarball