<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 21, 2013 at 10:06 AM, Tom Stellard <span dir="ltr"><<a href="mailto:tom@stellard.net" target="_blank">tom@stellard.net</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div>On Thu, Feb 21, 2013 at 10:02:34AM -0600, Aaron Watry wrote:<br>
> On Thu, Feb 21, 2013 at 8:33 AM, Tom Stellard <<a href="mailto:tom@stellard.net" target="_blank">tom@stellard.net</a>> wrote:<br>
><br>
> > On Thu, Feb 21, 2013 at 08:25:20AM -0600, Aaron Watry wrote:<br>
> > > Hi Tom,<br>
> > ><br>
> > > Mesa+Clover does indeed build against master llvm/clang, but I'm having<br>
> > > trouble building against it when I try to do a clean build of Piglit.<br>
> > ><br>
> > > Error received:<br>
> > ><br>
> > > [ 18%] Built target piglitutil_cl<br>
> > > Linking C executable ../../../../../bin/cl-custom-run-simple-kernel<br>
> > > /usr/local/lib/libOpenCL.so: undefined reference to<br>
> > ><br>
> > `clang::PPConditionalDirectiveRecord::rangeIntersectsConditionalDirective(clang::SourceRange)<br>
> > > const'<br>
> > > /usr/local/lib/libOpenCL.so: undefined reference to<br>
> > ><br>
> > `clang::PPConditionalDirectiveRecord::findConditionalDirectiveRegionLoc(clang::SourceLocation)<br>
> > > const'<br>
> > > collect2: error: ld returned 1 exit status<br>
> > > make[2]: *** [bin/cl-custom-run-simple-kernel] Error 1<br>
> > > make[1]: ***<br>
> > ><br>
> > [target_api/cl/tests/cl/custom/CMakeFiles/cl-custom-run-simple-kernel.dir/all]<br>
> > > Error 2<br>
> > > make: *** [all] Error 2<br>
> > ><br>
> > > Maybe I've done something wrong, but I've tested this on two machines now<br>
> > > and both times I've wiped my llvm/clang/mesa/clover installs in<br>
> > /usr/local<br>
> > > and rebuilt from scratch.<br>
> > ><br>
> ><br>
> > Which revisions of Clang and LLVM are you using?<br>
> ><br>
> ><br>
> I'm not at home at the moment, so I don't have access to those machines,<br>
> but from memory:<br>
><br>
> LLVM was git master as of sometime around 6-8pm CST last night.  One such<br>
> revision would be<br>
> commit ffbe432595c78ba28c8a9d200bf92996eed5e5d9<br>
> git-svn-id: <a href="https://llvm.org/svn/llvm-project/llvm/trunk@175718" target="_blank">https://llvm.org/svn/llvm-project/llvm/trunk@175718</a> 91177308-0d3<br>
><br>
><br>
> Clang was somewhere between 3bc7b6bef96 and dc84cd5efdd3430efb.<br>
><br>
> I just retested on another machine with the following versions:<br>
> LLVM: git: 0514595b9b20c9d80, svn: 175739<br>
> Clang: 7d81281fc39f6d, svn: 175741<br>
> Mesa: b63b3012c91 with your clover patch<br>
><br>
> Result:<br>
> Linking C executable ../../../../../bin/cl-custom-run-simple-kernel<br>
> /usr/local/lib/libOpenCL.so: undefined reference to<br>
> `clang::PPConditionalDirectiveRecord::rangeIntersectsConditionalDirective(clang::SourceRange)<br>
> const'<br>
> /usr/local/lib/libOpenCL.so: undefined reference to<br>
> `clang::PPConditionalDirectiveRecord::findConditionalDirectiveRegionLoc(clang::SourceLocation)<br>
> const'<br>
> collect2: error: ld returned 1 exit status<br>
> make[2]: *** [bin/cl-custom-run-simple-kernel] Error 1<br>
> make[1]: ***<br>
> [target_api/cl/tests/cl/custom/CMakeFiles/cl-custom-run-simple-kernel.dir/all]<br>
> Error 2<br>
> make: *** [all] Error 2<br>
><br>
<br>
</div></div>Did you re-configure and run make clean for piglit?<br>
<span><font color="#888888"><br></font></span></blockquote><div><br></div><div>I did a full git clean -fdx on LLVM, Clang, libclc, Mesa, and Piglit after removing all existing LLVM/Clang/Mesa includes/libraries from /usr/local.  I also did a full search for other copies of libclang on my system and the only copies were in /usr/local/lib.<br>
<br></div><div>Note: libclc's prepare-builtins.cpp needed to be updated for LLVM 3.3 as well (moving 4 headers into <llvm/IR/*.h>.<br></div><div><br>I then did a clean configure/make/make install on LLVM/libclc/Mesa, and then a clean rebuild of piglit.<br>
<br></div><div>LLVM Configure: CC=gcc CXX=g++ ./configure --enable-optimized --enable-assertions=no --enable-experimental-<br>targets=R600 --enable-targets=x86 --enable-shared --prefix=/usr/local<br><br></div><div>Mesa Configure: ./configure --with-dri-drivers=radeon --with-gallium-drivers=r600 --enable-texture-float --enable-opencl<br>
</div><div><br></div><div>Piglit was rebuilt clean with only the CL tests enabled. No GL, GLX , Waffle, etc.<br></div><div><br></div><div>libOpenCL is linked against the 3.3 build of LLVM, but I did notice that there's no linking to clang.. I did notice that while LLVM builds a shared library, clang only installs a static archive. Are we statically linking Clang into Mesa while using the shared libLLVM?<br>

</div><div><br></div><div>ldd /usr/local/lib/libOpenCL.so:<br>    linux-vdso.so.1 =>  (0x00007ffffdce1000)<br>    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007effa3e21000)<br>    libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007effa3c1c000)<br>

    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007effa39fd000)<br>    libdrm.so.2 => /usr/local/lib/libdrm.so.2 (0x00007effa37f1000)<br>    libudev.so.0 => /lib/x86_64-linux-gnu/libudev.so.0 (0x00007effa35e4000)<br>

    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007effa33db000)<br>    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007effa31d7000)<br>    <a href="http://libLLVM-3.3svn.so" target="_blank">libLLVM-3.3svn.so</a> => /usr/local/lib/<a href="http://libLLVM-3.3svn.so" target="_blank">libLLVM-3.3svn.so</a> (0x00007effa22d8000)<br>

    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007effa1fd4000)<br>    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007effa1cd8000)<br>    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007effa1919000)<br>

    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007effa1702000)<br>    /lib64/ld-linux-x86-64.so.2 (0x00007effa511b000)<br>    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007effa14fe000)<br>

    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007effa12f8000)<br><br></div><div><br></div><div>--Aaron<br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<span><font color="#888888">
-Tom<br>
</font></span><div><div>><br>
><br>
> > -Tom<br>
> ><br>
> > > --Aaron<br>
> > ><br>
> > > On Wed, Feb 20, 2013 at 4:27 PM, Tom Stellard <<a href="mailto:tom@stellard.net" target="_blank">tom@stellard.net</a>> wrote:<br>
> > ><br>
> > > > From: Tom Stellard <<a href="mailto:thomas.stellard@amd.com" target="_blank">thomas.stellard@amd.com</a>><br>
> > > ><br>
> > > > ---<br>
> > > >  .../state_trackers/clover/llvm/invocation.cpp      |   47<br>
> > > > ++++++++++++++++---<br>
> > > >  1 files changed, 39 insertions(+), 8 deletions(-)<br>
> > > ><br>
> > > > diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp<br>
> > > > b/src/gallium/state_trackers/clover/llvm/invocation.cpp<br>
> > > > index 0bd8e22..2785d10 100644<br>
> > > > --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp<br>
> > > > +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp<br>
> > > > @@ -28,10 +28,17 @@<br>
> > > >  #include <clang/CodeGen/CodeGenAction.h><br>
> > > >  #include <llvm/Bitcode/BitstreamWriter.h><br>
> > > >  #include <llvm/Bitcode/ReaderWriter.h><br>
> > > > -#include <llvm/DerivedTypes.h><br>
> > > >  #include <llvm/Linker.h><br>
> > > > +#if HAVE_LLVM < 0x0303<br>
> > > > +#include <llvm/DerivedTypes.h><br>
> > > >  #include <llvm/LLVMContext.h><br>
> > > >  #include <llvm/Module.h><br>
> > > > +#else<br>
> > > > +#include <llvm/IR/DerivedTypes.h><br>
> > > > +#include <llvm/IR/LLVMContext.h><br>
> > > > +#include <llvm/IR/Module.h><br>
> > > > +#include <llvm/Support/IRReader.h><br>
> > > > +#endif<br>
> > > >  #include <llvm/PassManager.h><br>
> > > >  #include <llvm/Support/TargetSelect.h><br>
> > > >  #include <llvm/Support/MemoryBuffer.h><br>
> > > > @@ -41,8 +48,10 @@<br>
> > > ><br>
> > > >  #if HAVE_LLVM < 0x0302<br>
> > > >  #include <llvm/Target/TargetData.h><br>
> > > > -#else<br>
> > > > +#elif HAVE_LLVM < 0x0303<br>
> > > >  #include <llvm/DataLayout.h><br>
> > > > +#else<br>
> > > > +#include <llvm/IR/DataLayout.h><br>
> > > >  #endif<br>
> > > ><br>
> > > >  #include "pipe/p_state.h"<br>
> > > > @@ -151,7 +160,11 @@ namespace {<br>
> > > >        // Add libclc generic search path<br>
> > > >        c.getHeaderSearchOpts().AddPath(LIBCLC_INCLUDEDIR,<br>
> > > >                                        clang::frontend::Angled,<br>
> > > > -                                      false, false, false);<br>
> > > > +                                      false, false<br>
> > > > +#if HAVE_LLVM < 0x0303<br>
> > > > +                                      , false<br>
> > > > +#endif<br>
> > > > +                                      );<br>
> > > ><br>
> > > >        // Add libclc include<br>
> > > >        c.getPreprocessorOpts().Includes.push_back("clc/clc.h");<br>
> > > > @@ -167,8 +180,12 @@ namespace {<br>
> > > >        c.getInvocation().setLangDefaults(c.getLangOpts(),<br>
> > clang::IK_OpenCL,<br>
> > > ><br>
> > > >  clang::LangStandard::lang_opencl11);<br>
> > > >  #endif<br>
> > > > -      c.createDiagnostics(0, NULL, new clang::TextDiagnosticPrinter(<br>
> > > > -                          s_log,<br>
> > > > +      c.createDiagnostics(<br>
> > > > +#if HAVE_LLVM < 0x0303<br>
> > > > +                          0, NULL,<br>
> > > > +#endif<br>
> > > > +                          new clang::TextDiagnosticPrinter(<br>
> > > > +                                 s_log,<br>
> > > >  #if HAVE_LLVM <= 0x0301<br>
> > > >                                   c.getDiagnosticOpts()));<br>
> > > >  #else<br>
> > > > @@ -201,12 +218,26 @@ namespace {<br>
> > > ><br>
> > > >        llvm::PassManager PM;<br>
> > > >        llvm::PassManagerBuilder Builder;<br>
> > > > -      bool isNative;<br>
> > > > -      llvm::Linker linker("clover", mod);<br>
> > > > +      llvm::sys::Path libclc_path =<br>
> > > > +                            llvm::sys::Path(LIBCLC_LIBEXECDIR +<br>
> > triple +<br>
> > > > ".bc");<br>
> > > ><br>
> > > >        // Link the kernel with libclc<br>
> > > > -      linker.LinkInFile(llvm::sys::Path(LIBCLC_LIBEXECDIR + triple +<br>
> > > > ".bc"), isNative);<br>
> > > > +#if HAVE_LLVM < 0x0303<br>
> > > > +      bool isNative;<br>
> > > > +      llvm::Linker linker("clover", mod);<br>
> > > > +      linker.LinkInFile(libclc_path, isNative);<br>
> > > >        mod = linker.releaseModule();<br>
> > > > +#else<br>
> > > > +      std::string err_str;<br>
> > > > +      llvm::SMDiagnostic err;<br>
> > > > +      llvm::Module *libclc_mod = llvm::ParseIRFile(libclc_path.str(),<br>
> > err,<br>
> > > > +                                                   mod->getContext());<br>
> > > > +      if (llvm::Linker::LinkModules(mod, libclc_mod,<br>
> > > > +                                    llvm::Linker::DestroySource,<br>
> > > > +                                    &err_str)) {<br>
> > > > +         throw build_error(err_str);<br>
> > > > +      }<br>
> > > > +#endif<br>
> > > ><br>
> > > >        // Add a function internalizer pass.<br>
> > > >        //<br>
> > > > --<br>
> > > > 1.7.8.6<br>
> > > ><br>
> > > > _______________________________________________<br>
> > > > mesa-dev mailing list<br>
> > > > <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
> > > > <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
> > > ><br>
> ><br>
</div></div></blockquote></div><br></div></div>