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

[filament] add Filament port #41916

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from
Draft

[filament] add Filament port #41916

wants to merge 32 commits into from

Conversation

aminya
Copy link
Contributor

@aminya aminya commented Nov 2, 2024

This adds Google/Filament

Fixes #35789
Fixes #14906

This is a successor of #17369

  • Changes comply with the maintainer guide.
  • The name of the port matches an existing name for this component on https://repology.org/ if possible, and/or is strongly associated with that component on search engines.
  • Optional dependencies are resolved in exactly one way. For example, if the component is built with CMake, all find_package calls are REQUIRED, are satisfied by vcpkg.json's declared dependencies, or disabled with CMAKE_DISABLE_FIND_PACKAGE_Xxx.
  • The versioning scheme in vcpkg.json matches what upstream says.
  • The license declaration in vcpkg.json matches what upstream says.
  • The installed as the "copyright" file matches what upstream says.
  • The source code of the component installed comes from an authoritative source.
  • The generated "usage text" is accurate. See adding-usage for context.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is in the new port's versions file.
  • Only one version is added to each modified port's versions file.

@aminya aminya mentioned this pull request Nov 2, 2024
11 tasks
@aminya aminya force-pushed the filament branch 2 times, most recently from 24a9023 to 2926a79 Compare November 2, 2024 14:29
@aminya
Copy link
Contributor Author

aminya commented Nov 2, 2024

The linker fails to find some of the libraries although their targets are linked in CMake. Any clue why this happens?

[174/500] : && /usr/lib/llvm-18/bin/clang++ -fPIC -std=c++17 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations -fPIC -fcolor-diagnostics -fvisibility=hidden -DTNT_DEV -g -fstack-protector -Wl,--gc-sections tools/cmgen/CMakeFiles/cmgen.dir/src/cmgen.cpp.o tools/cmgen/CMakeFiles/cmgen.dir/src/ProgressUpdater.cpp.o -o tools/cmgen/cmgen  libs/ibl/libibl.a  libs/imageio/libimageio.a  third_party/getopt/libgetopt.a  libs/image/libimage.a  libs/math/libmath.a  libs/utils/libutils.a  -ldl  -lpng  -ltinyexr  -lz  -lbasis_encoder && :
FAILED: tools/cmgen/cmgen 
: && /usr/lib/llvm-18/bin/clang++ -fPIC -std=c++17 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations -fPIC -fcolor-diagnostics -fvisibility=hidden -DTNT_DEV -g -fstack-protector -Wl,--gc-sections tools/cmgen/CMakeFiles/cmgen.dir/src/cmgen.cpp.o tools/cmgen/CMakeFiles/cmgen.dir/src/ProgressUpdater.cpp.o -o tools/cmgen/cmgen  libs/ibl/libibl.a  libs/imageio/libimageio.a  third_party/getopt/libgetopt.a  libs/image/libimage.a  libs/math/libmath.a  libs/utils/libutils.a  -ldl  -lpng  -ltinyexr  -lz  -lbasis_encoder && :
/usr/bin/ld: cannot find -ltinyexr: No such file or directory
/usr/bin/ld: cannot find -lbasis_encoder: No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

@dg0yt
Copy link
Contributor

dg0yt commented Nov 2, 2024

I don't see any -L flags.

@dg0yt
Copy link
Contributor

dg0yt commented Nov 2, 2024

Maybe the "targets" are not targets where they are used? They are not namespaced, so you don't get good diagnostics. Try using the GLOBAL option to find_package.

@aminya
Copy link
Contributor Author

aminya commented Nov 4, 2024

Maybe the "targets" are not targets where they are used? They are not namespaced, so you don't get good diagnostics. Try using the GLOBAL option to find_package.

Thanks, I added GLOBAL and it fixed the issue!

@dg0yt
Copy link
Contributor

dg0yt commented Nov 4, 2024

Maybe the "targets" are not targets where they are used? They are not namespaced, so you don't get good diagnostics. Try using the GLOBAL option to find_package.

Thanks, I added GLOBAL and it fixed the issue!

Thanks for the feedback. Taken as an example to https://gitlab.kitware.com/cmake/cmake/-/issues/25866.

@aminya
Copy link
Contributor Author

aminya commented Nov 4, 2024

It seems all the build system issues are resolved. Now, I am hitting some linker errors because of the differences between how Filament uses its vendored Glslang, spirv, civetweb, etc.

[206/500] : && /usr/lib/llvm-18/bin/clang++ -fPIC -std=c++17 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations -fPIC -fcolor-diagnostics -fvisibility=hidden -DTNT_DEV -g -fstack-protector -Wl,--gc-sections tools/matc/CMakeFiles/matc.dir/src/main.cpp.o -o tools/matc/matc  tools/matc/libmatlang.a  third_party/getopt/libgetopt.a  libs/filamat/libfilamat.a  shaders/libshaders.a  third_party/smol-v/tnt/libsmol-v.a  -Wl,--start-group  ./installed/x64-linux/debug/lib/libSPIRV.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools-opt.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools.a  -lrt  ./installed/x64-linux/debug/lib/libspirv-cross-glsl.a  ./installed/x64-linux/debug/lib/libspirv-cross-core.a  -Wl,--end-group  libs/filabridge/libfilabridge.a  libs/math/libmath.a  libs/utils/libutils.a  -ldl && :
FAILED: tools/matc/matc 
: && /usr/lib/llvm-18/bin/clang++ -fPIC -std=c++17 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations -fPIC -fcolor-diagnostics -fvisibility=hidden -DTNT_DEV -g -fstack-protector -Wl,--gc-sections tools/matc/CMakeFiles/matc.dir/src/main.cpp.o -o tools/matc/matc  tools/matc/libmatlang.a  third_party/getopt/libgetopt.a  libs/filamat/libfilamat.a  shaders/libshaders.a  third_party/smol-v/tnt/libsmol-v.a  -Wl,--start-group  ./installed/x64-linux/debug/lib/libSPIRV.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools-opt.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools.a  -lrt  ./installed/x64-linux/debug/lib/libspirv-cross-glsl.a  ./installed/x64-linux/debug/lib/libspirv-cross-core.a  -Wl,--end-group  libs/filabridge/libfilabridge.a  libs/math/libmath.a  libs/utils/libutils.a  -ldl && :
/usr/bin/ld: warning: shaders.S.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `filamat::GLSLPostProcessor::spirvToMsl(std::vector<unsigned int, std::allocator<unsigned int> > const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, filament::backend::ShaderStage, filament::backend::ShaderModel, bool, std::array<utils::FixedCapacityVector<std::tuple<utils::CString, filament::backend::DescriptorSetLayoutBinding, std::optional<filament::SamplerInterfaceBlock::SamplerInfo> >, std::allocator<std::tuple<utils::CString, filament::backend::DescriptorSetLayoutBinding, std::optional<filament::SamplerInterfaceBlock::SamplerInfo> > >, true>, 4ul> const&, filamat::ShaderMinifier const*)':
./buildtrees/filament/src/v1.55.0-5cc38bf927/libs/filamat/src/GLSLPostProcessor.cpp:350:(.text+0x931): undefined reference to `spirv_cross::CompilerMSL::CompilerMSL(std::vector<unsigned int, std::allocator<unsigned int> >)'
/usr/bin/ld: ./buildtrees/filament/src/v1.55.0-5cc38bf927/libs/filamat/src/GLSLPostProcessor.cpp:453:(.text+0x1208): undefined reference to `spirv_cross::CompilerMSL::add_dynamic_buffer(unsigned int, unsigned int, unsigned int)'
/usr/bin/ld: ./buildtrees/filament/src/v1.55.0-5cc38bf927/libs/filamat/src/GLSLPostProcessor.cpp:482:(.text+0x161a): undefined reference to `spirv_cross::CompilerMSL::add_msl_resource_binding(spirv_cross::MSLResourceBinding const&)'
/usr/bin/ld: ./buildtrees/filament/src/v1.55.0-5cc38bf927/libs/filamat/src/GLSLPostProcessor.cpp:484:(.text+0x1632): undefined reference to `spirv_cross::CompilerMSL::compile[abi:cxx11]()'
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `filamat::GLSLPostProcessor::spirvToMsl(std::vector<unsigned int, std::allocator<unsigned int> > const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, filament::backend::ShaderStage, filament::backend::ShaderModel, bool, std::array<utils::FixedCapacityVector<std::tuple<utils::CString, filament::backend::DescriptorSetLayoutBinding, std::optional<filament::SamplerInterfaceBlock::SamplerInfo> >, std::allocator<std::tuple<utils::CString, filament::backend::DescriptorSetLayoutBinding, std::optional<filament::SamplerInterfaceBlock::SamplerInfo> > >, true>, 4ul> const&, filamat::ShaderMinifier const*)::$_0::operator()(unsigned int, unsigned int) const':
./buildtrees/filament/src/v1.55.0-5cc38bf927/libs/filamat/src/GLSLPostProcessor.cpp:392:(.text+0x18d1): undefined reference to `spirv_cross::CompilerMSL::add_msl_resource_binding(spirv_cross::MSLResourceBinding const&)'
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `filamat::GLSLPostProcessor::optimizeSpirv(std::shared_ptr<spvtools::Optimizer>, std::vector<unsigned int, std::allocator<unsigned int> >&) const':
./buildtrees/filament/src/v1.55.0-5cc38bf927/libs/filamat/src/GLSLPostProcessor.cpp:847:(.text+0x3f50): undefined reference to `spv::spirvbin_t::remap(std::vector<unsigned int, std::allocator<unsigned int> >&, unsigned int)'
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `spv::spirvbin_t::registerErrorHandler(std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>)':
./installed/x64-linux/include/glslang/SPIRV/SPVRemapper.h:121:(.text._ZN3spv10spirvbin_t20registerErrorHandlerESt8functionIFvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE[_ZN3spv10spirvbin_t20registerErrorHandlerESt8functionIFvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE]+0x12): undefined reference to `spv::spirvbin_t::errorHandler[abi:cxx11]'
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `spirv_cross::CompilerMSL::~CompilerMSL()':
./installed/x64-linux/include/spirv_cross/spirv_msl.hpp:291:(.text._ZN11spirv_cross11CompilerMSLD2Ev[_ZN11spirv_cross11CompilerMSLD2Ev]+0x17): undefined reference to `vtable for spirv_cross::CompilerMSL'
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `spv::spirvbin_t::spirvbin_t(int)':
./installed/x64-linux/include/glslang/SPIRV/SPVRemapper.h:105:(.text._ZN3spv10spirvbin_tC2Ei[_ZN3spv10spirvbin_tC2Ei]+0x1a): undefined reference to `vtable for spv::spirvbin_t'
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `spv::spirvbin_t::~spirvbin_t()':
./installed/x64-linux/include/glslang/SPIRV/SPVRemapper.h:107:(.text._ZN3spv10spirvbin_tD2Ev[_ZN3spv10spirvbin_tD2Ev]+0x17): undefined reference to `vtable for spv::spirvbin_t'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[207/500] : && /usr/lib/llvm-18/bin/clang++ -fPIC -std=c++17 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations -fPIC -fcolor-diagnostics -fvisibility=hidden -DTNT_DEV -g -fstack-protector -Wl,--gc-sections tools/matinfo/CMakeFiles/matinfo.dir/src/main.cpp.o -o tools/matinfo/matinfo  libs/matdbg/libmatdbg.a  libs/filaflat/libfilaflat.a  third_party/getopt/libgetopt.a  ./installed/x64-linux/debug/lib/libcivetweb.a  ./installed/x64-linux/debug/lib/libz.a  libs/filamat/libfilamat.a  libs/filabridge/libfilabridge.a  libs/math/libmath.a  third_party/smol-v/tnt/libsmol-v.a  shaders/libshaders.a  -Wl,--start-group  -Wl,--end-group  libs/matdbg/libmatdbg_resources.a  ./installed/x64-linux/debug/lib/libSPIRV.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools-opt.a  ./installed/x64-linux/debug/lib/libspirv-cross-glsl.a  ./installed/x64-linux/debug/lib/libspirv-cross-core.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools.a  -lrt  libs/utils/libutils.a  -ldl && :
FAILED: tools/matinfo/matinfo 
: && /usr/lib/llvm-18/bin/clang++ -fPIC -std=c++17 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations -fPIC -fcolor-diagnostics -fvisibility=hidden -DTNT_DEV -g -fstack-protector -Wl,--gc-sections tools/matinfo/CMakeFiles/matinfo.dir/src/main.cpp.o -o tools/matinfo/matinfo  libs/matdbg/libmatdbg.a  libs/filaflat/libfilaflat.a  third_party/getopt/libgetopt.a  ./installed/x64-linux/debug/lib/libcivetweb.a  ./installed/x64-linux/debug/lib/libz.a  libs/filamat/libfilamat.a  libs/filabridge/libfilabridge.a  libs/math/libmath.a  third_party/smol-v/tnt/libsmol-v.a  shaders/libshaders.a  -Wl,--start-group  -Wl,--end-group  libs/matdbg/libmatdbg_resources.a  ./installed/x64-linux/debug/lib/libSPIRV.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools-opt.a  ./installed/x64-linux/debug/lib/libspirv-cross-glsl.a  ./installed/x64-linux/debug/lib/libspirv-cross-core.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools.a  -lrt  libs/utils/libutils.a  -ldl && :
/usr/bin/ld: warning: matdbg_resources.S.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o): in function `filament::matdbg::DebugServer::DebugServer(filament::backend::Backend, int)':
./buildtrees/filament/src/v1.55.0-5cc38bf927/libs/matdbg/src/DebugServer.cpp:155:(.text+0x36f): undefined reference to `CivetServer::CivetServer(char const**, CivetCallbacks const*, void const*)'
/usr/bin/ld: ./buildtrees/filament/src/v1.55.0-5cc38bf927/libs/matdbg/src/DebugServer.cpp:166:(.text+0x547): undefined reference to `CivetServer::addHandler(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, CivetHandler*)'
/usr/bin/ld: ./buildtrees/filament/src/v1.55.0-5cc38bf927/libs/matdbg/src/DebugServer.cpp:167:(.text+0x5cd): undefined reference to `CivetServer::addHandler(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, CivetHandler*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o): in function `filament::matdbg::DebugServer::~DebugServer()':
./buildtrees/filament/src/v1.55.0-5cc38bf927/libs/matdbg/src/DebugServer.cpp:176:(.text+0x817): undefined reference to `CivetServer::close()'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o): in function `CivetHandler::CivetHandler()':
./installed/x64-linux/include/CivetServer.h:51:(.text._ZN12CivetHandlerC2Ev[_ZN12CivetHandlerC2Ev]+0xf): undefined reference to `vtable for CivetHandler'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x28): undefined reference to `CivetHandler::handleGet(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x30): undefined reference to `CivetHandler::handlePost(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x38): undefined reference to `CivetHandler::handlePost(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x40): undefined reference to `CivetHandler::handleHead(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x48): undefined reference to `CivetHandler::handleHead(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x50): undefined reference to `CivetHandler::handlePut(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x58): undefined reference to `CivetHandler::handlePut(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x60): undefined reference to `CivetHandler::handleDelete(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x68): undefined reference to `CivetHandler::handleDelete(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x70): undefined reference to `CivetHandler::handleOptions(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x78): undefined reference to `CivetHandler::handleOptions(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x80): undefined reference to `CivetHandler::handlePatch(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x88): undefined reference to `CivetHandler::handlePatch(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTIN8filament6matdbg18FileRequestHandlerE[_ZTIN8filament6matdbg18FileRequestHandlerE]+0x10): undefined reference to `typeinfo for CivetHandler'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro+0x28): undefined reference to `CivetHandler::handleGet(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro+0x38): undefined reference to `CivetHandler::handlePost(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro+0x40): undefined reference to `CivetHandler::handleHead(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro+0x48): undefined reference to `CivetHandler::handleHead(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro+0x50): undefined reference to `CivetHandler::handlePut(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro+0x58): undefined reference to `CivetHandler::handlePut(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro+0x60): undefined reference to `CivetHandler::handleDelete(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro+0x68): undefined reference to `CivetHandler::handleDelete(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro+0x70): undefined reference to `CivetHandler::handleOptions(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro+0x78): undefined reference to `CivetHandler::handleOptions(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro+0x80): undefined reference to `CivetHandler::handlePatch(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro+0x88): undefined reference to `CivetHandler::handlePatch(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro+0xa0): undefined reference to `typeinfo for CivetHandler'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

