Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find lz4.lib file error in Windows with meson #1078

Open
danyeaw opened this issue Apr 17, 2022 · 9 comments
Open

Can't find lz4.lib file error in Windows with meson #1078

danyeaw opened this issue Apr 17, 2022 · 9 comments

Comments

@danyeaw
Copy link
Contributor

danyeaw commented Apr 17, 2022

Describe the bug

When trying to build lz4 in Windows with meson I am getting the following error:

(tar) Extracting C:\gtk-build\src\lz4-1.9.3.tar.gz
Forcing extraction of C:\gtk-build\src\lz4-1.9.3.tar.gz
Extracting C:\gtk-build\src\lz4-1.9.3.tar.gz to C:\gtk-build\build\Win32\release\lz4
Copying files from C:\gtk-build\github\gvsbuild\patches\lz4 to C:\gtk-build\build\Win32\release\lz4
(tar) Exporting lz4
(tar) Exporting C:\gtk-build\src\lz4-1.9.3.tar.gz
Building project lz4 (1.9.3)
Generating meson directory
The Meson build system
Version: 0.59.4
Source dir: C:\gtk-build\build\Win32\release\lz4
Build dir: C:\gtk-build\build\Win32\release\lz4\_gvsbuild-meson
Build type: native build
Project name: lz4
Project version: DUMMY
C compiler for the host machine: cl (msvc 19.31.31105 "Microsoft (R) C/C++ Optimizing Compiler Version 19.31.31105 for x86")
C linker for the host machine: link link 14.31.31105.0
Host machine cpu family: x86
Host machine cpu: x86
Program GetLz4LibraryVersion.py found: YES (C:\gtk-build\tools\pythonx86.3.10.4\tools\python.exe C:\gtk-build\build\Win32\release\lz4\meson\GetLz4LibraryVersion.py)
Message: Project version is now: 1.9.3
Compiler for C supports arguments -Wcast-qual: NO 
Compiler for C supports arguments -Wcast-align: NO 
Compiler for C supports arguments -Wshadow: NO 
Compiler for C supports arguments -Wswitch-enum: NO 
Compiler for C supports arguments -Wdeclaration-after-statement: NO 
Compiler for C supports arguments -Wstrict-prototypes: NO 
Compiler for C supports arguments -Wundef: NO 
Compiler for C supports arguments -Wpointer-arith: NO 
Compiler for C supports arguments -Wstrict-aliasing=1: NO 
Compiler for C supports arguments -DLZ4_DEBUG=1: YES 
Build targets in project: 2

Option buildtype is: debugoptimized [default: release]
Found ninja-1.8.2 at C:\gtk-build\tools\ninja-1.8.2\ninja.EXE
[6/7] Installing files.
Installing meson\lib\lz4.dll to C:\gtk-build\gtk\Win32\release\bin
Traceback (most recent call last):
  File "C:\gtk-build\tools\meson-0.59.4\mesonbuild\mesonmain.py", line 228, in run
    return options.run_func(options)
  File "C:\gtk-build\tools\meson-0.59.4\mesonbuild\minstall.py", line 720, in run
    installer.do_install(datafilename)
  File "C:\gtk-build\tools\meson-0.59.4\mesonbuild\minstall.py", line 512, in do_install
    self.install_targets(d, dm, destdir, fullprefix)
  File "C:\gtk-build\tools\meson-0.59.4\mesonbuild\minstall.py", line 615, in install_targets
    raise RuntimeError(f'File {t.fname!r} could not be found')
RuntimeError: File 'meson\\lib\\lz4.lib' could not be found
FAILED: meson-install 
"C:\gtk-build\tools\pythonx86.3.10.4\tools\python.exe" "C:\gtk-build\tools\meson-0.59.4\meson.py" "install" "--no-rebuild"
ninja: build stopped: subcommand failed.
Error: lz4 build failed

Expected behavior
meson build completes.

To Reproduce

meson setup --buildtype=debugoptimized -Ddefault_library=shared _gvsbuild-meson
cd _gvsbuild-meson
ninja
ninja install

System (please complete the following information):

  • OS: Windows
  • Version: 11
  • Compiler: Visual Studio 2022
  • Build System: meson
  • Other hardware specs: Core i5

