Bug 239175 - lang/beignet: fails to build with llvm90
Summary: lang/beignet: fails to build with llvm90
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-x11 (Nobody)
URL:
Keywords: needs-qa, patch
Depends on:
Blocks:
 
Reported: 2019-07-12 21:35 UTC by Jan Beich
Modified: 2019-09-20 20:14 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (x11)
jbeich: maintainer-feedback? (brooks)


Attachments
incomplete fix (8.47 KB, patch)
2019-07-12 21:35 UTC, Jan Beich
no flags Details | Diff
poudriere log with linking errors (compressed) (14.08 KB, application/x-xz)
2019-07-12 21:38 UTC, Jan Beich
no flags Details
fix (12.66 KB, patch)
2019-08-07 11:17 UTC, Jan Beich
jbeich: maintainer-approval? (x11)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2019-07-12 21:35:20 UTC
Created attachment 205733 [details]
incomplete fix

$ echo 'DEFAULT_VERSIONS+=llvm=-devel' >>${__MAKE_CONF:-/etc/make.conf}
$ make
[...]
backend/src/llvm/llvm_intrinsic_lowering.cpp:80:19: error: no viable conversion from 'llvm::FunctionCallee' to 'llvm::Constant *'
        Constant* FCache = M->getOrInsertFunction(NewFn,
                  ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
backend/src/llvm/llvm_sampler_fix.cpp:85:18: error: no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
          Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
                 ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
backend/src/llvm/llvm_sampler_fix.cpp:127:18: error: no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
          Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
                 ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
backend/src/llvm/llvm_profiling.cpp:166:27: error: no matching function for call to 'cast'
      builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
                          ^~~~~~~~~~~~~~~~~~~~
backend/src/llvm/llvm_device_enqueue.cpp:401:52: error: no matching function for call to 'cast'
              CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
                                                   ^~~~~~~~~~~~~~~~~~~~
/usr/local/llvm-devel/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
                                           ^
/usr/local/llvm-devel/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y = llvm::FunctionCallee]
cast(const Y &Val) {
^
/usr/local/llvm-devel/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match 'Y *' against 'llvm::FunctionCallee'
inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
                                             ^
/usr/local/llvm-devel/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
cast(std::unique_ptr<Y> &&Val) {
^
/tmp/a/overlay/git-ports/lang/beignet/work/Beignet-1.3.2-Source/backend/src/llvm/llvm_profiling.cpp:188:25: error: no matching function for call to 'cast'
    builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
                        ^~~~~~~~~~~~~~~~~~~~
/usr/local/llvm-devel/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
                                           ^
/usr/local/llvm-devel/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y = llvm::FunctionCallee]
cast(const Y &Val) {
^
/usr/local/llvm-devel/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match 'Y *' against 'llvm::FunctionCallee'
inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
                                             ^
/usr/local/llvm-devel/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
cast(std::unique_ptr<Y> &&Val) {
^
Comment 1 Jan Beich freebsd_committer freebsd_triage 2019-07-12 21:38:11 UTC
Created attachment 205734 [details]
poudriere log with linking errors (compressed)

backend/src/libgbe.so: undefined reference to `clang::ast_matchers::internal::hasAnyNameFunc(llvm::ArrayRef<llvm::StringRef const*>)'
backend/src/libgbe.so: undefined reference to `clang::ast_matchers::anyOf'
backend/src/libgbe.so: undefined reference to `clang::ast_matchers::internal::BoundNodesTreeBuilder::addMatch(clang::ast_matchers::internal::BoundNodesTreeBuilder const&)'
backend/src/libgbe.so: undefined reference to `clang::ast_matchers::MatchFinder::match(clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&)'
backend/src/libgbe.so: undefined reference to `clang::ast_matchers::MatchFinder::MatchCallback::~MatchCallback()'
backend/src/libgbe.so: undefined reference to `clang::ast_matchers::castExpr'
[...]
Comment 2 Jan Beich freebsd_committer freebsd_triage 2019-07-12 21:56:00 UTC
Brooks, do you have a clue what may cause comment 1? devel/oclgrind has a similar issue. llvm-devel-9.0.d20190710 doesn't support CLANG_LINK_CLANG_DYLIB knob yet (snapshot too old?) to check if it'd help.
Comment 3 Brooks Davis freebsd_committer freebsd_triage 2019-07-15 19:54:53 UTC
(In reply to Jan Beich from comment #2)
I don't know what might cause this.  It's weird that you're getting all the way to a link failure.  I've turned on CLANG_LINK_CLANG_DYLIB in the latest port update.
Comment 4 Jan Beich freebsd_committer freebsd_triage 2019-07-16 11:01:19 UTC
(In reply to Brooks Davis from comment #3)
ports r506706 didn't help beignet nor oclgrind.
Comment 5 Walter Schwarzenfeld freebsd_triage 2019-08-03 14:45:53 UTC
Remove in work/Beignet-1.3.2-Source/backend/CMakeLists.txt "-fvisibility=hidden".
This worked for me.
Comment 6 Walter Schwarzenfeld freebsd_triage 2019-08-03 14:52:11 UTC
Don't know if it is relevant: "-fvisibility=hidden" is in a second file -> work/Beignet-1.3.2-Source/backend/src/Android.mk.
Comment 7 Jan Beich freebsd_committer freebsd_triage 2019-08-07 10:53:13 UTC
(In reply to w.schwarzenfeld from comment #5)
> Remove in backend/CMakeLists.txt "-fvisibility=hidden".

Doesn't help.
Comment 8 Jan Beich freebsd_committer freebsd_triage 2019-08-07 11:17:26 UTC
Created attachment 206326 [details]
fix

Builds fine after linking -lclang-cpp: https://reviews.freebsd.org/P293
Runtime tested via graphics/waifu2x-converter-cpp on Skylake GT2
Comment 9 commit-hook freebsd_committer freebsd_triage 2019-09-20 19:58:34 UTC
A commit references this bug:

Author: jbeich
Date: Fri Sep 20 19:58:12 UTC 2019
New revision: 512439
URL: https://svnweb.freebsd.org/changeset/ports/512439

Log:
  lang/beignet: unbreak with llvm90

  backend/src/llvm/llvm_sampler_fix.cpp:85:18: error: no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
  	          Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
  	                 ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  	backend/src/llvm/llvm_sampler_fix.cpp:127:18: error: no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
  	          Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
  	                 ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  PR:		239175
  Approved by:	portmgr blanket

Changes:
  head/lang/beignet/files/patch-llvm9