我正在尝试与
libtiff.a
中的
/usr/local/lib
(静态库)链接
修改为列出 CMakeLists.txt 的全部内容:
set(PROJECT_NAME DeepSkyStacker)
message("Configuring project: " ${PROJECT_NAME})
set(COMPILE_WARNING_AS_ERROR YES)
SET (CMAKE_INSTALL_BINDIR ".")
qt_standard_project_setup()
set(CMAKE_AUTORCC ON)
################################################################################
# Source groups
################################################################################
set(Dialogs
"About.cpp"
"ExplorerBar.cpp"
)
source_group("Dialogs" FILES ${Dialogs})
set(Dialogs__Processing
"BezierAdjust.h"
"processingcontrols.cpp"
"ProcessingDlg.cpp"
"ProcessingSettings.h"
"ProcessingSettingsDlg.cpp"
"RGBTab.cpp"
"SavePicture.cpp"
"StarMaskDlg.cpp"
)
source_group("Dialogs\\Processing" FILES ${Dialogs__Processing})
set(Dialogs__Registering
"AskRegistering.cpp"
"RegisterSettings.cpp"
)
source_group("Dialogs\\Registering" FILES ${Dialogs__Registering})
set(Dialogs__Settings
"AlignmentParameters.cpp"
"CometStacking.cpp"
"IntermediateFiles.cpp"
"OutputTab.cpp"
"PostCalibration.cpp"
"RawDDPSettings.cpp"
"ResultParameters.cpp"
"StackingParameters.cpp"
"StackSettings.cpp"
)
source_group("Dialogs\\Settings" FILES ${Dialogs__Settings})
set(Dialogs__Stacking
"BackgroundOptions.cpp"
"BatchStacking.cpp"
"CheckAbove.cpp"
"DropFilesDlg.cpp"
"ImageProperties.cpp"
"picturelist.cpp"
"RecommendedSettings.cpp"
"RenameGroup.cpp"
"SaveEditChanges.cpp"
"StackingDlg.cpp"
"StackRecap.cpp"
)
source_group("Dialogs\\Stacking" FILES ${Dialogs__Stacking})
set(Header_Files
"../DeepSkyStackerKernel/histogram.h"
"DeepSkyStacker.h"
"Delaunay.h"
"dslr.h"
"DSS-versionhelpers.h"
"DSS-winapifamily.h"
"DSS-winpackagefamily.h"
"lowerdockwidget.cpp"
"mrulist.h"
"stdafx.h"
)
source_group("Header Files" FILES ${Header_Files})
set(Source_Files
"BaseDialog.cpp"
"DeepSkyStacker.cpp"
"Delaunay.cpp"
"editstars.cpp"
"progressdlg.cpp"
"selectrect.cpp"
"toolbar.cpp"
)
source_group("Source Files" FILES ${Source_Files})
set(Ui_Files
"ui/About.ui"
"ui/AlignmentParameters.ui"
"ui/AskRegistering.ui"
"ui/BackgroundOptions.ui"
"ui/BatchStacking.ui"
"ui/CheckAbove.ui"
"ui/CometStacking.ui"
"ui/DropFilesDlg.ui"
"ui/ExplorerBar.ui"
"ui/ImageProperties.ui"
"ui/IntermediateFiles.ui"
"ui/OutputTab.ui"
"ui/PictureList.ui"
"ui/PostCalibration.ui"
"ui/ProcessingControls.ui"
"ui/ProcessingDlg.ui"
"ui/ProcessingSettingsDlg.ui"
"ui/ProgressDlg.ui"
"ui/RawDDPSettings.ui"
"ui/RecommendedSettings.ui"
"ui/RegisterSettings.ui"
"ui/RenameGroup.ui"
"ui/ResultParameters.ui"
"ui/SaveEditChanges.ui"
"ui/StackingDlg.ui"
"ui/StackingParameters.ui"
"ui/StackRecap.ui"
"ui/StackSettings.ui"
"ui/StarMaskDlg.ui"
)
source_group("Qt\\ui" FILES ${Ui_Files})
set(i18n_Files
"i18n/DSS_ca.ts"
"i18n/DSS_cs.ts"
"i18n/DSS_de.ts"
"i18n/DSS_en.ts"
"i18n/DSS_es.ts"
"i18n/DSS_fr.ts"
"i18n/DSS_it.ts"
"i18n/DSS_ja_JP.ts"
"i18n/DSS_nl.ts"
"i18n/DSS_pt_BR.ts"
"i18n/DSS_ro.ts"
"i18n/DSS_ru.ts"
"i18n/DSS_tr.ts"
"i18n/DSS_zh_CN.ts"
"i18n/DSS_zh_TW.ts"
)
source_group("Qt\\i18n" FILES ${i18n_Files} "i18n/translations.qrc"
)
set(Resources
"Icon.rc"
"Icon/app.ico"
"resources.qrc"
"Version.rc"
"res/4Corners.bmp"
"res/4Corners.png"
"res/asinh.bmp"
"res/BiasColour.png"
"res/[email protected]"
"res/BiasCYMG.png"
"res/[email protected]"
"res/BiasGreyscale.png"
"res/[email protected]"
"res/BiasRGB.png"
"res/[email protected]"
"res/bmp00001.bmp"
"res/brazil.png"
"res/ButtonComet_Disabled.png"
"res/ButtonComet_Down.png"
"res/ButtonComet_Hot.png"
"res/ButtonComet_Up.png"
"res/ButtonSave_Disabled.png"
"res/ButtonSave_Down.png"
"res/ButtonSave_Hot.png"
"res/ButtonSave_Up.png"
"res/ButtonSelect_Disabled.png"
"res/ButtonSelect_Down.png"
"res/ButtonSelect_Hot.png"
"res/ButtonSelect_Up.png"
"res/ButtonStar_Disabled.png"
"res/ButtonStar_Down.png"
"res/ButtonStar_Hot.png"
"res/ButtonStar_Up.png"
"res/Calibration_Linear.bmp"
"res/Calibration_Rational.bmp"
"res/Catalan.png"
"res/Comet_Freeze.bmp"
"res/Comet_Normal.bmp"
"res/Comet_Trails.bmp"
"res/cuberoot.bmp"
"res/CurveMethods.pspimage"
"res/custommode.bmp"
"res/Czech.png"
"res/DarkColour.png"
"res/[email protected]"
"res/DarkCYMG.png"
"res/[email protected]"
"res/darkfram.ico"
"res/darkframe.ico"
"res/DarkGreyscale.png"
"res/[email protected]"
"res/DarkRGB.png"
"res/[email protected]"
"res/Dutch.png"
"res/FlatColour.png"
"res/[email protected]"
"res/FlatCYMG.png"
"res/[email protected]"
"res/flatframe.ico"
"res/FlatGreyscale.png"
"res/[email protected]"
"res/FlatRGB.png"
"res/[email protected]"
"res/GammaOff.bmp"
"res/GammaOn.bmp"
"res/German.png"
"res/hdrdown.bmp"
"res/hdrup.bmp"
"res/Heart.png"
"res/icon1.ico"
"res/ImageList_CFA_CYMG.bmp"
"res/ImageList_CFA_RGB.bmp"
"res/ImageList_Color.bmp"
"res/ImageList_GrayScale.bmp"
"res/ImageList_Mask.bmp"
"res/intersectionmode.bmp"
"res/Italian.png"
"res/LightColour.png"
"res/[email protected]"
"res/LightCYMG.png"
"res/[email protected]"
"res/lightfra.ico"
"res/lightframe.ico"
"res/LightGreyscale.png"
"res/[email protected]"
"res/LightRGB.png"
"res/[email protected]"
"res/linear.bmp"
"res/linear_en.bmp"
"res/linear_fr.bmp"
"res/log.bmp"
"res/loglog.bmp"
"res/logo.png"
"res/logsqrt.bmp"
"res/MaskStarShapes.pspimage"
"res/mosaicmode.bmp"
"res/normalmode.bmp"
"res/offsetframe.ico"
"res/Pattern_BGGR.bmp"
"res/Pattern_CYGMCYMG.bmp"
"res/Pattern_GBRG.bmp"
"res/Pattern_GRBG.bmp"
"res/Pattern_RGGB.bmp"
"res/Portugal.png"
"res/prc.png"
"res/RGBCalibration_Maximum.bmp"
"res/RGBCalibration_Middle.bmp"
"res/RGBCalibration_Minimum.bmp"
"res/RGBCalibration_None.bmp"
"res/Romanian.png"
"res/Russian.png"
"res/Spanish.png"
"res/sqrt.bmp"
"res/StarShape_Bell.bmp"
"res/StarShape_Cone.bmp"
"res/StarShape_Cubic.bmp"
"res/StarShape_Quadratic.bmp"
"res/StarShape_TruncatedBell.bmp"
"res/StarShape_TruncatedCone.bmp"
"res/Taiwan.png"
"res/Turkish.png"
)
source_group("Resources" FILES ${Resources} )
set(Tools
"../Tools/imageview.cpp"
"../Tools/QElidedLabel.cpp"
"../Tools/QLinearGradientCtrl.cpp"
)
source_group("Tools" FILES ${Tools})
set(ALL_FILES
${Dialogs}
${Dialogs__Processing}
${Dialogs__Registering}
${Dialogs__Settings}
${Dialogs__Stacking}
${Header_Files}
${Ui_Files}
${i18n_Files} "i18n/translations.qrc"
${Resources}
${Source_Files}
${Tools}
)
################################################################################
# Target
################################################################################
qt_add_executable(DeepSkyStacker ${ALL_FILES})
set_source_files_properties(${i18n_Files}
PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/i18n")
qt_add_lrelease(TS_FILES ${i18n_Files})
set_target_properties(DeepSkyStacker PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE "TRUE"
)
set_target_properties(DeepSkyStacker PROPERTIES
WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON
)
################################################################################
# Include directories
################################################################################
target_include_directories(DeepSkyStacker PUBLIC
.
../DeepSkyStackerKernel
GeneratedFiles/$<CONFIG>
GeneratedFiles
../LibRaw
../ZClass
../Tools
)
if(WIN32)
target_include_directories(${PROJECT_NAME} PUBLIC
../Zlib
../LibTiff
../CFitsIO
../include
../include/exiv2
../include/SmtpMime
"$<$<CONFIG:Debug>:C:/Program Files (x86)/Visual Leak Detector/include>"
"$ENV{Boost_1_80_0}"
)
endif()
target_precompile_headers(DeepSkyStacker PRIVATE
stdafx.h
)
################################################################################
# Compile definitions
################################################################################
target_compile_definitions(DeepSkyStacker PRIVATE
"$<$<CONFIG:Debug>:Z_TRACE_DEVELOP>"
"$<$<CONFIG:Release>:NDEBUG>"
NOMINMAX
LIBRAW_NODLL
_CRT_SECURE_NO_DEPRECATE
USE_LIBTIFF_STATIC
)
################################################################################
# Compile and link options
################################################################################
if(MSVC)
target_compile_options(DeepSkyStacker PRIVATE
$<$<CONFIG:Debug>:
/Gm-;
/Zi
>
$<$<CONFIG:Release>:
/Zi;
/GS-
>
-W4 /wd4244 /wd4652 /wd4702 /wd4828
-Zc:__cplusplus /openmp:experimental
/MP;
/GL-;
/EHsc
)
target_link_options(DeepSkyStacker PRIVATE
$<$<CONFIG:Debug>:
/PROFILE
>
$<$<CONFIG:Release>:
/OPT:ICF
>
/DEBUG:FULL;
/MACHINE:X64;
/SUBSYSTEM:WINDOWS;
/DYNAMICBASE:NO
)
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(${PROJECT_NAME} PRIVATE
-mavx -msse4.2
)
endif()
if(WIN32)
target_link_directories(DeepSkyStacker PRIVATE
"$<$<CONFIG:Debug>:C:/Users/amonra/Documents/GitHub/DSS/libs/Win64/DebugLibs>"
"$<$<CONFIG:Release>:C:/Users/amonra/Documents/GitHub/DSS/libs/Win64/ReleaseLibs>"
"$<$<CONFIG:Debug>:C:/Program Files (x86)/Visual Leak Detector/lib/Win64>"
)
endif()
################################################################################
# Dependencies
################################################################################
# Link with other targets.
target_link_libraries(DeepSkyStacker PRIVATE
Qt6::Core
Qt6::Widgets
Qt6::Network
DeepSkyStackerKernel
libraw
ZClass
)
if(WIN32)
target_link_libraries(DeepSkyStacker PRIVATE
libtiff
)
endif()
if(WIN32)
set(DEBUG_DEPENDENCIES exiv2d zlibstaticd)
set(RELEASE_DEPENDENCIES exiv2 zlibstatic)
else()
set(DEBUG_DEPENDENCIES libtiff.a exiv2 expat libz.a)
set(RELEASE_DEPENDENCIES libtiff.a exiv2 expat libz.a)
endif()
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"$<$<CONFIG:Debug>:${DEBUG_DEPENDENCIES}>"
"$<$<CONFIG:Release>:${RELEASE_DEPENDENCIES}>"
"cfitsio"
)
if(WIN32)
set(ADDITIONAL_LIBRARY_DEPENDENCIES ${ADDITIONAL_LIBRARY_DEPENDENCIES}
user32
psapi
htmlhelp
)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}")
#
# Force the values of QT_DEPLOY... variables
#
set (QT_DEPLOY_BIN_DIR ".")
set (QT_DEPLOY_LIBEXEC_DIR ".")
set (QT_DEPLOY_LIB_DIR ".")
set (QT_DEPLOY_PLUGINS_DIR ".")
#
# Set options for the deployment script. The value of:
#
# --libdir .
#
# is set to work around a bug in qt_deploy_runtime_dependencies which uses
#
# --libdir bin
#
# even though QT_DEPLOY_LIB_DIR is set to .
#
set (deploy_tool_options_arg ".")
if(APPLE)
set(deploy_tool_options_arg "${deploy_tool_options_arg} --hardened-runtime")
elseif(WIN32)
set(deploy_tool_options_arg "${deploy_tool_options_arg} --pdb")
endif()
# Generate a deployment script to be executed at install time
# App bundles on macOS have an .app suffix
if(APPLE)
set(executable_path "$<TARGET_FILE_NAME:DeepSkyStacker>.app")
else()
message ("Qt Deploy Bin Dir: " ${QT_DEPLOY_BIN_DIR})
message ("Qt Deploy Lib Dir: " ${QT_DEPLOY_LIB_DIR})
message ("Target filename:" $<TARGET_FILE_NAME:DeepSkyStacker>)
set(executable_path "${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:DeepSkyStacker>")
endif()
message ("executable_path: " ${executable_path})
message ("deploy tools options arg: " ${deploy_tool_options_arg})
qt_generate_deploy_script(
TARGET DeepSkyStacker
OUTPUT_SCRIPT deploy_script
CONTENT "
qt_deploy_runtime_dependencies(
EXECUTABLE \"${executable_path}\"
DEPLOY_TOOL_OPTIONS ${deploy_tool_options_arg}
)"
)
INSTALL (TARGETS DeepSkyStacker)
INSTALL (SCRIPT ${deploy_script})
#[=[
if(WIN32)
################################################################################
# Post build events
################################################################################
set (deployment_string
${WINDEPLOYQT_EXECUTABLE} " --verbose 2 --dir . --plugindir plugins "
"--compiler-runtime --pdb "
$<TARGET_FILE_NAME:DeepSkyStacker>
)
message ("Deployment command: " ${deployment_string})
ADD_CUSTOM_COMMAND(
TARGET DeepSkyStacker
POST_BUILD
COMMAND
${WINDEPLOYQT_EXECUTABLE} --verbose 2 --dir . --plugindir plugins
--compiler-runtime --pdb
$<TARGET_FILE_NAME:DeepSkyStacker>
)
endif()
#]=]
当我尝试链接时,我得到:
FAILED: DeepSkyStacker/DeepSkyStacker
: && /usr/bin/c++ -g DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/DeepSkyStacker_autogen/mocs_compilation.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/About.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/ExplorerBar.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/processingcontrols.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/ProcessingDlg.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/ProcessingSettingsDlg.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/RGBTab.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/SavePicture.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/StarMaskDlg.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/AskRegistering.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/RegisterSettings.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/AlignmentParameters.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/CometStacking.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/IntermediateFiles.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/OutputTab.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/PostCalibration.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/RawDDPSettings.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/ResultParameters.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/StackingParameters.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/StackSettings.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/BackgroundOptions.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/BatchStacking.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/CheckAbove.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/DropFilesDlg.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/ImageProperties.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/picturelist.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/RecommendedSettings.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/RenameGroup.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/SaveEditChanges.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/StackingDlg.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/StackRecap.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/lowerdockwidget.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/BaseDialog.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/DeepSkyStacker.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/Delaunay.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/editstars.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/progressdlg.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/selectrect.cpp.o DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/toolbar.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/__/Tools/imageview.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/__/Tools/QElidedLabel.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/__/Tools/QLinearGradientCtrl.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/DeepSkyStacker_autogen/O3VI4VFR3H/qrc_translations.cpp.o
DeepSkyStacker/CMakeFiles/DeepSkyStacker.dir/DeepSkyStacker_autogen/EWIEGA46WW/qrc_resources.cpp.o
-o DeepSkyStacker/DeepSkyStacker -Wl,-rpath,/opt/Qt/6.8.0/gcc_64/lib: DeepSkyStackerKernel/libDeepSkyStackerKernel.a
LibRaw/buildfiles/liblibraw.a ZClass/libZClass.a -Wl,-Bstatic -ltiff -Wl,-Bdynamic -lexiv2 -lexpat -Wl,-Bstatic -lz
-Wl,-Bdynamic -lcfitsio /opt/Qt/6.8.0/gcc_64/lib/libQt6Widgets.so.6.8.0 /opt/Qt/6.8.0/gcc_64/lib/libQt6Gui.so.6.8.0
/usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libOpenGL.so /opt/Qt/6.8.0/gcc_64/lib/libQt6Network.so.6.8.0
/opt/Qt/6.8.0/gcc_64/lib/libQt6Core.so.6.8.0 -llibtiff -Wl,-rpath-link,/opt/Qt/6.8.0/gcc_64/lib && :
/usr/bin/ld: cannot find -llibtiff: No such file or directory
/usr/bin/ld: note to link with /usr/local/lib/libtiff.a use -l:libtiff.a or rename it to liblibtiff.a
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
我想我犯了一个典型的初学者错误,但那是什么?
我更改了这些行以尝试纠正问题:
set(DEBUG_DEPENDENCIES tiff.a exiv2.a expat.a z.a cfitsio.a)
set(RELEASE_DEPENDENCIES tiff.a exiv2.a expat.a z.a cfitsio.a)
并添加了这个:
get_target_property(OUT ${PROJECT_NAME} LINK_LIBRARIES)
message(STATUS "Link libraries: " ${OUT})
配置步骤说:
1> [CMake] Configuring project: DeepSkyStacker
1> [CMake] -- Link libraries: Qt6::CoreQt6::CoreQt6::WidgetsQt6::NetworkDeepSkyStackerKernellibrawZClass$<$<CONFIG:Debug>:tiff.aexiv2.aexpat.az.acfitsio.a>$<$<CONFIG:Release>:tiff.aexiv2.aexpat.az.acfitsio.a>
所以我不知道 -llibtiff 来自哪里
啊啊啊!
问题来自静态库之一的 CMakeLists.txt,其中包含:
target_link_libraries(${PROJECT_NAME} PUBLIC) 利布劳 库 Z级 )
大卫