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

Fail to cross-compile using Synology toolchain (x86_64 -> x86_64) using prebuilds #334

Open
th0ma7 opened this issue Jul 12, 2024 · 3 comments

Comments

@th0ma7
Copy link

th0ma7 commented Jul 12, 2024

I'm the ffmpeg maintainer for the SynoCommunity which aims at porting open source software on Synology NAS using the Synology toolchain for their various Linux DSM versions. We're using our https://github.com/SynoCommunity/spksrc framework to cross-compile to various arch (arm, ppc, x64).

I'm working on enabling --opencl to ffmpeg for compatible intel based NAS (apollolake and above). My [WIP] PR is SynoCommunity/spksrc#6166.

I was finally able to fully build intel-opencl-clang 140 branch with all corresponding requirements. From there I've been trying to get IGC to build using:

  • -DIGC_OPTION__CLANG_MODE='Prebuilds'
  • -DIGC_OPTION__LLVM_MODE='Prebuilds'
  • -DIGC_OPTION__SPIRV_TOOLS_MODE='Prebuilds'

Configure works ok (after needing to also include LLVM lld, libunwind and also Mako python wheel (all of which I couldn't find any trace of in the build documentation btw).

When invoking the build process I hit the following issue:

[84/986] Building CXX object IGC/VectorCompiler/CMCL/tools/Translator/CMakeFiles/CMCLTranslatorTool.dir/Main.cpp.o
[85/986] Building CXX object IGC/Compiler/CMakeFiles/Compiler.dir/compiler_caps.cpp.o
[86/986] Building CXX object IGC/VectorCompiler/CMCL/lib/Support/CMakeFiles/CMCLSupport.dir/BuiltinTranslator.cpp.o
[87/986] Linking CXX static library IGC/Release/libCMCLSupport.a
[88/986] Building CXX object IGC/VectorCompiler/lib/Utils/GenX/CMakeFiles/VCGenXUtils.dir/TransformArgCopy.cpp.o
[89/986] Linking CXX executable IGC/Release/CMCLTranslatorTool
FAILED: IGC/Release/CMCLTranslatorTool 
: && /home/spksrc/ffmpeg-opencl-140/spksrc/toolchain/syno-x64-7.1/work/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-g++ -I/home/spksrc/ffmpeg-opencl-140/spksrc/toolchain/syno-x64-7.1/work/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/include -I/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/include -I/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/SPIRV-LLVM-Translator/include -Wno-error=restrict -Wno-error=deprecated-declarations  -I/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/SPIRV-LLVM-Translator/include -Wno-error=restrict -Wno-error=deprecated-declarations -fexceptions -fdata-sections -ffunction-sections -O2 -pipe -fmessage-length=0 -march=corei7 -mstackrealign -fms-extensions -Werror -Wno-unused-parameter -Wno-missing-field-initializers -Wwrite-strings -Wno-long-long -Wswitch -Wno-sign-compare -Wno-unused-result -Wno-enum-compare -Wno-type-limits -Wno-ignored-qualifiers -Wno-shadow -Wformat -Wformat-security -Wno-extra -Wno-write-strings -finline -fno-strict-aliasing -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -Wno-unknown-pragmas -fPIC -Bsymbolic -D_FORTIFY_SOURCE=2 -fstack-protector -finline-functions -funswitch-loops -Wno-maybe-uninitialized -lrt -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -DNDEBUG -g -L/home/spksrc/ffmpeg-opencl-140/spksrc/toolchain/syno-x64-7.1/work/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/lib -L/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib -Wl,--rpath-link,/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib -Wl,--rpath,/usr/local/intel-graphics-compiler/lib -g -Wl,--gc-sections IGC/VectorCompiler/CMCL/tools/Translator/CMakeFiles/CMCLTranslatorTool.dir/Main.cpp.o -o IGC/Release/CMCLTranslatorTool  -Wl,-rpath,/usr/local/intel-graphics-compiler/lib  IGC/Release/libCMCLSupport.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMAnalysis.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMAsmParser.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMBinaryFormat.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMBitReader.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMBitstreamReader.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMCodeGen.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMCore.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMIRReader.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMMC.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMMCParser.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMObject.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMProfileData.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMRemarks.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMSupport.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMDemangle.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMBitWriter.a  IGC/Release/libLLVMGenXIntrinsics.so  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMCodeGen.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMBitWriter.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMScalarOpts.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMAggressiveInstCombine.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMInstCombine.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMTarget.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMTransformUtils.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMAnalysis.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMProfileData.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMDebugInfoDWARF.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMObject.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMMCParser.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMMC.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMDebugInfoCodeView.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMTextAPI.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMAsmParser.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMBitReader.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMCore.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMBinaryFormat.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMRemarks.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMBitstreamReader.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMSupport.a  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLLVMDemangle.a  -lrt  -ldl  -lpthread  -lm  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libz.so  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libncursesw.so && :
IGC/Release/libCMCLSupport.a(BuiltinTranslator.cpp.o): In function `llvm::Function* getGenXDeclarationForIdFromArgs<std::vector<llvm::Value*, std::allocator<llvm::Value*> >&>(llvm::Type&, std::vector<llvm::Value*, std::allocator<llvm::Value*> >&, llvm::GenXIntrinsic::ID, llvm::Module&)':
/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/intel-graphics-compiler-igc-1.0.16900.23/build/../IGC/VectorCompiler/CMCL/lib/Support/BuiltinTranslator.cpp:113: undefined reference to `llvm::GenXIntrinsic::isOverloadedRet(unsigned int)'
/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/intel-graphics-compiler-igc-1.0.16900.23/build/../IGC/VectorCompiler/CMCL/lib/Support/BuiltinTranslator.cpp:120: undefined reference to `llvm::GenXIntrinsic::isOverloadedArg(unsigned int, unsigned int)'
/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/intel-graphics-compiler-igc-1.0.16900.23/build/../IGC/VectorCompiler/CMCL/lib/Support/BuiltinTranslator.cpp:124: undefined reference to `llvm::GenXIntrinsic::getGenXDeclaration(llvm::Module*, llvm::GenXIntrinsic::ID, llvm::ArrayRef<llvm::Type*>)'
IGC/Release/libCMCLSupport.a(BuiltinTranslator.cpp.o): In function `llvm::Function* getGenXDeclarationForIdFromArgs<std::vector<llvm::Value*, std::allocator<llvm::Value*> > const&>(llvm::Type&, std::vector<llvm::Value*, std::allocator<llvm::Value*> > const&, llvm::GenXIntrinsic::ID, llvm::Module&)':
/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/intel-graphics-compiler-igc-1.0.16900.23/build/../IGC/VectorCompiler/CMCL/lib/Support/BuiltinTranslator.cpp:113: undefined reference to `llvm::GenXIntrinsic::isOverloadedRet(unsigned int)'
/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/intel-graphics-compiler-igc-1.0.16900.23/build/../IGC/VectorCompiler/CMCL/lib/Support/BuiltinTranslator.cpp:120: undefined reference to `llvm::GenXIntrinsic::isOverloadedArg(unsigned int, unsigned int)'
/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/intel-graphics-compiler-igc-1.0.16900.23/build/../IGC/VectorCompiler/CMCL/lib/Support/BuiltinTranslator.cpp:124: undefined reference to `llvm::GenXIntrinsic::getGenXDeclaration(llvm::Module*, llvm::GenXIntrinsic::ID, llvm::ArrayRef<llvm::Type*>)'
collect2: error: ld returned 1 exit status
[90/986] Building CXX object IGC/Compiler/CMakeFiles/Compiler.dir/UserAddrSpaceMD.cpp.o
[91/986] Building CXX object IGC/Compiler/CMakeFiles/Compiler.dir/CodeGenContextWrapper.cpp.o
[92/986] Building CXX object IGC/Compiler/CMakeFiles/Compiler.dir/BlendToDiscard.cpp.o
[93/986] Building CXX object IGC/Compiler/CMakeFiles/Compiler.dir/FixInvalidFuncNamePass.cpp.o
[94/986] Building CXX object IGC/Compiler/CMakeFiles/Compiler.dir/PromoteResourceToDirectAS.cpp.o
[95/986] Building CXX object IGC/Compiler/CMakeFiles/Compiler.dir/CodeGenContext.cpp.o
[96/986] Building CXX object IGC/GenISAIntrinsics/CMakeFiles/GenISAIntrinsics.dir/GenIntrinsicFunctions.cpp.o
[97/986] Building CXX object IGC/Compiler/CMakeFiles/Compiler.dir/CustomUnsafeOptPass.cpp.o
[98/986] Building CXX object IGC/Compiler/CMakeFiles/Compiler.dir/PromoteStatelessToBindless.cpp.o
[99/986] Building CXX object IGC/Compiler/CMakeFiles/Compiler.dir/GenTTI.cpp.o
[100/986] Building CXX object IGC/Compiler/CMakeFiles/Compiler.dir/CustomLoopOpt.cpp.o
[101/986] Building CXX object IGC/Compiler/CMakeFiles/Compiler.dir/FixResourcePtr.cpp.o
[102/986] Building CXX object IGC/Compiler/CMakeFiles/Compiler.dir/CustomSafeOptPass.cpp.o
ninja: build stopped: subcommand failed.
make[2]: *** [../../mk/spksrc.cross-ninja.mk:61: ninja_compile_target] Error 1
make[2]: Leaving directory '/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler'
make[1]: *** [../../mk/spksrc.supported.mk:71: build-arch-x64-7.1] Error 1
make[1]: Leaving directory '/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler'

Full build log available here: build-x64-7.1.log

@th0ma7
Copy link
Author

th0ma7 commented Aug 6, 2024

Using a newer version it looks like this error no longer exists (or build order as now changed and is not showing up yet.

Using the prebuilds of:

  • llvm* (14.0.5)
  • intel-opencl-clang (140)
  • intel-vc-intrinsics (either 0.18.0 or 0.19.0, no change)
  • and intel-level-zero (1.17.19, tried others, no change neither)

Along with the following build options:

CMAKE_ARGS += -DIGC_OPTION__CLANG_MODE='Prebuilds'
CMAKE_ARGS += -DIGC_OPTION__LLVM_MODE='Prebuilds'
CMAKE_ARGS += -DIGC_OPTION__LLVM_PREFERRED_VERSION='14.0.5'
CMAKE_ARGS += -DIGC_OPTION__LINK_KHRONOS_SPIRV_TRANSLATOR='ON'
CMAKE_ARGS += -DIGC_OPTION__SPIRV_TOOLS_MODE='Prebuilds'
CMAKE_ARGS += -DIGC_OPTION__VC_INTRINSICS_MODE='Prebuilds'
CMAKE_ARGS += -DCCLANG_FROM_SYSTEM='ON'
CMAKE_ARGS += -DINSTALL_GENX_IR='ON'

I now get the following error which looks odd llvm::Module::~Module()':

[388/989] Linking CXX shared library IGC/Release/libBiFManager.so
FAILED: IGC/Release/libBiFManager.so 
: && /home/spksrc/ffmpeg-opencl-140/spksrc/toolchain/syno-x64-7.1/work/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-g++ -fPIC -I/home/spksrc/ffmpeg-opencl-140/spksrc/toolchain/syno-x64-7.1/work/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/include -I/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/include -std=gnu++11 -Wno-error=restrict -Wno-error=deprecated-declarations  -std=gnu++11 -Wno-error=restrict -Wno-error=deprecated-declarations -fexceptions -fdata-sections -ffunction-sections -O2 -pipe -fmessage-length=0 -march=corei7 -mstackrealign -fms-extensions -Werror -Wno-unused-parameter -Wno-missing-field-initializers -Wwrite-strings -Wno-long-long -Wswitch -Wno-sign-compare -Wno-unused-result -Wno-enum-compare -Wno-type-limits -Wno-ignored-qualifiers -Wno-shadow -Wformat -Wformat-security -Wno-extra -Wno-write-strings -finline -fno-strict-aliasing -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -Wno-unknown-pragmas -fPIC -Bsymbolic -D_FORTIFY_SOURCE=2 -fstack-protector -finline-functions -funswitch-loops -Wno-maybe-uninitialized -lrt -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -DNDEBUG -g  -L/home/spksrc/ffmpeg-opencl-140/spksrc/toolchain/syno-x64-7.1/work/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/lib -L/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib -Wl,--rpath-link,/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib -Wl,--rpath,/usr/local/intel-graphics-compiler/lib    -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -g -Wl,--gc-sections -shared -Wl,-soname,libBiFManager.so -o IGC/Release/libBiFManager.so IGC/BiFManager/CMakeFiles/BiFManager.dir/BiFManagerHandler.cpp.o IGC/BiFManager/CMakeFiles/BiFManager.dir/BiFManagerCommon.cpp.o IGC/BiFManager/CMakeFiles/BiFManager.dir/__/AdaptorOCL/OCL/LoadBuffer.cpp.o  -Wl,-rpath,/usr/local/intel-graphics-compiler/lib && :
IGC/BiFManager/CMakeFiles/BiFManager.dir/BiFManagerHandler.cpp.o: In function `std::_Rb_tree<int, std::pair<int const, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> > >, std::_Select1st<std::pair<int const, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> > > >, std::less<int>, std::allocator<std::pair<int const, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> > > > >::_M_erase(std::_Rb_tree_node<std::pair<int const, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> > > >*)':
/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/intel-graphics-compiler-igc-1.0.17384.8/build/IGC/Release/bif/OCLBiFImpl.h:84096: undefined reference to `llvm::Module::~Module()'
collect2: error: ld returned 1 exit status
[389/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXVerify_Regioning.cpp.o
[390/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXCisaBuilder.cpp.o
[391/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXInitBiFConstants.cpp.o
[392/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXGVClobberChecker.cpp.o
[393/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLegacyToLscTranslator.cpp.o
[394/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLiveElements.cpp.o
[395/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLiveRanges.cpp.o
[396/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLegalization.cpp.o
[397/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLoadStoreLegalization.cpp.o
[398/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLiveness.cpp.o
[399/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLoadStoreLowering.cpp.o
[400/989] Building CXX object IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXIntrinsics.cpp.o
[401/989] Building CXX object IGC/BiFModule/linux/CMakeFiles/BiFLibOcl.dir/__/__/Release/bif/embedder/OCLBiFImpl__igc_bif_BIFBC_122.cpp.o
ninja: build stopped: subcommand failed.
make[2]: *** [../../mk/spksrc.cross-ninja.mk:61: ninja_compile_target] Error 1
make[2]: Leaving directory '/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler'
make[1]: Leaving directory '/home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler'

@th0ma7 th0ma7 changed the title Build error BuiltinTranslator.cpp:124: undefined reference to llvm::GenXIntrinsic::getGenXDeclaration Fail to cross-compile using Synology toolchain (x86_64 -> x86_64) using prebuilds Aug 6, 2024
@th0ma7
Copy link
Author

th0ma7 commented Aug 6, 2024

Looking at installed header files, ~Module looks there for llvm whereas install/usr/local/intel-graphics-compiler/include is included in the build flags.

$ grep -R "~Module" *
install/usr/local/intel-graphics-compiler/include/llvm/IR/Module.h:  ~Module();

Question then is, should include/llvm/IR/ also be included in the build flags?

@th0ma7
Copy link
Author

th0ma7 commented Aug 7, 2024

Problem ends-up being far more interesting...

Background:

igc builds a tool called CMCLTranslatorTool which in turn requires libLLVMGenXIntrinsics.so that gets installed by vc-intrinsics to run.

Issues found so far:

  1. intel-opencl-clang was having build issues as presuming it was a git clone rather than using source tar.gz. This led the build process to mess around with the unrelated git snapshot of my working repository (spksrc framework) and ended-up causing the build to fail. That was recently fixed with Do not apply patches if repo is a not a git repo. opencl-clang#539 and Do not apply patches if sub non-git repo is located in a git repo. opencl-clang#545 (thnx again @haonanya)
  2. vc-intrinsics when built in-tree with llvm from intel-opencl-clang ends-up not installing its cmake configuration leading to inability for igc to find it later on. This is without naming its tentative at build time to, yet this one again, to play with the current repository its sits in resulting in early build failure. I ended-up creating a rather ugly patch to get rid of: conjunction of SynoCommunity/spksrc@1db8da6#diff-06a450f52c459db410d62013f6e573344675c6e9f48b7aae5ab1e52ce4ca817e and SynoCommunity/spksrc@4ee454e (needs merging together). Installing vc-intrinsics over prebuilt opencl-clang + llvm ended-up working just fine (no patch needed, no git repository messing-up), including installing associated cmake configurations (for reference building in-tree from source error: Could not find FOUND_VCS vc-intrinsics#130)
$ tree cmake/VCIntrinsics14/
cmake/VCIntrinsics14/
├── VCIntrinsics14Config.cmake
└── VCIntrinsics14Config-release.cmake
  1. Returning on CMCLTranslatorTool. It hapens that it links itself to llvm/clang library + libLLVMGenXIntrinsics.so from vc-intrinsics. It hapens that, if llvm is built statically, thus in turn vc-intrinsics being also static, at linking time it ends-up linking twice to llvm/clang libraries as (i believe) also bundled in the vc-intrinsics library, thus fails. Enabling shared libraries at llvm/clang/opencl-clang in-tree solved that.
  2. Further, again relatively to CMCLTranslatorTool, interestingly this executable is being used later during build, although it wasn't built using NATIVE like other "in-build" tools like in a normal llvm build. In turn it requires accessing the target libraries to run properly (as remember, I'm cross-compiling against an arch toolchain). So I ended-up adding a LD_LIBRARY_PATH=$(STAGING_INSTALL_PREFIX)/lib so it can found that libLLVMGenXIntrinsics.so which was built for the target. As an alternate I tried finding that binary so I could just download and use during the build, no luck. My theory is that, if igc was being built in-tree with llvm, this "may" not be an issue and that binary would be built against NATIVE libraries.
  3. Now going back to where this leaves me, I believe that link-time failure above Fail to cross-compile using Synology toolchain (x86_64 -> x86_64) using prebuilds #334 (comment) indicate the inability for igc to link against llvm/clang shared libraries installed under the INSTALL_PREFIX and thus requires static linking.

So what's next?

Next on my todo is to revert back to building in-tree, now using the new -DAPPLY_PATCHES=OFF to allow opencl-clang to build, along with potentially re-applying my vc-intrinsics patch (as it otherwise fails in-tree), while hoping that this time CMCLTranslatorTool gets recognized as a NATIVE built tool, so it can work as-is during the build and therefore result in a (most probably) "static" build of igc.

Admittedly, my faith is relatively low and help so far inexistent (unless I've been opening my issue at the wrong place?). Anyhow, thnx in advance if anyone can give me pointers in figuring this one out.

Lastly, just to recall that I'm hopeful to be able to enable opencl in ffmpeg for our SynoCommunity ffmpeg package which in turns requires igc. Thnx in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant