Vcpkg: assimp package does not link irrXML

Created on 5 Feb 2020  路  6Comments  路  Source: microsoft/vcpkg

Describe the bug
I have a simple program that uses assimp.

CMakeLists.txt is configured with the following:

find_package(assimp CONFIG REQUIRED)
target_link_libraries(cubist PRIVATE assimp::assimp)
#target_link_libraries(cubist PRIVATE /home/chrome/code/vcpkg/installed/x64-linux/lib/libIrrXML.a)

Program does not build unless I comment out the second target_link_libraries line.

Environment

  • OS: linux
  • Compiler: clang version 9.0.0-2 (tags/RELEASE_900/final)

To Reproduce
Steps to reproduce the behavior:

  1. ./vcpkg install assimp
  2. Add assimp to your project and include the files.
  3. Try to build

Expected behavior
Expect not to see compiler errors.

Failure logs

[build] [5/5 100% :: 1.151] Linking CXX executable cubist
[build] FAILED: cubist 
[build] : && /bin/clang++-9  -g   CMakeFiles/cubist.dir/src/Mesh.cpp.o CMakeFiles/cubist.dir/src/Model.cpp.o CMakeFiles/cubist.dir/src/ShaderProgram.cpp.o CMakeFiles/cubist.dir/src/main.cpp.o  -o cubist  /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libspdlogd.a /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libglad.a /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libglfw3.a /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libassimpd.a /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libz.a /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libfmtd.a /usr/lib/x86_64-linux-gnu/librt.so -lm -ldl /usr/lib/x86_64-linux-gnu/libX11.so -lpthread && :
[build] ld: error: undefined symbol: irr::io::createIrrXMLReader(irr::io::IFileReadCallBack*)
[build] >>> referenced by AMFImporter.cpp:414 (/home/chrome/code/vcpkg/buildtrees/assimp/src/v5.0.0-fa91f462f7/code/AMF/AMFImporter.cpp:414)
[build] >>>               AMFImporter.cpp.o:(Assimp::AMFImporter::ParseFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Assimp::IOSystem*)) in archive /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libassimpd.a
[build] >>> referenced by ColladaParser.cpp:125 (/home/chrome/code/vcpkg/buildtrees/assimp/src/v5.0.0-fa91f462f7/code/Collada/ColladaParser.cpp:125)
[build] >>>               ColladaParser.cpp.o:(Assimp::ColladaParser::ColladaParser(Assimp::IOSystem*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)) in archive /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libassimpd.a
[build] >>> referenced by ColladaParser.cpp:168 (/home/chrome/code/vcpkg/buildtrees/assimp/src/v5.0.0-fa91f462f7/code/Collada/ColladaParser.cpp:168)
[build] >>>               ColladaParser.cpp.o:(Assimp::ColladaParser::ReadZaeManifest[abi:cxx11](Assimp::ZipArchiveIOSystem&)) in archive /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libassimpd.a
[build] >>> referenced by IRRMeshLoader.cpp:148 (/home/chrome/code/vcpkg/buildtrees/assimp/src/v5.0.0-fa91f462f7/code/Irr/IRRMeshLoader.cpp:148)
[build] >>>               IRRMeshLoader.cpp.o:(Assimp::IRRMeshImporter::InternReadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, aiScene*, Assimp::IOSystem*)) in archive /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libassimpd.a
[build] >>> referenced by IRRLoader.cpp:915 (/home/chrome/code/vcpkg/buildtrees/assimp/src/v5.0.0-fa91f462f7/code/Irr/IRRLoader.cpp:915)
[build] >>>               IRRLoader.cpp.o:(Assimp::IRRImporter::InternReadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, aiScene*, Assimp::IOSystem*)) in archive /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libassimpd.a
[build] >>> referenced by OgreImporter.cpp:131 (/home/chrome/code/vcpkg/buildtrees/assimp/src/v5.0.0-fa91f462f7/code/Ogre/OgreImporter.cpp:131)
[build] >>>               OgreImporter.cpp.o:(Assimp::Ogre::OgreImporter::InternReadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, aiScene*, Assimp::IOSystem*)) in archive /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libassimpd.a
[build] >>> referenced by OgreXmlSerializer.cpp:744 (/home/chrome/code/vcpkg/buildtrees/assimp/src/v5.0.0-fa91f462f7/code/Ogre/OgreXmlSerializer.cpp:744)
[build] >>>               OgreXmlSerializer.cpp.o:(Assimp::Ogre::OgreXmlSerializer::OpenReader(Assimp::IOSystem*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)) in archive /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libassimpd.a
[build] >>> referenced by XGLLoader.cpp:213 (/home/chrome/code/vcpkg/buildtrees/assimp/src/v5.0.0-fa91f462f7/code/XGL/XGLLoader.cpp:213)
[build] >>>               XGLLoader.cpp.o:(Assimp::XGLImporter::InternReadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, aiScene*, Assimp::IOSystem*)) in archive /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libassimpd.a
[build] >>> referenced by FIReader.cpp:1832 (/home/chrome/code/vcpkg/buildtrees/assimp/src/v5.0.0-fa91f462f7/code/X3D/FIReader.cpp:1832)
[build] >>>               FIReader.cpp.o:(Assimp::FIReader::create(Assimp::IOStream*)) in archive /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libassimpd.a
[build] >>> referenced by D3MFImporter.cpp:474 (/home/chrome/code/vcpkg/buildtrees/assimp/src/v5.0.0-fa91f462f7/code/3MF/D3MFImporter.cpp:474)
[build] >>>               D3MFImporter.cpp.o:(Assimp::D3MFImporter::InternReadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, aiScene*, Assimp::IOSystem*)) in archive /home/chrome/code/vcpkg/installed/x64-linux/debug/lib/libassimpd.a
[build] >>> referenced 1 more times
port-bug

