Bug 106209 - [opencl] [llvm-svn] build failure undefined reference to `clang::FrontendTimesIsEnabled'
Summary: [opencl] [llvm-svn] build failure undefined reference to `clang::FrontendTi...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 99553
  Show dependency treegraph
 
Reported: 2018-04-24 13:48 UTC by LoneVVolf
Modified: 2018-05-15 05:05 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
autoreconf output (1.27 KB, text/plain)
2018-04-24 13:49 UTC, LoneVVolf
Details
configure / make output (160.76 KB, text/x-log)
2018-04-24 13:50 UTC, LoneVVolf
Details
Proposed patch (1.72 KB, patch)
2018-05-01 12:17 UTC, Kai
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description LoneVVolf 2018-04-24 13:48:33 UTC
mesa-git rev c2e159d050
llvm-svn rev r330683

using autotools,

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --with-gallium-drivers=r300,r600,radeonsi,nouveau,svga,swrast,virgl \
    --with-dri-drivers=i915,i965,r200,radeon,nouveau \
    --with-platforms=x11,drm,surfaceless \
    --with-vulkan-drivers=intel,radeon \
    --enable-texture-float \
    --enable-gallium-osmesa \
    --enable-xa \
    --enable-nine \
    --disable-xvmc \
    --enable-vdpau \
    --enable-omx-bellagio \
    --enable-opencl \
    --enable-opencl-icd \
    --enable-glx-tls \
    --enable-libglvnd


omitting --enable-opencl and --enable-opencl-icd allows build to succeed .
Comment 1 LoneVVolf 2018-04-24 13:49:49 UTC
Created attachment 139055 [details]
autoreconf output
Comment 2 LoneVVolf 2018-04-24 13:50:33 UTC
Created attachment 139056 [details]
configure / make output
Comment 3 Jan Vesely 2018-04-25 01:22:55 UTC
Looks like we don't link to libclangFrontend, which is required since r330571.
This should, however, be handled by llvm/clang when listing libraries required for components.
Comment 4 Kai 2018-04-28 14:02:08 UTC
(In reply to Jan Vesely from comment #3)
> Looks like we don't link to libclangFrontend, which is required since
> r330571.
> This should, however, be handled by llvm/clang when listing libraries
> required for components.

That doesn't seem to be right. I'm seeing this build error with LLVM SVN revision 331085 (basically a build of the source package from [0]). But when I look at the log of the failing Mesa build of commit 8b7358fe43 I'm seeing:
> libtool: link: g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o  -Wl,--whole-archive ../../../../src/gallium/auxiliary/pipe-loader/.libs/libpipe_loader_dynamic.a ../../../../src/gallium/state_trackers/clover/.libs/libclover.a ../../../../src/gallium/auxiliary/.libs/libgallium.a ../../../../src/util/.libs/libmesautil.a -Wl,--no-whole-archive  -L/usr/lib/llvm-7/lib -ldrm -lz -lexpat -lelf -ldl -lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization -lclangCodeGen -lclangParse -lclangSema -lclangAnalysis -lclangAST -lclangEdit -lclangLex -lclangBasic -lLLVM-7 -lpthread -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o  -g -O2 -fstack-protector-strong -march=native -mfpmath=sse -Wl,--gc-sections -Wl,--no-undefined -Wl,--version-script=../../../../../src/gallium/targets/opencl/opencl.sym -Wl,-z -Wl,relro -pthread   -pthread -Wl,-soname -Wl,libMesaOpenCL.so.1 -o .libs/libMesaOpenCL.so.1.0.0
> /usr/lib/llvm-7/lib/libclangCodeGen.a(CodeGenAction.cpp.o): In function `clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)':
> (.text._ZN5clang15BackendConsumer18HandleTopLevelDeclENS_12DeclGroupRefE[_ZN5clang15BackendConsumer18HandleTopLevelDeclENS_12DeclGroupRefE]+0x50): undefined reference to `clang::FrontendTimesIsEnabled'
> /usr/lib/llvm-7/lib/libclangCodeGen.a(CodeGenAction.cpp.o): In function `clang::BackendConsumer::Initialize(clang::ASTContext&)':
> (.text._ZN5clang15BackendConsumer10InitializeERNS_10ASTContextE[_ZN5clang15BackendConsumer10InitializeERNS_10ASTContextE]+0xc): undefined reference to `clang::FrontendTimesIsEnabled'
> /usr/lib/llvm-7/lib/libclangCodeGen.a(CodeGenAction.cpp.o): In function `clang::BackendConsumer::HandleInlineFunctionDefinition(clang::FunctionDecl*)':
> (.text._ZN5clang15BackendConsumer30HandleInlineFunctionDefinitionEPNS_12FunctionDeclE[_ZN5clang15BackendConsumer30HandleInlineFunctionDefinitionEPNS_12FunctionDeclE]+0x3c): undefined reference to `clang::FrontendTimesIsEnabled'
> /usr/lib/llvm-7/lib/libclangCodeGen.a(CodeGenAction.cpp.o): In function `clang::BackendConsumer::HandleInterestingDecl(clang::DeclGroupRef)':
> (.text._ZN5clang15BackendConsumer21HandleInterestingDeclENS_12DeclGroupRefE[_ZN5clang15BackendConsumer21HandleInterestingDeclENS_12DeclGroupRefE]+0x77): undefined reference to `clang::FrontendTimesIsEnabled'
> /usr/lib/llvm-7/lib/libclangCodeGen.a(CodeGenAction.cpp.o): In function `clang::CodeGenAction::CreateASTConsumer(clang::CompilerInstance&, llvm::StringRef)':
> (.text._ZN5clang13CodeGenAction17CreateASTConsumerERNS_16CompilerInstanceEN4llvm9StringRefE+0x2f1): undefined reference to `clang::FrontendTimesIsEnabled'
> /usr/lib/llvm-7/lib/libclangCodeGen.a(CodeGenAction.cpp.o):(.text._ZN5clang13CodeGenAction17CreateASTConsumerERNS_16CompilerInstanceEN4llvm9StringRefE+0x4a8): more undefined references to `clang::FrontendTimesIsEnabled' follow
> collect2: error: ld returned 1 exit status
> make[5]: *** [Makefile:700: libMesaOpenCL.la] Error 1

which clearly includes "-lclangFrontend" and I verified, that clang::FrontendTimesIsEnabled is actually in that library:

> FrontendTiming.cpp.o:
>                  U llvm::DisableABIBreakingChecks
> 0000000000000000 V llvm::VerifyDisableABIBreakingChecks
> 0000000000000000 B clang::FrontendTimesIsEnabled

Or am I misreading something here?

[0] <https://llvm-jenkins.debian.net/job/llvm-toolchain-source/1729/>
Comment 5 Kai 2018-05-01 12:17:23 UTC
Created attachment 139244 [details] [review]
Proposed patch

The attached patch fixes the issue for me. I've sent it to mesa-dev as well, though it'll take some time to show up there because of Greylisting.
Comment 6 Kai 2018-05-01 12:30:55 UTC
Patch on the list at https://patchwork.freedesktop.org/patch/219763/
Comment 7 Jan Vesely 2018-05-01 15:03:48 UTC
Right. Thanks! I didn't realize we list clang libraries explicitly.
Comment 8 Kai 2018-05-15 05:05:40 UTC
This should be fixed by the following commit in Mesa master:

commit b691d9192c436aba5a76577b7d772a791283a2e2
Author: Kai Wasserbäch <kai@dev.carbon-project.org>
Date:   Tue May 1 14:14:46 2018 +0200

    opencl: autotools: Fix linking order for OpenCL target
    
    Otherwise the build fails with an undefined reference to
    clang::FrontendTimesIsEnabled.
    
    Bugzilla: https://bugs.freedesktop.org/106209
    Cc: Jan Vesely <jan.vesely@rutgers.edu>
    Cc: mesa-stable@lists.freedesktop.org
    Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
    Acked-by: Jan Vesely <jan.vesely@rutgers.edu>
    Tested-by: Aaron Watry <awatry@gmail.com>
    Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.