Additional context
Add any other context about the problem here.

@Cyan4973 Cyan4973 added the build label Apr 17, 2022
@Cyan4973
Copy link
Member

I presume this is the issue fixed by #1077 ?

@danyeaw
Copy link
Contributor Author

danyeaw commented Apr 17, 2022

Hi @Cyan4973!
This is the next error after #1077 is fixed.

@Cyan4973
Copy link
Member

Cyan4973 commented Jul 4, 2022

Is this issue fixed ?

@danyeaw
Copy link
Contributor Author

danyeaw commented Jul 4, 2022

I don't think so. I am open to making a PR, but I wasn't sure where meson\\lib\\lz4.lib was being referenced from.

@Cyan4973
Copy link
Member

Cyan4973 commented Jul 4, 2022

I reproduced the exact list of commands listed under "to reproduce" section within a Windows msys2 environment using latest dev branch of lz4,
and all steps seem to execute perfectly. There is no error nor warning output.

To be more specific, here is the output of ninja install, which seems to be the failing step in the initial report :

 ninja install
[0/1] Installing files.
Installing meson/lib/msys-lz4-1.dll to /usr/local/bin
Installing meson/lib/liblz4.dll.a to /usr/local/lib
Installing /home/Cyan/dev/lz4/github/contrib/meson/meson/lib/../../../../lib/lz4.h to /usr/local/include/
Installing /home/Cyan/dev/lz4/github/contrib/meson/meson/lib/../../../../lib/lz4hc.h to /usr/local/include/
Installing /home/Cyan/dev/lz4/github/contrib/meson/meson/lib/../../../../lib/lz4frame.h to /usr/local/include/
Installing /home/Cyan/dev/lz4/github/contrib/meson/_gvsbuild-meson/meson-private/liblz4.pc to /usr/local/lib/pkgconfig

@eli-schwartz
Copy link
Contributor

The original report used MSVC cl.exe, so the msys2 behavior isn't really a guarantee.

@Cyan4973
Copy link
Member

Cyan4973 commented Jul 4, 2022

Right. There are really too many way to setup a system on Windows.

@eli-schwartz
Copy link
Contributor

Meson wrapdb test case:

lz4| C compiler for the host machine: cl (msvc 19.32.31332 "Microsoft (R) C/C++ Optimizing Compiler Version 19.32.31332 for x64")
lz4| C linker for the host machine: link link 14.32.31332.0

[...]

[5/5] "link"  /MACHINE:x64 /OUT:subprojects/lz4-1.9.3/contrib/meson/meson/lib/lz4-1.dll subprojects/lz4-1.9.3/contrib/meson/meson/lib/lz4-1.dll.p/.._.._.._.._lib_lz4.c.obj subprojects/lz4-1.9.3/contrib/meson/meson/lib/lz4-1.dll.p/.._.._.._.._lib_lz4frame.c.obj subprojects/lz4-1.9.3/contrib/meson/meson/lib/lz4-1.dll.p/.._.._.._.._lib_lz4hc.c.obj subprojects/lz4-1.9.3/contrib/meson/meson/lib/lz4-1.dll.p/.._.._.._.._lib_xxhash.c.obj "/nologo" "/release" "/nologo" "/DEBUG" "/PDB:subprojects\lz4-1.9.3\contrib/meson/meson\lib\lz4-1.pdb" "/DLL" "/IMPLIB:subprojects\lz4-1.9.3\contrib/meson/meson\lib\lz4.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "comdlg32.lib" "advapi32.lib"
   Creating library subprojects\lz4-1.9.3\contrib/meson/meson\lib\lz4.lib and object subprojects\lz4-1.9.3\contrib/meson/meson\lib\lz4.exp

[...]