Most helpful comment

@matjam I encountered this too, and have identified somewhat of a workaround

find_library(ASSIMP_ZLIB_LIBRARY z)
find_library(ASSIMP_IRRXML_LIBRARY IrrXML)

message("ASSIMP_ZLIB_LIBRARY   = " "${ASSIMP_ZLIB_LIBRARY}")
message("ASSIMP_IRRXML_LIBRARY = " "${ASSIMP_IRRXML_LIBRARY}")

target_link_libraries(cubist PRIVATE 
  assimp::assimp
  ${ASSIMP_ZLIB_LIBRARY}
  ${ASSIMP_IRRXML_LIBRARY}
)

All 6 comments

It seems that update break my #6593 changes.

I think that's a source bug.
Because assimp's config.cmake, targets.cmake and targets-debug/release.cmake are generated using configure_file instead of using cmake function export, dependencies are not added to the import list.

Related: #2988

@matjam I encountered this too, and have identified somewhat of a workaround

find_library(ASSIMP_ZLIB_LIBRARY z)
find_library(ASSIMP_IRRXML_LIBRARY IrrXML)

message("ASSIMP_ZLIB_LIBRARY   = " "${ASSIMP_ZLIB_LIBRARY}")
message("ASSIMP_IRRXML_LIBRARY = " "${ASSIMP_IRRXML_LIBRARY}")

target_link_libraries(cubist PRIVATE 
  assimp::assimp
  ${ASSIMP_ZLIB_LIBRARY}
  ${ASSIMP_IRRXML_LIBRARY}
)

@idcrook Yep, that works. But I think we need to wait upstream to fix this source issue, and then we will update the assimp version to resolve this issue.

ah that's a much nicer workaround than I was able to do. Thanks!

Since upstream has not fixed this error for a long time, I'm fixing it now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grandprixgp picture grandprixgp  路  3Comments

LilyWangL picture LilyWangL  路  3Comments

jack17529 picture jack17529  路  3Comments

pkeir picture pkeir  路  3Comments

spindensity picture spindensity  路  3Comments