@dg0yt
Copy link
Contributor

dg0yt commented Nov 4, 2024

Now, I am hitting some linker errors because of the differences between how Filament uses its vendored Glslang, spirv, civetweb, etc.

Maybe that's a good intermediate result? Without de-vendoring, such issues might be offloaded to the users of vpckg ports...

@LilyWangLL LilyWangLL added the category:new-port The issue is requesting a new library to be added; consider making a PR! label Nov 4, 2024
@aminya
Copy link
Contributor Author

aminya commented Nov 5, 2024

Now, I am hitting some linker errors because of the differences between how Filament uses its vendored Glslang, spirv, civetweb, etc.

Maybe that's a good intermediate result? Without de-vendoring, such issues might be offloaded to the users of vpckg ports...

Yes, it's a good progress. However, the issue is happening because of de-vendoring. They use custom CMake for glslang, spirv, civetweb, and the versions they use are different from the vcpkg versions.

I tried with GCC, and I get a similar error. Inside the CI, there are other errors that must be resolved.

[206/500] : && /usr/bin/g++ -fPIC -std=c++17 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations -fPIC -fvisibility=hidden -DTNT_DEV -g -fstack-protector -Wl,--gc-sections tools/matc/CMakeFiles/matc.dir/src/main.cpp.o -o tools/matc/matc -L/usr/lib/gcc/x86_64-linux-gnu/13 tools/matc/libmatlang.a  third_party/getopt/libgetopt.a  libs/filamat/libfilamat.a  shaders/libshaders.a  third_party/smol-v/tnt/libsmol-v.a  -Wl,--start-group  ./installed/x64-linux/debug/lib/libSPIRV.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools-opt.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools.a  -lrt  ./installed/x64-linux/debug/lib/libspirv-cross-glsl.a  ./installed/x64-linux/debug/lib/libspirv-cross-core.a  -Wl,--end-group  libs/filabridge/libfilabridge.a  libs/math/libmath.a  libs/utils/libutils.a  -ldl && :
FAILED: tools/matc/matc 
: && /usr/bin/g++ -fPIC -std=c++17 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations -fPIC -fvisibility=hidden -DTNT_DEV -g -fstack-protector -Wl,--gc-sections tools/matc/CMakeFiles/matc.dir/src/main.cpp.o -o tools/matc/matc -L/usr/lib/gcc/x86_64-linux-gnu/13 tools/matc/libmatlang.a  third_party/getopt/libgetopt.a  libs/filamat/libfilamat.a  shaders/libshaders.a  third_party/smol-v/tnt/libsmol-v.a  -Wl,--start-group  ./installed/x64-linux/debug/lib/libSPIRV.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools-opt.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools.a  -lrt  ./installed/x64-linux/debug/lib/libspirv-cross-glsl.a  ./installed/x64-linux/debug/lib/libspirv-cross-core.a  -Wl,--end-group  libs/filabridge/libfilabridge.a  libs/math/libmath.a  libs/utils/libutils.a  -ldl && :
/usr/bin/ld: warning: shaders.S.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `filamat::GLSLPostProcessor::spirvToMsl(std::vector<unsigned int, std::allocator<unsigned int> > const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, filament::backend::ShaderStage, filament::backend::ShaderModel, bool, std::array<utils::FixedCapacityVector<std::tuple<utils::CString, filament::backend::DescriptorSetLayoutBinding, std::optional<filament::SamplerInterfaceBlock::SamplerInfo> >, std::allocator<std::tuple<utils::CString, filament::backend::DescriptorSetLayoutBinding, std::optional<filament::SamplerInterfaceBlock::SamplerInfo> > >, true>, 4ul> const&, filamat::ShaderMinifier const*)::{lambda(unsigned int, unsigned int)#1}::operator()(unsigned int, unsigned int) const':
./buildtrees/filament/src/v1.55.0-8c9bcb1d21/libs/filamat/src/GLSLPostProcessor.cpp:392:(.text+0x1366): undefined reference to `spirv_cross::CompilerMSL::add_msl_resource_binding(spirv_cross::MSLResourceBinding const&)'
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `filamat::GLSLPostProcessor::spirvToMsl(std::vector<unsigned int, std::allocator<unsigned int> > const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, filament::backend::ShaderStage, filament::backend::ShaderModel, bool, std::array<utils::FixedCapacityVector<std::tuple<utils::CString, filament::backend::DescriptorSetLayoutBinding, std::optional<filament::SamplerInterfaceBlock::SamplerInfo> >, std::allocator<std::tuple<utils::CString, filament::backend::DescriptorSetLayoutBinding, std::optional<filament::SamplerInterfaceBlock::SamplerInfo> > >, true>, 4ul> const&, filamat::ShaderMinifier const*)':
    ./buildtrees/filament/src/v1.55.0-8c9bcb1d21/libs/filamat/src/GLSLPostProcessor.cpp:350:(.text+0x1411): undefined reference to `spirv_cross::CompilerMSL::CompilerMSL(std::vector<unsigned int, std::allocator<unsigned int> >)'
