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

error LNK1181: cannot open input file 'optimized.lib' #6436

Closed
LiuliHub opened this issue May 14, 2019 · 2 comments · Fixed by #7672
Closed

error LNK1181: cannot open input file 'optimized.lib' #6436

LiuliHub opened this issue May 14, 2019 · 2 comments · Fixed by #7672
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@LiuliHub
Copy link

Starting package 3/3: osg-qt:x64-windows
Building package osg-qt[core]:x64-windows...
-- Downloading https://github.com/openscenegraph/osgQt/archive/6d324db8a56feb7d1976e9fb3f1de9bf7d255646.tar.gz...
-- Extracting source D:/vcpkg/downloads/openscenegraph-osgQt-6d324db8a56feb7d1976e9fb3f1de9bf7d255646.tar.gz
-- Using source at D:/vcpkg/buildtrees/osg-qt/src/bf7d255646-3963797b6b
-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
CMake Error at scripts/cmake/vcpkg_build_cmake.cmake:202 (message):
Command failed: C:/Program Files/CMake/bin/cmake.exe;--build;.;--config;Release;--target;install;--;-v
Working Directory: D:/vcpkg/buildtrees/osg-qt/x64-windows-rel
See logs for more information:
D:\vcpkg\buildtrees\osg-qt\install-x64-windows-rel-out.log

Call Stack (most recent call first):
scripts/cmake/vcpkg_install_cmake.cmake:24 (vcpkg_build_cmake)
ports/osg-qt/portfile.cmake:17 (vcpkg_install_cmake)
scripts/ports.cmake:71 (include)

Error: Building package osg-qt:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with .\vcpkg update, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
Package: osg-qt:x64-windows
Vcpkg version: 2018.11.23-nohash

Additionally, attach any relevant sections from the log files above.

log file:
FAILED: src/osgQt/osg145-osgQt5.dll src/osgQt/osgQt5.lib
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=src\osgQt\CMakeFiles\osgQt5.dir --rc=C:\PROGRA2\WI3CF21\10\bin\1001771.0\x64\rc.exe --mt=C:\PROGRA2\WI3CF21\10\bin\1001771.0\x64\mt.exe --manifests -- C:\PROGRA2\MIB0551\2017\COMMUN1\VC\Tools\MSVC\14161.270\bin\Hostx64\x64\link.exe src\osgQt\CMakeFiles\osgQt5.dir\GraphicsWindowQt.obj src\osgQt\CMakeFiles\osgQt5.dir\QFontImplementation.obj src\osgQt\CMakeFiles\osgQt5.dir\QGraphicsViewAdapter.obj src\osgQt\CMakeFiles\osgQt5.dir\QWidgetImage.obj src\osgQt\CMakeFiles\osgQt5.dir__\include\osgQt\moc_QGraphicsViewAdapter.obj /out:src\osgQt\osg145-osgQt5.dll /implib:src\osgQt\osgQt5.lib /pdb:src\osgQt\osg145-osgQt5.pdb /dll /version:3.6 /machine:x64 /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF D:\vcpkg\installed\x64-windows\lib\osgDB.lib D:\vcpkg\installed\x64-windows\lib\osgGA.lib D:\vcpkg\installed\x64-windows\lib\osgUtil.lib D:\vcpkg\installed\x64-windows\lib\osgText.lib D:\vcpkg\installed\x64-windows\lib\osgViewer.lib D:\vcpkg\installed\x64-windows\lib\osgWidget.lib D:\vcpkg\installed\x64-windows\lib\osg.lib D:\vcpkg\installed\x64-windows\lib\OpenThreads.lib opengl32.lib optimized.lib D:\vcpkg\installed\x64-windows\lib\OpenThreads.lib debug.lib D:\vcpkg\installed\x64-windows\debug\lib\OpenThreadsd.lib D:\vcpkg\installed\x64-windows\lib\Qt5OpenGL.lib opengl32.lib optimized.lib debug.lib D:\vcpkg\installed\x64-windows\debug\lib\OpenThreadsd.lib D:\vcpkg\installed\x64-windows\lib\Qt5Widgets.lib D:\vcpkg\installed\x64-windows\lib\Qt5Gui.lib D:\vcpkg\installed\x64-windows\lib\Qt5Core.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK: command "C:\PROGRA2\MIB0551\2017\COMMUN1\VC\Tools\MSVC\14161.270\bin\Hostx64\x64\link.exe src\osgQt\CMakeFiles\osgQt5.dir\GraphicsWindowQt.obj src\osgQt\CMakeFiles\osgQt5.dir\QFontImplementation.obj src\osgQt\CMakeFiles\osgQt5.dir\QGraphicsViewAdapter.obj src\osgQt\CMakeFiles\osgQt5.dir\QWidgetImage.obj src\osgQt\CMakeFiles\osgQt5.dir__\include\osgQt\moc_QGraphicsViewAdapter.obj /out:src\osgQt\osg145-osgQt5.dll /implib:src\osgQt\osgQt5.lib /pdb:src\osgQt\osg145-osgQt5.pdb /dll /version:3.6 /machine:x64 /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF D:\vcpkg\installed\x64-windows\lib\osgDB.lib D:\vcpkg\installed\x64-windows\lib\osgGA.lib D:\vcpkg\installed\x64-windows\lib\osgUtil.lib D:\vcpkg\installed\x64-windows\lib\osgText.lib D:\vcpkg\installed\x64-windows\lib\osgViewer.lib D:\vcpkg\installed\x64-windows\lib\osgWidget.lib D:\vcpkg\installed\x64-windows\lib\osg.lib D:\vcpkg\installed\x64-windows\lib\OpenThreads.lib opengl32.lib optimized.lib D:\vcpkg\installed\x64-windows\lib\OpenThreads.lib debug.lib D:\vcpkg\installed\x64-windows\debug\lib\OpenThreadsd.lib D:\vcpkg\installed\x64-windows\lib\Qt5OpenGL.lib opengl32.lib optimized.lib debug.lib D:\vcpkg\installed\x64-windows\debug\lib\OpenThreadsd.lib D:\vcpkg\installed\x64-windows\lib\Qt5Widgets.lib D:\vcpkg\installed\x64-windows\lib\Qt5Gui.lib D:\vcpkg\installed\x64-windows\lib\Qt5Core.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:src\osgQt\osg145-osgQt5.dll.manifest" failed (exit code 1181) with the following output:
Microsoft (R) Incremental Linker Version 14.16.27030.1
Copyright (C) Microsoft Corporation. All rights reserved.

LINK : fatal error LNK1181: cannot open input file 'optimized.lib'
ninja: build stopped: subcommand failed.

@Neumann-A
Copy link
Contributor

I also encountered this a lot with #5543.
This generally happens if
set_property(TARGET <targetname> APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${<packagename>_LIBRARIES})
is used and
${<packagename>_LIBRARIES} contains the debug/optimized keyword. (Keywords only work in target_link_libraries calls!)
By scanning all dependencies

optimized.lib D:\vcpkg\installed\x64-windows\lib\OpenThreads.lib debug.lib D:\vcpkg\installed\x64-windows\debug\lib\OpenThreadsd.lib

this is the offending one. So the error is wherever OpenThreads is added to the link dependency.

@longhuan2018
Copy link
Contributor

I think I fixed this issue in #7672. you may try it.

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

Successfully merging a pull request may close this issue.

4 participants