intel / intel-graphics-compiler

Other
606 stars 158 forks source link

Failure to build 1.0.8744 : IGC/VectorCompiler/CMCL/tools/Translator/Main.cpp:46: undefined reference to `cmcl::translateBuiltins(llvm::Module&)' unless '-z,undefs' specified as LD flag #212

Closed frantisekz closed 2 years ago

frantisekz commented 3 years ago

Hi,

I am experimenting a bit with packaging bunch of Intel packages into Fedora (with ultimate goal of getting the media-driver there, including the kernels compilation). I need to use system llvm (13) for this instead of bundled llvm.

I am currently stuck with:

/usr/bin/ld: /tmp/ccc4Kh4i.ltrans0.ltrans.o: in function `main':
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.8744/IGC/VectorCompiler/CMCL/tools/Translator/Main.cpp:46: undefined reference to `cmcl::translateBuiltins(llvm::Module&)'
collect2: error: ld returned 1 exit status
gmake[2]: *** [IGC/VectorCompiler/CMCL/tools/Translator/CMakeFiles/CMCLTranslatorTool.dir/build.make:103: IGC/Release/CMCLTranslatorTool] Error 1
gmake[2]: Leaving directory '/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.8744/redhat-linux-build'
gmake[1]: *** [CMakeFiles/Makefile2:2775: IGC/VectorCompiler/CMCL/tools/Translator/CMakeFiles/CMCLTranslatorTool.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....

The entire buildlog could be viewed here: build-igc.log

I've had to add bunch of other fixes (namely some -Wno-error and a fix around clang-opencl soname not being parsed correctly). I'll create issues for these later if that's desired.

I can upload the entire src.rpm set if that's necessary.

Thanks in advance!

ArchangeGabriel commented 3 years ago

The need for -Wno-error is already fixed, see #209. Why do you have -DIGC_OPTION__PACKAGE_RELEASE=8708? AFAIK, -DINSTALL_SPIRVDLL=0 should not be used anymore, the new SPIRV_TRANSLATOR options replace it. See https://github.com/intel/intel-graphics-compiler/issues/148#issuecomment-916949103 for the impact this may have, which is likely your issue.

Also you might want:

    -DIGC_OPTION__CLANG_MODE=Prebuilds \
    -DIGC_OPTION__LLD_MODE=Prebuilds \
    -DIGC_OPTION__LLVM_MODE=Prebuilds \

but see #210 for LLD.

frantisekz commented 3 years ago

@ArchangeGabriel thanks for the reply.

I've:

However, it doesn't seem to help, I am still stuck with:

ld.lld: error: undefined symbol: cmcl::translateBuiltins(llvm::Module&)

or

/usr/bin/ld: /tmp/ccVQr7uz.ltrans0.ltrans.o: in function `main':
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.8744/IGC/VectorCompiler/CMCL/tools/Translator/Main.cpp:46: undefined reference to `cmcl::translateBuiltins(llvm::Module&)'
collect2: error: ld returned 1 exit status

build.log from llvm/lld: igc-llvm-build.log

I've created and I am using copr repository for building - which contains updated spirv llvm and packaged clang-opencl (which is still missing in Fedora and which I'll include once I get the entire chain up n working): https://copr.fedorainfracloud.org/coprs/frantisekz/intel-media-driver-free/

frantisekz commented 3 years ago

@JacekDanecki won't you have any idea what can be the cause of this? I've seen you've done a bit of Fedora/Copr packaging of igc and others...

Thanks!

frantisekz commented 2 years ago

The issue goes away by changing LDFLAGS from: '-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -flto'

to:

'-Wl,-z,relro -Wl,-z,undefs,-z,now -flto'

I'll leave the ticket open with the title changed, however, feel free to close it if this is expected.

frantisekz commented 2 years ago

The issue was in Fedora defaulting to -DBUILD_SHARED_LIBS:BOOL=ON .