question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot link to built Vala shared library when using MSVC

See original GitHub issue

Describe the bug Linking with a Vala shared library fails when using MSVC on Windows. The problem I think is that the import library for the dll isn’t generated. Positional arguments like implib or export_dynamic aren’t supported with *library(), but I think this should be done automatically. link gives an error like cannot open input file lib\valalib.lib

[1/1] Linking target prog/valaprog.exe
FAILED: prog/valaprog.exe prog/valaprog.pdb
"link"  /MACHINE:x64 /OUT:prog/valaprog.exe prog/valaprog.exe.p/meson-generated_prog.c.obj "/nologo" "/release" "/nologo" "/DEBUG" "/PDB:prog\valaprog.pdb" "lib\valalib.lib" "C:/lib/glib-2.0.lib" "C:/lib/intl.lib" "/LIBPATH:C://lib" "ws2_32.lib" "winmm.lib" "C:/lib/gobject-2.0.lib" "C:/lib/ffi.lib" "/LIBPATH:C://lib" "ws2_32.lib" "winmm.lib" "/SUBSYSTEM:CONSOLE" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "comdlg32.lib" "advapi32.lib"
LINK : fatal error LNK1181: cannot open input file 'lib\valalib.lib'
ninja: build stopped: subcommand failed.

To Reproduce Just run test case vala\7 shared library on Windows using cl for C compiler and link for linker.

Expected behavior Linking with a Vala built shared library should work.

system parameters

  • this is not a cross build
  • OS: Windows 10
  • Python 3.9.4
  • Meson 0.57.2
  • Ninja 1.10.2
  • cl.exe msvc 19.29.30031 “Microsoft ® C/C++ Optimizing Compiler Version 19.29.30031 for x64”
  • link.exe14.29.30031.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
tp-mcommented, May 2, 2021

Basically a duplicate of #2132 I think.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting CMake to build shared library for MSVC - Stack Overflow
I keep getting the following message when I try to build. LINK : fatal error LNK1104: cannot open file 'Debug\MyLibrary.lib' [C:\sandbox\ ...
Read more >
VS 2017 cannot find my shared library even though I tell it ...
My solution contains one shared library (.dll) and two unit test programs (.exe). The .dll compiles and links without errors. The first unit...
Read more >
FAQ - The Meson Build system
My project works fine on Linux and MinGW but fails to link with MSVC due to a missing .lib file (fatal error LNK1181)....
Read more >
Linking with library not working with Meson - GitLab - GNOME
The problem is with your meson.build. probably something like using link_with with a shared library instead of using dependencies and defining a ...
Read more >
Untitled
Use the tickets linked to CPP-494 to leave your feedback and vote for the ... 2. ninja -C build meson install -C build...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found