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

[gdal] cannot open file 'gdal_i.lib' #38795

Closed
sbheinric opened this issue May 17, 2024 · 3 comments
Closed

[gdal] cannot open file 'gdal_i.lib' #38795

sbheinric opened this issue May 17, 2024 · 3 comments
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@sbheinric
Copy link

Operating system

Windows 10 Enterprise

Compiler

MSVC Community 2022 (64-bit)

Steps to reproduce the behavior

1) Initialize a new hello world repo like this:
https://learn.microsoft.com/en-us/vcpkg/get_started/get-started-vs?pivots=shell-cmd

2) Add GDAL port:
vcpkg add port GDAL

3) Then add GDAL as a dependency in the Cmake:

CMakeLists.txt:
cmake_minimum_required(VERSION 3.10)

project(HelloWorld)

find_package(fmt CONFIG REQUIRED)
find_package(GDAL CONFIG REQUIRED)

add_executable(HelloWorld helloworld.cpp)

target_link_libraries(HelloWorld PRIVATE fmt::fmt GDAL::GDAL)

4) Build

Failure logs

------ Build All started: Project: helloworld, Configuration: default ------
[1/1] Linking CXX executable HelloWorld.exe
FAILED: HelloWorld.exe
cmd.exe /C "cd . && "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\HelloWorld.dir --rc=C:\PROGRA2\WI3CF21\10\bin\1002261.0\x64\rc.exe --mt=C:\PROGRA2\WI3CF21\10\bin\1002261.0\x64\mt.exe --manifests -- C:\PROGRA1\MIB0551\2022\COMMUN1\VC\Tools\MSVC\14371.328\bin\Hostx64\x64\link.exe /nologo CMakeFiles\HelloWorld.dir\helloworld.cpp.obj /out:HelloWorld.exe /implib:HelloWorld.lib /pdb:HelloWorld.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console vcpkg_installed\x64-windows\debug\lib\fmtd.lib vcpkg_installed\x64-windows\debug\lib\gdald.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D C:\Users\USERNAME\repos\helloworld\build && C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy Bypass -file C:/Users/USERNAME/repos/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/Users/USERNAME/repos/helloworld/build/HelloWorld.exe -installedDir C:/Users/USERNAME/repos/helloworld/build/vcpkg_installed/x64-windows/debug/bin -OutVariable out""
LINK Pass 1: command "C:\PROGRA1\MIB0551\2022\COMMUN1\VC\Tools\MSVC\14371.328\bin\Hostx64\x64\link.exe /nologo CMakeFiles\HelloWorld.dir\helloworld.cpp.obj /out:HelloWorld.exe /implib:HelloWorld.lib /pdb:HelloWorld.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console vcpkg_installed\x64-windows\debug\lib\fmtd.lib vcpkg_installed\x64-windows\debug\lib\gdald.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\HelloWorld.dir/intermediate.manifest CMakeFiles\HelloWorld.dir/manifest.res" failed (exit code 1104) with the following output:
C:\Users\USERNAME\repos\helloworld\build\LINK : fatal error LNK1104: cannot open file 'gdal_i.lib'

ninja: build stopped: subcommand failed.

Build All failed.

Additional context

No response

@sbheinric sbheinric added the category:port-bug The issue is with a library, which is something the port should already support label May 17, 2024
@dg0yt
Copy link
Contributor

dg0yt commented May 17, 2024

C:\Users\USERNAME\repos\helloworld\build\LINK : fatal error LNK1104: cannot open file 'gdal_i.lib'

Where should this come from? The command line passes vcpkg_installed\x64-windows\debug\lib\gdald.lib. Show your code...

@sbheinric
Copy link
Author

Problem has been solved, I found the following offending line hardcoded in some of our library code:

#pragma comment(lib, "gdal_i.lib" )

@dg0yt
Copy link
Contributor

dg0yt commented May 17, 2024

#pragma comment(lib, "gdal_i.lib" )

Yeah, that's what I expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

No branches or pull requests

2 participants