DiligentGraphics / DiligentEngine

A modern cross-platform low-level graphics library and rendering framework
http://diligentgraphics.com/diligent-engine/
Apache License 2.0
3.63k stars 331 forks source link

Linking Issues #169

Closed TyrannusX closed 3 years ago

TyrannusX commented 3 years ago

Hello I'm having issues compiling my sample application. Im using CMake to generate a Makefile. The compilation is fine, but the linker throws an error. My system information is as follows

CMAKE FILE

define versions and standards

cmake_minimum_required(VERSION 3.10) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON)

define the project name

project(MysticalMana VERSION 1.0)

locate UNIX and WIN specific libs

if(UNIX) find_library(DL dl) find_library(EX11 X11) find_library(PTHREAD pthread) find_library(DILIGENTLINUX Diligent-LinuxPlatform PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) elseif(WIN32) find_library(DILIGENTWIN32 Diligent-Win32Platform PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" REQUIRED)
endif()

find_library(DILIGENTSHADERTOOLS Diligent-ShaderTools PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTHLSL2GLSL Diligent-HLSL2GLSLConverterLib PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTPRIMITIVES Diligent-Primitives PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTGRAPHICSENGINE Diligent-GraphicsEngine PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTACCESSORIES Diligent-GraphicsAccessories PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTCOMMON Diligent-Common PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTBASICPLATFORM Diligent-BasicPlatform PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(GLFW glfw3 PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(ASSIMP assimp assimp-vc142-mtd PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(GENERICCODEGEN GenericCodeGen GenericCodeGend PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(GLEWSTATIC glew-static PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(GLSLLANG glslang glslangd PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(GRAPHICSENGINEOPENGL GraphicsEngineOpenGL Diligent-GraphicsEngineOpenGL-static PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(GRAPHICSENGINEVK GraphicsEngineVk Diligent-GraphicsEngineVk-static PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(EHLSL HLSL HLSLd PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(MACHINEINDEPENDENT MachineIndependent MachineIndependentd PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(OGLCOMPILER OGLCompiler OGLCompilerd PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(OSDEPENDENT OSDependent OSDependentd PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(ESPIRV SPIRV SPIRVd PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(SPIRVCROSSCORE spirv-cross-core spirv-cross-cored PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(SPIRVTOOLS SPIRV-Tools PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(SPIRVTOOLSOPT SPIRV-Tools-opt PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTFX DiligentFX PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTTOOLS DiligentTools Diligent-GraphicsTools PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTCORE DiligentCore PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTTEXTURELOADER Diligent-TextureLoader PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTZLIB ZLib PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTJPEG LibJpeg PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTTIFF LibTiff PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTPNG LibPng PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(DILIGENTASSETLOADER Diligent-AssetLoader PATHS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(SDL SDL2 "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(SDLMAIN SDL2main "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED) find_library(SDLMIXER SDL2_mixer "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64" "/usr/local/lib" "/usr/lib" REQUIRED)

Add headers, sources, and assets

file(GLOB_RECURSE SRC_FILES MysticalMana/.cpp) file(GLOB_RECURSE INCL_FILES MysticalMana/.h) file(COPY MysticalMana/vertex.hlsl DESTINATION ${CMAKE_BINARY_DIR}/Debug) file(COPY MysticalMana/fragment.hlsl DESTINATION ${CMAKE_BINARY_DIR}/Debug)

add_executable(MysticalMana ${SRC_FILES} ${INCL_FILES})

define include directory

target_include_directories(MysticalMana PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/MysticalMana)

link libraries

if(UNIX) target_link_libraries(MysticalMana PUBLIC ${DILIGENTSHADERTOOLS} ${DILIGENTZLIB} ${GENERICCODEGEN} ${MACHINEINDEPENDENT} ${OGLCOMPILER} ${OSDEPENDENT} ${SPIRVCROSSCORE} ${SPIRVTOOLS} ${SPIRVTOOLSOPT} ${ESPIRV} ${DILIGENTHLSL2GLSL} ${GLSLLANG} ${GLEWSTATIC} ${EHLSL} ${DILIGENTTOOLS} ${DILIGENTCORE} ${DILIGENTASSETLOADER} ${DILIGENTLINUX} ${DILIGENTPRIMITIVES} ${DILIGENTGRAPHICSENGINE} ${DILIGENTACCESSORIES} ${DILIGENTCOMMON} ${DILIGENTBASICPLATFORM} ${DILIGENTTEXTURELOADER} ${DILIGENTPNG} ${DILIGENTTIFF} ${DILIGENTJPEG} ${GRAPHICSENGINEVK} ${SDL} ${SDLMAIN} ${SDLMIXER} ${GLFW} ${ASSIMP} ${DL} ${EX11} ${PTHREAD}) elseif(WIN32) target_link_libraries(MysticalMana PUBLIC ${SDL} ${SDLMAIN} ${DILIGENTWIN32} ${DILIGENTSHADERTOOLS} ${DILIGENTPRIMITIVES} ${DILIGENTHLSL2GLSL} ${DILIGENTGRAPHICSENGINE} ${DILIGENTACCESSORIES} ${DILIGENTCOMMON} ${DILIGENTBASICPLATFORM} ${GLFW} ${ASSIMP} ${GENERICCODEGEN} ${GLEWSTATIC} ${GLSLLANG} ${GRAPHICSENGINEOPENGL} ${GRAPHICSENGINEVK} ${EHLSL} ${MACHINEINDEPENDENT} ${OGLCOMPILER} ${OSDEPENDENT} ${ESPIRV} ${SPIRVCROSSCORE} ${SPIRVTOOLS} ${SPIRVTOOLSOPT} ${DILIGENTFX} ${DILIGENTTOOLS} ${DILIGENTZLIB} ${DILIGENTJPEG} ${DILIGENTTIFF} ${DILIGENTPNG} ${DILIGENTASSETLOADER}) target_link_libraries(MysticalMana PRIVATE ${DILIGENTTEXTURELOADER}) endif()

ERROR /usr/bin/ld: CMakeFiles/MysticalMana.dir/MysticalMana/AudioManager.cpp.o: in function AudioManager::AudioManager()': AudioManager.cpp:(.text+0xa5): undefined reference toMix_OpenAudio' /usr/bin/ld: CMakeFiles/MysticalMana.dir/MysticalMana/AudioManager.cpp.o: in function AudioManager::LoadMusic(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)': AudioManager.cpp:(.text+0x125): undefined reference toMix_LoadMUS' /usr/bin/ld: CMakeFiles/MysticalMana.dir/MysticalMana/AudioManager.cpp.o: in function AudioManager::LoadSoundEffect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)': AudioManager.cpp:(.text+0x1bf): undefined reference toMix_LoadWAV_RW' /usr/bin/ld: CMakeFiles/MysticalMana.dir/MysticalMana/AudioManager.cpp.o: in function AudioManager::PlayAudio(AudioEntity&)': AudioManager.cpp:(.text+0x245): undefined reference toMix_PlayMusic' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(GLSLangUtils.cpp.o): in function Diligent::GLSLangUtils::InitializeGlslang()': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:64: undefined reference toglslang::InitializeProcess()' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(GLSLangUtils.cpp.o): in function Diligent::GLSLangUtils::FinalizeGlslang()': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:69: undefined reference toglslang::FinalizeProcess()' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(GLSLangUtils.cpp.o): in function Diligent::GLSLangUtils::(anonymous namespace)::CompileShaderInternal(glslang::TShader&, EShMessages, glslang::TShader::Includer*, char const*, unsigned long, bool, Diligent::IDataBlob**)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:248: undefined reference toglslang::TShader::setAutoMapBindings(bool)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:256: undefined reference to glslang::TShader::getInfoDebugLog()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:256: undefined reference toglslang::TShader::getInfoLog()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:260: undefined reference to glslang::TProgram::TProgram()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:262: undefined reference toglslang::TProgram::link(EShMessages)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:264: undefined reference to glslang::TProgram::getInfoDebugLog()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:264: undefined reference toglslang::TProgram::getInfoLog()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:270: undefined reference to glslang::TProgram::mapIO(glslang::TIoMapResolver*, glslang::TIoMapper*)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:273: undefined reference toglslang::GlslangToSpv(glslang::TIntermediate const&, std::vector<unsigned int, std::allocator >&, glslang::SpvOptions)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:260: undefined reference to glslang::TProgram::~TProgram()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:260: undefined reference toglslang::TProgram::~TProgram()' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(GLSLangUtils.cpp.o): in function `Diligent::GLSLangUtils::HLSLtoSPIRV(Diligent::ShaderCreateInfo const&, char const, Diligent::IDataBlob*)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:344: undefined reference to glslang::TShader::TShader(EShLanguage)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:357: undefined reference toglslang::TShader::setHlslIoMapping(bool)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:358: undefined reference to `glslang::TShader::setEntryPoint(char const)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:383: undefined reference to glslang::TShader::setStringsWithLengthsAndNames(char const* const*, int const*, char const* const*, int)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:393: undefined reference tospvtools::Optimizer::Optimizer(spv_target_env)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:394: undefined reference to spvtools::Optimizer::SetMessageConsumer(std::function<void (spv_message_level_t, char const*, spv_position_t const&, char const*)>)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:395: undefined reference tospvtools::Optimizer::RegisterLegalizationPasses()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:396: undefined reference to spvtools::Optimizer::RegisterPerformancePasses()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:398: undefined reference tospvtools::Optimizer::Run(unsigned int const, unsigned long, std::vector<unsigned int, std::allocator >) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:393: undefined reference to spvtools::Optimizer::~Optimizer()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:344: undefined reference toglslang::TShader::~TShader()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:393: undefined reference to spvtools::Optimizer::~Optimizer()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:344: undefined reference toglslang::TShader::~TShader()' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(GLSLangUtils.cpp.o): in function Diligent::GLSLangUtils::GLSLtoSPIRV(Diligent::GLSLangUtils::GLSLtoSPIRVAttribs const&)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:414: undefined reference toglslang::TShader::TShader(EShLanguage)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:448: undefined reference to glslang::TShader::setStringsWithLengths(char const* const*, int const*, int)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:463: undefined reference tospvtools::Optimizer::Optimizer(spv_target_env)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:464: undefined reference to spvtools::Optimizer::SetMessageConsumer(std::function<void (spv_message_level_t, char const*, spv_position_t const&, char const*)>)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:465: undefined reference tospvtools::Optimizer::RegisterPerformancePasses()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:467: undefined reference to spvtools::Optimizer::Run(unsigned int const*, unsigned long, std::vector<unsigned int, std::allocator<unsigned int> >*) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:463: undefined reference tospvtools::Optimizer::~Optimizer()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:414: undefined reference to glslang::TShader::~TShader()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:463: undefined reference tospvtools::Optimizer::~Optimizer()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/GLSLangUtils.cpp:414: undefined reference to glslang::TShader::~TShader()' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(GLSLangUtils.cpp.o): in functionglslang::TShader::parse(TBuiltInResource const, int, EProfile, bool, bool, EShMessages)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/../../ThirdParty/glslang/glslang/MachineIndependent/../Include/../Include/../Public/ShaderLang.h:654: undefined reference to `glslang::TShader::parse(TBuiltInResource const, int, EProfile, bool, bool, EShMessages, glslang::TShader::Includer&)' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(GLSLangUtils.cpp.o): in function glslang::TShader::parse(TBuiltInResource const*, int, bool, EShMessages, glslang::TShader::Includer&)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/../../ThirdParty/glslang/glslang/MachineIndependent/../Include/../Include/../Public/ShaderLang.h:666: undefined reference toglslang::TShader::parse(TBuiltInResource const, int, EProfile, bool, bool, EShMessages, glslang::TShader::Includer&)' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(PipelineStateVkImpl.cpp.o): in function Diligent::(anonymous namespace)::StripReflection(std::vector<unsigned int, std::allocator<unsigned int> >&)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp:73: undefined reference tospvtools::Optimizer::Optimizer(spv_target_env)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp:74: undefined reference to `spvtools::Optimizer::SetMessageConsumer(std::function<void (spv_message_level_t, char const, spv_position_t const&, char const)>)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp:77: undefined reference to spvtools::CreateStripReflectInfoPass()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp:77: undefined reference tospvtools::Optimizer::RegisterPass(spvtools::Optimizer::PassToken&&)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp:77: undefined reference to spvtools::Optimizer::PassToken::~PassToken()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp:79: undefined reference tospvtools::Optimizer::Run(unsigned int const, unsigned long, std::vector<unsigned int, std::allocator >) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp:73: undefined reference to spvtools::Optimizer::~Optimizer()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp:77: undefined reference tospvtools::Optimizer::PassToken::~PassToken()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp:73: undefined reference to spvtools::Optimizer::~Optimizer()' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(SPIRVShaderResources.cpp.o): in functionDiligent::GetResourceDimension(diligent_spirv_cross::Compiler const&, diligent_spirv_cross::Resource const&)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:59: undefined reference to diligent_spirv_cross::Compiler::get_type(diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)1>) const' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(SPIRVShaderResources.cpp.o): in functionDiligent::IsMultisample(diligent_spirv_cross::Compiler const&, diligent_spirv_cross::Resource const&)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:84: undefined reference to diligent_spirv_cross::Compiler::get_type(diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)1>) const' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(SPIRVShaderResources.cpp.o): in functionDiligent::GetDecorationOffset(diligent_spirv_cross::Compiler const&, diligent_spirv_cross::Resource const&, spv::Decoration)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:100: undefined reference to diligent_spirv_cross::Compiler::has_decoration(diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)0>, spv::Decoration) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:102: undefined reference todiligent_spirv_cross::Compiler::get_binary_offset_for_decoration(diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)2>, spv::Decoration, unsigned int&) const' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(SPIRVShaderResources.cpp.o): in function Diligent::GetUBName[abi:cxx11](diligent_spirv_cross::Compiler&, diligent_spirv_cross::Resource const&, diligent_spirv_cross::ParsedIR::Source const&)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:259: undefined reference todiligent_spirv_cross::Compiler::get_nameabi:cxx11 const' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(SPIRVShaderResources.cpp.o): in function `Diligent::SPIRVShaderResources::SPIRVShaderResources(Diligent::IMemoryAllocator&, std::vector<unsigned int, std::allocator >, Diligent::ShaderDesc const&, char const, bool, std::cxx11::basic_string<char, std::char_traits, std::allocator >&)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:272: undefined reference to diligent_spirv_cross::Parser::Parser(std::vector<unsigned int, std::allocator<unsigned int> >)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:273: undefined reference todiligent_spirv_cross::Parser::parse()' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:276: undefined reference to diligent_spirv_cross::Compiler::Compiler(diligent_spirv_cross::ParsedIR&&)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:279: undefined reference todiligent_spirv_cross::Compiler::get_entry_points_and_stages() const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:298: undefined reference to `diligent_spirv_cross::Compiler::set_entry_point(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&, spv::ExecutionModel)' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:301: undefined reference to diligent_spirv_cross::Compiler::get_shader_resources() const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:337: undefined reference todiligent_spirv_cross::Compiler::get_declared_extensions[abi:cxx11]() const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:350: undefined reference to diligent_spirv_cross::Compiler::has_decoration(diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)0>, spv::Decoration) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:352: undefined reference todiligent_spirv_cross::Compiler::get_decoration_string[abi:cxx11](diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)0>, spv::Decoration) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:397: undefined reference to diligent_spirv_cross::Compiler::get_type(diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)1>) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:398: undefined reference todiligent_spirv_cross::Compiler::get_declared_struct_size(diligent_spirv_cross::SPIRType const&) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:415: undefined reference to diligent_spirv_cross::Compiler::get_buffer_block_flags(diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)2>) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:420: undefined reference todiligent_spirv_cross::Compiler::get_type(diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)1>) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:421: undefined reference to diligent_spirv_cross::Compiler::get_declared_struct_size(diligent_spirv_cross::SPIRType const&) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:422: undefined reference todiligent_spirv_cross::Compiler::get_declared_struct_size_runtime_array(diligent_spirv_cross::SPIRType const&, unsigned long) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:440: undefined reference to diligent_spirv_cross::Compiler::get_type(diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)1>) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:459: undefined reference todiligent_spirv_cross::Compiler::get_type(diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)1>) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:508: undefined reference to diligent_spirv_cross::Compiler::get_type(diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)1>) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:568: undefined reference todiligent_spirv_cross::Compiler::has_decoration(diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)0>, spv::Decoration) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:570: undefined reference to diligent_spirv_cross::Compiler::get_decoration_string[abi:cxx11](diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)0>, spv::Decoration) const' /usr/bin/ld: /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:586: undefined reference todiligent_spirv_cross::Compiler::get_execution_mode_argument(spv::ExecutionMode, unsigned int) const' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(SPIRVShaderResources.cpp.o): in function unsigned short const Diligent::GetResourceArraySize<unsigned short const>(diligent_spirv_cross::Compiler const&, diligent_spirv_cross::Resource const&)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/Graphics/ShaderTools/src/SPIRVShaderResources.cpp:44: undefined reference todiligent_spirv_cross::Compiler::get_type(diligent_spirv_cross::TypedID<(diligent_spirv_cross::Types)1>) const' /usr/bin/ld: /usr/local/lib/libDiligentCore.a(SPIRVShaderResources.cpp.o): in function diligent_spirv_cross::Compiler::~Compiler()': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/ThirdParty/SPIRV-Cross/spirv_cross.hpp:168: undefined reference tovtable for diligent_spirv_cross::Compiler' collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/MysticalMana.dir/build.make:209: MysticalMana] Error 1 make[1]: [CMakeFiles/Makefile2:76: CMakeFiles/MysticalMana.dir/all] Error 2 make: *** [Makefile:84: all] Error 2

TheMostDiligent commented 3 years ago

Did you try to build it as described in the build instructions?

TheMostDiligent commented 3 years ago

Also, are you building for Linux on Windows? Why is there Visual Studio 2019?

TyrannusX commented 3 years ago

To answer your questions, the build instructions are for building the engine. I followed those instructions and everything worked as expected. I then ran "sudo make install" to install the headers and library ".a" files into /usr/local/include and /usr/local/lib. My issue is that im trying to link all the components for Diligent to use in my sample application. You are seeing Visual Studio because Im using CMake to build for both Linux and Windows. I provide all possible paths in that string so that's why you see windows and linux paths.

TyrannusX commented 3 years ago

I have not seen any instructions around for linking the different components.

TyrannusX commented 3 years ago

Am I linking stuff that is unnecessary?

TheMostDiligent commented 3 years ago

If you are linking statically, you have to list third-party dependencies in the linking list. https://github.com/DiligentGraphics/DiligentEngine#your-project-does-not-use-cmake

TyrannusX commented 3 years ago

Ok thanks. I will try that in about an hour and let you know how it goes.

TyrannusX commented 3 years ago

Ok so I updated the CMake file and now Im mostly seeing errors regarding glsl

For example: /usr/bin/ld: /usr/local/lib/libMachineIndependent.a(ShaderLang.cpp.o): in function glslang::TShader::preprocess(TBuiltInResource const*, int, EProfile, bool, bool, EShMessages, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, glslang::TShader::Includer&)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/ThirdParty/glslang/glslang/MachineIndependent/ShaderLang.cpp:1927: undefined reference toglslang::InitThread()'

Im linking glslang and OpenGL. Not sure what else I'm missing.

TheMostDiligent commented 3 years ago

On Linux the order of libraries in the linking list matters. I think that probably glslang.lib should go after MachineIndependent.lib.

TyrannusX commented 3 years ago

Ok that definitely got me further by reordering. Now this is the error I'm seeing

/usr/bin/ld: /usr/local/lib/libDiligentCore.a(DXCompiler.cpp.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/MysticalMana.dir/build.make:195: MysticalMana] Error 1 make[1]: [CMakeFiles/Makefile2:76: CMakeFiles/MysticalMana.dir/all] Error 2 make: *** [Makefile:84: all] Error 2

Current linking list order: target_link_libraries(MysticalMana PUBLIC ${DL} ${EX11} ${PTHREAD} ${GENERICCODEGEN} ${MACHINEINDEPENDENT} ${OPENGL} ${GLEWSTATIC} ${GLSLLANG} ${EHLSL} ${OGLCOMPILER} ${OSDEPENDENT} ${SPIRVCROSSCORE} ${ESPIRV} ${SPIRVTOOLSOPT} ${SPIRVTOOLS} ${DILIGENTCORE} ${SDL} ${SDLMAIN} ${SDLMIXER} ${GLFW} ${ASSIMP})

TheMostDiligent commented 3 years ago

Try moving dl to the end of the list

TyrannusX commented 3 years ago

Ok well I'm back at square one (same errors as my original message). I set the verbosity = 1 when running Make so I could see the full c++ command being run. Here's the libraries (and the exact order they are being linked in). Am I missing something?

-Wl,-rpath,/usr/local/lib /usr/local/lib/libGenericCodeGen.a /usr/local/lib/libMachineIndependent.a /usr/lib/x86_64-linux-gnu/libOpenGL.so /usr/local/lib/libglew-static.a /usr/local/lib/libglslang.a /usr/local/lib/libHLSL.a /usr/local/lib/libOGLCompiler.a /usr/local/lib/libOSDependent.a /usr/local/lib/libspirv-cross-core.a /usr/local/lib/libSPIRV.a /usr/local/lib/libSPIRV-Tools-opt.a /usr/local/lib/libSPIRV-Tools.a /usr/local/lib/libDiligentCore.a /usr/local/lib/libSDL2.so /usr/local/lib/libSDL2main.a /usr/lib/x86_64-linux-gnu/libSDL2_mixer.so /usr/local/lib/libglfw3.a /usr/local/lib/libassimp.so /usr/lib/x86_64-linux-gnu/libdl.so /usr/lib/x86_64-linux-gnu/libpthread.so /usr/lib/x86_64-linux-gnu/libX11.so

TheMostDiligent commented 3 years ago

The order appears to be opposite of what the example shows. Try using the same order as in the link I sent. You can also try whole-archive flag

TyrannusX commented 3 years ago

Ok, but the example also shows MachineIndependent coming after all the shader/graphics libraries, which you said needed to ocme before all of those...

TyrannusX commented 3 years ago

How does this ordering look? I get alot of MachineIndependent issues with this

-Wl,-rpath,/usr/local/lib /usr/local/lib/libDiligentCore.a /usr/local/lib/libglslang.a /usr/local/lib/libHLSL.a /usr/local/lib/libOGLCompiler.a /usr/local/lib/libOSDependent.a /usr/local/lib/libspirv-cross-core.a /usr/local/lib/libSPIRV.a /usr/local/lib/libSPIRV-Tools-opt.a /usr/local/lib/libSPIRV-Tools.a /usr/local/lib/libGenericCodeGen.a /usr/local/lib/libMachineIndependent.a /usr/local/lib/libglew-static.a /usr/lib/x86_64-linux-gnu/libOpenGL.so /usr/local/lib/libSDL2.so /usr/local/lib/libSDL2main.a /usr/lib/x86_64-linux-gnu/libSDL2_mixer.so /usr/local/lib/libglfw3.a /usr/local/lib/libassimp.so /usr/lib/x86_64-linux-gnu/libdl.so /usr/lib/x86_64-linux-gnu/libpthread.so /usr/lib/x86_64-linux-gnu/libX11.so

TheMostDiligent commented 3 years ago

Yes, this looks more reasonable to me. Where do machine independent issues come from?

TyrannusX commented 3 years ago

Here's an example. And the others seem to be glslang related as well

/usr/bin/ld: /usr/local/lib/libMachineIndependent.a(ShaderLang.cpp.o): in function glslang::TShader::preprocess(TBuiltInResource const*, int, EProfile, bool, bool, EShMessages, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, glslang::TShader::Includer&)': /home/rr-linux/Code/Build/DiligentEngine/DiligentCore/ThirdParty/glslang/glslang/MachineIndependent/ShaderLang.cpp:1927: undefined reference toglslang::InitThread()'

TheMostDiligent commented 3 years ago

Oh, yeah, I was wrong. glslang do need to go after MachineIndependent

TyrannusX commented 3 years ago

Ok Ill try that out. Also, I forgot I'm using Diligent::CreateTextureFromFile in my code and that was in the errors as well. Which library (and where) do I need to link?

TheMostDiligent commented 3 years ago

Ah, it requires third-party dependencies from ThirdParty folder. There is unfortunately no example

TheMostDiligent commented 3 years ago

You don't use CMake? With CMake that would've been one line.

TyrannusX commented 3 years ago

Well I am using CMake. I wrote that CMake file in my first post above. I just wrote that from scratch instead of using any CMake files provided by the repo.

TheMostDiligent commented 3 years ago

Did you try to follow these instructions? You only need to replace shared with static. There will be no issues with GraphicsTools too

TyrannusX commented 3 years ago

Oh hey that's handy. Sorry, I think I just need to read up on CMake more. Thanks for your help! Ill close this issue out.