/usr/bin/ld: ./buildtrees/filament/src/v1.55.0-8c9bcb1d21/libs/filamat/src/GLSLPostProcessor.cpp:453:(.text+0x1b0c): undefined reference to `spirv_cross::CompilerMSL::add_dynamic_buffer(unsigned int, unsigned int, unsigned int)'
/usr/bin/ld: ./buildtrees/filament/src/v1.55.0-8c9bcb1d21/libs/filamat/src/GLSLPostProcessor.cpp:482:(.text+0x1dc6): undefined reference to `spirv_cross::CompilerMSL::add_msl_resource_binding(spirv_cross::MSLResourceBinding const&)'
/usr/bin/ld: ./buildtrees/filament/src/v1.55.0-8c9bcb1d21/libs/filamat/src/GLSLPostProcessor.cpp:484:(.text+0x1ddf): undefined reference to `spirv_cross::CompilerMSL::compile[abi:cxx11]()'
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `filamat::GLSLPostProcessor::optimizeSpirv(std::shared_ptr<spvtools::Optimizer>, std::vector<unsigned int, std::allocator<unsigned int> >&) const':
./buildtrees/filament/src/v1.55.0-8c9bcb1d21/libs/filamat/src/GLSLPostProcessor.cpp:847:(.text+0x3d5b): undefined reference to `spv::spirvbin_t::remap(std::vector<unsigned int, std::allocator<unsigned int> >&, unsigned int)'
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `spv::spirvbin_t::spirvbin_t(int)':
./installed/x64-linux/include/glslang/SPIRV/SPVRemapper.h:104:(.text._ZN3spv10spirvbin_tC2Ei[_ZN3spv10spirvbin_tC5Ei]+0x16): undefined reference to `vtable for spv::spirvbin_t'
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `spv::spirvbin_t::~spirvbin_t()':
./installed/x64-linux/include/glslang/SPIRV/SPVRemapper.h:107:(.text._ZN3spv10spirvbin_tD2Ev[_ZN3spv10spirvbin_tD5Ev]+0x13): undefined reference to `vtable for spv::spirvbin_t'
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `spv::spirvbin_t::registerErrorHandler(std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>)':
./installed/x64-linux/include/glslang/SPIRV/SPVRemapper.h:121:(.text._ZN3spv10spirvbin_t20registerErrorHandlerESt8functionIFvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE[_ZN3spv10spirvbin_t20registerErrorHandlerESt8functionIFvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE]+0x1a): undefined reference to `spv::spirvbin_t::errorHandler[abi:cxx11]'
/usr/bin/ld: libs/filamat/libfilamat.a(GLSLPostProcessor.cpp.o): in function `spirv_cross::CompilerMSL::~CompilerMSL()':
./installed/x64-linux/include/spirv_cross/spirv_msl.hpp:291:(.text._ZN11spirv_cross11CompilerMSLD2Ev[_ZN11spirv_cross11CompilerMSLD5Ev]+0x13): undefined reference to `vtable for spirv_cross::CompilerMSL'
collect2: error: ld returned 1 exit status
[207/500] : && /usr/bin/g++ -fPIC -std=c++17 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations -fPIC -fvisibility=hidden -DTNT_DEV -g -fstack-protector -Wl,--gc-sections tools/matinfo/CMakeFiles/matinfo.dir/src/main.cpp.o -o tools/matinfo/matinfo -L/usr/lib/gcc/x86_64-linux-gnu/13 libs/matdbg/libmatdbg.a  libs/filaflat/libfilaflat.a  third_party/getopt/libgetopt.a  ./installed/x64-linux/debug/lib/libcivetweb.a  ./installed/x64-linux/debug/lib/libz.a  libs/filamat/libfilamat.a  libs/filabridge/libfilabridge.a  libs/math/libmath.a  third_party/smol-v/tnt/libsmol-v.a  shaders/libshaders.a  -Wl,--start-group  -Wl,--end-group  libs/matdbg/libmatdbg_resources.a  ./installed/x64-linux/debug/lib/libSPIRV.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools-opt.a  ./installed/x64-linux/debug/lib/libspirv-cross-glsl.a  ./installed/x64-linux/debug/lib/libspirv-cross-core.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools.a  -lrt  libs/utils/libutils.a  -ldl && :
FAILED: tools/matinfo/matinfo 
: && /usr/bin/g++ -fPIC -std=c++17 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations -fPIC -fvisibility=hidden -DTNT_DEV -g -fstack-protector -Wl,--gc-sections tools/matinfo/CMakeFiles/matinfo.dir/src/main.cpp.o -o tools/matinfo/matinfo -L/usr/lib/gcc/x86_64-linux-gnu/13 libs/matdbg/libmatdbg.a  libs/filaflat/libfilaflat.a  third_party/getopt/libgetopt.a  ./installed/x64-linux/debug/lib/libcivetweb.a  ./installed/x64-linux/debug/lib/libz.a  libs/filamat/libfilamat.a  libs/filabridge/libfilabridge.a  libs/math/libmath.a  third_party/smol-v/tnt/libsmol-v.a  shaders/libshaders.a  -Wl,--start-group  -Wl,--end-group  libs/matdbg/libmatdbg_resources.a  ./installed/x64-linux/debug/lib/libSPIRV.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libglslang.a  ./installed/x64-linux/debug/lib/libMachineIndependent.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools-opt.a  ./installed/x64-linux/debug/lib/libspirv-cross-glsl.a  ./installed/x64-linux/debug/lib/libspirv-cross-core.a  ./installed/x64-linux/debug/lib/libSPIRV-Tools.a  -lrt  libs/utils/libutils.a  -ldl && :
/usr/bin/ld: warning: matdbg_resources.S.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o): in function `filament::matdbg::DebugServer::DebugServer(filament::backend::Backend, int)':
./buildtrees/filament/src/v1.55.0-8c9bcb1d21/libs/matdbg/src/DebugServer.cpp:155:(.text+0x4f6): undefined reference to `CivetServer::CivetServer(char const**, CivetCallbacks const*, void const*)'
/usr/bin/ld: ./buildtrees/filament/src/v1.55.0-8c9bcb1d21/libs/matdbg/src/DebugServer.cpp:166:(.text+0x63a): undefined reference to `CivetServer::addHandler(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, CivetHandler*)'
/usr/bin/ld: ./buildtrees/filament/src/v1.55.0-8c9bcb1d21/libs/matdbg/src/DebugServer.cpp:167:(.text+0x6ae): undefined reference to `CivetServer::addHandler(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, CivetHandler*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o): in function `filament::matdbg::DebugServer::~DebugServer()':
./buildtrees/filament/src/v1.55.0-8c9bcb1d21/libs/matdbg/src/DebugServer.cpp:176:(.text+0x895): undefined reference to `CivetServer::close()'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o): in function `CivetHandler::~CivetHandler()':
./installed/x64-linux/include/CivetServer.h:58:(.text._ZN12CivetHandlerD2Ev[_ZN12CivetHandlerD5Ev]+0xf): undefined reference to `vtable for CivetHandler'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o): in function `CivetHandler::CivetHandler()':
./installed/x64-linux/include/CivetServer.h:51:(.text._ZN12CivetHandlerC2Ev[_ZN12CivetHandlerC5Ev]+0xf): undefined reference to `vtable for CivetHandler'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x28): undefined reference to `CivetHandler::handleGet(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x30): undefined reference to `CivetHandler::handlePost(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x38): undefined reference to `CivetHandler::handlePost(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x40): undefined reference to `CivetHandler::handleHead(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x48): undefined reference to `CivetHandler::handleHead(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x50): undefined reference to `CivetHandler::handlePut(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x58): undefined reference to `CivetHandler::handlePut(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x60): undefined reference to `CivetHandler::handleDelete(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x68): undefined reference to `CivetHandler::handleDelete(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x70): undefined reference to `CivetHandler::handleOptions(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x78): undefined reference to `CivetHandler::handleOptions(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x80): undefined reference to `CivetHandler::handlePatch(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg18FileRequestHandlerE[_ZTVN8filament6matdbg18FileRequestHandlerE]+0x88): undefined reference to `CivetHandler::handlePatch(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(DebugServer.cpp.o):(.data.rel.ro._ZTIN8filament6matdbg18FileRequestHandlerE[_ZTIN8filament6matdbg18FileRequestHandlerE]+0x10): undefined reference to `typeinfo for CivetHandler'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg10ApiHandlerE[_ZTVN8filament6matdbg10ApiHandlerE]+0x28): undefined reference to `CivetHandler::handleGet(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg10ApiHandlerE[_ZTVN8filament6matdbg10ApiHandlerE]+0x38): undefined reference to `CivetHandler::handlePost(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg10ApiHandlerE[_ZTVN8filament6matdbg10ApiHandlerE]+0x40): undefined reference to `CivetHandler::handleHead(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg10ApiHandlerE[_ZTVN8filament6matdbg10ApiHandlerE]+0x48): undefined reference to `CivetHandler::handleHead(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg10ApiHandlerE[_ZTVN8filament6matdbg10ApiHandlerE]+0x50): undefined reference to `CivetHandler::handlePut(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg10ApiHandlerE[_ZTVN8filament6matdbg10ApiHandlerE]+0x58): undefined reference to `CivetHandler::handlePut(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg10ApiHandlerE[_ZTVN8filament6matdbg10ApiHandlerE]+0x60): undefined reference to `CivetHandler::handleDelete(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg10ApiHandlerE[_ZTVN8filament6matdbg10ApiHandlerE]+0x68): undefined reference to `CivetHandler::handleDelete(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg10ApiHandlerE[_ZTVN8filament6matdbg10ApiHandlerE]+0x70): undefined reference to `CivetHandler::handleOptions(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg10ApiHandlerE[_ZTVN8filament6matdbg10ApiHandlerE]+0x78): undefined reference to `CivetHandler::handleOptions(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg10ApiHandlerE[_ZTVN8filament6matdbg10ApiHandlerE]+0x80): undefined reference to `CivetHandler::handlePatch(CivetServer*, mg_connection*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro._ZTVN8filament6matdbg10ApiHandlerE[_ZTVN8filament6matdbg10ApiHandlerE]+0x88): undefined reference to `CivetHandler::handlePatch(CivetServer*, mg_connection*, int*)'
/usr/bin/ld: libs/matdbg/libmatdbg.a(ApiHandler.cpp.o):(.data.rel.ro._ZTIN8filament6matdbg10ApiHandlerE[_ZTIN8filament6matdbg10ApiHandlerE]+0x10): undefined reference to `typeinfo for CivetHandler'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

@aminya
Copy link
Contributor Author

aminya commented Nov 6, 2024

Got a successful build with Clang on Linux! 🎉

image

@aminya aminya marked this pull request as ready for review November 6, 2024 18:25
@aminya
Copy link
Contributor Author

aminya commented Nov 7, 2024

Getting Filament to build with gcc is too much work. There are numerous compiler errors that need to be resolved, which is out of the scope of this PR. I have added the clang requirement in the port for Linux.

Comment on lines +36 to +37
vcpkg_find_acquire_program(CLANG)
set(COMPILER -DCMAKE_CXX_COMPILER=${CLANG}++ -DCMAKE_C_COMPILER=${CLANG})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ports must not change the compiler like this.
CI can expect it to fail via scripts/ci.baseline.txt.

The portfile can print a message. (If you want a conditional message, you could vcpkg_cmake_get_vars.)

Copy link
Contributor Author

@aminya aminya Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? Ports can have compiler requirements, and this line declares that. I patched the original CMake not to error on gcc, but if vcpkg is against that, I will revert that patch. The compilation fails with gcc towards the ends. It is quite wasteful not to error out early and let the users know about the clang requirement.
I'd either keep the original requirement in CMakeLists.txt or here in vcpkg.

Another benefit of keeping this in vcpkg is that we can build filament with clang but link to it from gcc. Not having this, forces the users to use Clang for everything!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The toolchain - including compiler - is controlled by the triplet. Users may use per-port customization in triplet files.

To error out early, use vcpkg_cmake_get_vars to get toolchain information.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using gcc with clang built Filament? Not having this makes it unnecessarily hard.

ports/filament/usage Show resolved Hide resolved
@dg0yt
Copy link
Contributor

dg0yt commented Nov 8, 2024

The CMake config package is not provided by upstream. So the package name must be unofficial-filament, the target namespace must be unofficial::filament::, and the config installation dir must be changed accordingly.

@LilyWangLL
Copy link
Contributor

Please fix the build error:

CMake Error at CMakeLists.txt:942 (get_target_property):
  get_target_property() called with non-existent target "SPIRV-Headers".


CMake Error at CMakeLists.txt:943 (set_target_properties):
  set_target_properties Can not find target to add properties to:
  SPIRV-Headers


CMake Error at CMakeLists.txt:947 (install):
  install TARGETS given target "SPIRV-Headers" which does not exist.


CMake Error at CMakeLists.txt:948 (export):
  export given target "SPIRV-Headers" which is not built by this project.


CMake Error at CMakeLists.txt:967 (install):
  install TARGETS given target "bluevk" which does not exist.


CMake Error at CMakeLists.txt:968 (export):
  export given target "bluevk" which is not built by this project.

@LilyWangLL LilyWangLL marked this pull request as draft November 12, 2024 09:54
@LilyWangLL LilyWangLL closed this Nov 26, 2024
@LilyWangLL LilyWangLL reopened this Nov 26, 2024
@LilyWangLL LilyWangLL added the depends:upstream-changes Waiting on a change to the upstream project label Nov 26, 2024
@aminya
Copy link
Contributor Author

aminya commented Nov 26, 2024

I am waiting upstream to merge the changes. I didn't wanna add the unofficial prefix as it doesn't make sense to me.

@dg0yt
Copy link
Contributor

dg0yt commented Nov 26, 2024

I am waiting upstream to merge the changes. I didn't wanna add the unofficial prefix as it doesn't make sense to me.

google/filament#8267

It is a pity that you didn't leave a note.
We don't know the reason for delay.
We can't review the upstream PR.
And we can't learn from having it already as unofficial in vcpkg.

@dg0yt
Copy link
Contributor

dg0yt commented Nov 26, 2024

The upstream PR has changes to directories with third-party code. vk_mem_alloc.h also lives in port vulkan-memory-allocator. So there might be more work to be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:new-port The issue is requesting a new library to be added; consider making a PR! depends:upstream-changes Waiting on a change to the upstream project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[filament] google filament [New Port Request] filament
3 participants