Installing subprojects\lz4-1.9.3\contrib/meson/meson\lib\lz4-1.dll to D:\a\wrapdb\wrapdb\_build\pkg\bin
Installing subprojects\lz4-1.9.3\contrib/meson/meson\lib\lz4.lib to D:\a\wrapdb\wrapdb\_build\pkg\lib
Installing subprojects\lz4-1.9.3\contrib/meson/meson\lib\lz4-1.pdb to D:\a\wrapdb\wrapdb\_build\pkg\bin
Installing D:\a\wrapdb\wrapdb\subprojects\lz4-1.9.3\contrib/meson/meson\lib\../../../../lib/lz4.h to D:\a\wrapdb\wrapdb\_build\pkg\include\
Installing D:\a\wrapdb\wrapdb\subprojects\lz4-1.9.3\contrib/meson/meson\lib\../../../../lib/lz4hc.h to D:\a\wrapdb\wrapdb\_build\pkg\include\
Installing D:\a\wrapdb\wrapdb\subprojects\lz4-1.9.3\contrib/meson/meson\lib\../../../../lib/lz4frame.h to D:\a\wrapdb\wrapdb\_build\pkg\include\
Installing D:\a\wrapdb\wrapdb\_build\meson-private\liblz4.pc to D:\a\wrapdb\wrapdb\_build\pkg\lib\pkgconfig

@t-mat
Copy link
Contributor

t-mat commented Aug 12, 2022

I think we must be on the same page.

I mean that it seems there're different results because we didn't have "standard" testing method for meson on Windows + Visual Studio (and GH-Actions).


First of all, I'd like to refer the official document of Meson:

https://mesonbuild.com/Using-with-Visual-Studio.html

Using with Visual Studio
In order to generate Visual Studio projects, Meson needs to know the settings of your installed version of Visual Studio.
The only way to get this information is to run Meson under the Visual Studio Command Prompt.

Therefore, we must invoke meson from the Visual Studio Command Prompt. Though I personally hope they'll adopt vswhere properly 😞


I tested this issue with the following commands in standard "Windows Command prompt" (Win+X > R > "cmd")

git --version
meson --version

cd /d "%USERPROFILE%\Documents"
git clone https://github.com/lz4/lz4.git lz4-issue-1078
cd lz4-issue-1078
start .\build\VS2017\lz4.sln

Above command launches Visual Studio 2022. And here, invoke Visual Studio 2022 Menu > Tools > Visual Studio Command Prompt.

In this command prompt window, input the following commands:

cd /d "%USERPROFILE%\Documents\lz4-issue-1078"
cd .\contrib\meson
meson setup --buildtype=debugoptimized -Ddefault_library=shared _gvsbuild-meson
cd _gvsbuild-meson
ninja
ninja install
tree /A /F
Result (failure)
[0/1] Installing files.Installing meson\lib\lz4-1.dll to c:/bin

ERROR: File 'meson\\lib\\lz4.lib' could not be found

FAILED: meson-internal__install
"meson.exe" "install" "--no-rebuild"
ninja: build stopped: subcommand failed.
C:.
|   .gitignore
|   .hgignore
|   .ninja_deps
|   .ninja_log
|   build.ninja
|   compile_commands.json
|
+---meson
|   \---lib
|       |   lz4-1.dll
|       |   lz4-1.pdb
|       |
|       \---lz4-1.dll.p
|               .._.._.._.._lib_lz4.c.obj
|               .._.._.._.._lib_lz4.c.pdb
|               .._.._.._.._lib_lz4frame.c.obj
|               .._.._.._.._lib_lz4frame.c.pdb
|               .._.._.._.._lib_lz4hc.c.obj
|               .._.._.._.._lib_lz4hc.c.pdb
|               .._.._.._.._lib_xxhash.c.obj
|               .._.._.._.._lib_xxhash.c.pdb
|
+---meson-info
|       intro-benchmarks.json
|       intro-buildoptions.json
|       intro-buildsystem_files.json
|       intro-dependencies.json
|       intro-installed.json
|       intro-install_plan.json
|       intro-projectinfo.json
|       intro-targets.json
|       intro-tests.json
|       meson-info.json
|
+---meson-logs
|       install-log.txt
|       meson-log.txt
|
+---meson-private
|       build.dat
|       cmd_line.txt
|       coredata.dat
|       incdetect.c
|       incdetect.obj
|       install.dat
|       liblz4.pc
|       meson.lock
|       meson_benchmark_setup.dat
|       meson_test_setup.dat
|       sanitycheckc.c
|       sanitycheckc.exe
|       sanitycheckc.obj
|
\---meson-uninstalled
        liblz4-uninstalled.pc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants