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

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 opened this issue Oct 27, 2021 · 5 comments

Comments

@frantisekz
Copy link
Contributor

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
Copy link
Contributor

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 #148 (comment) 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
Copy link
Contributor Author

frantisekz commented Oct 29, 2021

@ArchangeGabriel thanks for the reply.

I've:

  • removed -DINSTALL_SPIRVDLL=0 and -DIGC_OPTION__PACKAGE_RELEASE=8708
  • pulled in lld: copy unwind only when building from source #210
  • added in all the Prebuilds flags (clang, lld, llvm)
  • switched vc-intrinsics to he exact commit noted in the used igc release
  • tried to switch to llvm, clang, lld instead of gcc
  • tried to switch off lto

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
Copy link
Contributor Author

@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
Copy link
Contributor Author

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 frantisekz changed the title Failure to build 1.0.8744 : IGC/VectorCompiler/CMCL/tools/Translator/Main.cpp:46: undefined reference to `cmcl::translateBuiltins(llvm::Module&)' 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 Nov 18, 2021
@frantisekz
Copy link
Contributor Author

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

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

2 participants