<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 11, 2021 at 3:08 PM David Blaikie via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">On Thu, Feb 11, 2021 at 2:53 PM users users <<a href="mailto:usertestexamples@gmail.com" target="_blank">usertestexamples@gmail.com</a>> wrote:<br>
><br>
> Hi David,<br>
><br>
> Thank you so much for your quick response!<br>
> I am very inexperienced with llvm. Please bear with me if my questions look stupid:<br>
><br>
> 1. Here is the output from the command ss"clang++ -v":<br>
><br>
><br>
> $ clang++ -v<br>
><br>
> clang version 12.0.0 (... .../llvm/llvm-project_git/clang 36263a7cccc0d98afc36dea55e7a004d08455811)<br>
><br>
> Target: powerpc64le-unknown-linux-gnu<br>
><br>
> Thread model: posix<br>
><br>
> InstalledDir: ... .../llvm/llvm-project_git/build_12.0.0_36263a7_010421/bin<br>
><br>
> Found candidate GCC installation: /usr/lib/gcc/ppc64le-redhat-linux/4.8.2<br>
><br>
> Found candidate GCC installation: /usr/lib/gcc/ppc64le-redhat-linux/4.8.5<br>
><br>
> Selected GCC installation: /usr/lib/gcc/ppc64le-redhat-linux/4.8.5<br>
><br>
> Candidate multilib: .;@m64<br>
><br>
> Selected multilib: .;@m64<br>
><br>
><br>
> Before using clang++, I removed gcc modules, because I thought clang++ should not be dependent of any host compiler once it was built successfully. Or does it need to make my host compiler (such as gcc/8.2.0) available to it so that to compile my project?<br>
<br>
I think you may need to pass -stdlib=libc++ to use the libc++ you<br>
built/installed, rather than the system libstdc++ which looks a bit<br>
out of date (& so doesn't have std::make_unique).<br>
<br>
><br>
> 2. Here are the options I used to build llvm:<br>
> -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi;openmp;parallel-libs" -DCMAKE_BUILD_TYPE="Release" -DLLVM_TARGETS_TO_BUILD=PowerPC -DLLVM_ENABLE_LIBPFM=OFF -DRUN_HAVE_GNU_POSIX_REGEX=0 -DRUN_HAVE_THREAD_SAFETY_ATTRIBUTES=0 -Wno-dev ../llvm<br>
> Are these correct options to use?<br>
<br>
Mostly right except you probably want/need<br>
-DLLVM_ENABLE_ASSERTIONS=Off if you want a production-speed compiler.<br></blockquote><div><br></div><div>This is implied by `-DCMAKE_BUILD_TYPE="Release"`: <a href="https://github.com/llvm/llvm-project/blob/main/llvm/CMakeLists.txt#L412-L416">https://github.com/llvm/llvm-project/blob/main/llvm/CMakeLists.txt#L412-L416</a></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
><br>
> Please advise. Thank you so much David!<br>
><br>
> Best,<br>
> Shelton<br>
><br>
><br>
><br>
> On Thu, Feb 11, 2021 at 4:26 PM David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
>><br>
>> 1) clang++ -v will show you which standard library headers it's using,<br>
>> it might be using an older standard library on your system that<br>
>> doesn't have std::make_unique.<br>
>> 2) Did you build the compiler in release mode, or in debug mode? (with<br>
>> or without assertions enabled)<br>
>><br>
>> On Thu, Feb 11, 2021 at 2:21 PM users users via llvm-dev<br>
>> <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>> ><br>
>> > Dear LLVM Developers:<br>
>> ><br>
>> > 1. Recently I built llvm/12.0 on IBM power8 using gcc/<a href="http://8.2.0." rel="noreferrer" target="_blank">8.2.0.</a> When I run clang++ with an example from <a href="https://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique" rel="noreferrer" target="_blank">https://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique</a>:<br>
>> ><br>
>> > #include <iostream><br>
>> ><br>
>> > #include <iomanip><br>
>> > #include <memory><br>
>> ><br>
>> > struct Vec3<br>
>> > {<br>
>> > int x, y, z;<br>
>> ><br>
>> > // following constructor is no longer needed since C++20<br>
>> > Vec3(int x = 0, int y = 0, int z = 0) noexcept : x(x), y(y), z(z) { }<br>
>> ><br>
>> > friend std::ostream& operator<<(std::ostream& os, const Vec3& v) {<br>
>> > return os << "{ x=" << v.x << ", y=" << v.y << ", z=" << v.z << " }";<br>
>> > }<br>
>> > };<br>
>> ><br>
>> > int main()<br>
>> > {<br>
>> > // Use the default constructor.<br>
>> > std::unique_ptr<Vec3> v1 = std::make_unique<Vec3>();<br>
>> > // Use the constructor that matches these arguments<br>
>> > std::unique_ptr<Vec3> v2 = std::make_unique<Vec3>(0,1,2);<br>
>> > // Create a unique_ptr to an array of 5 elements<br>
>> > std::unique_ptr<Vec3[]> v3 = std::make_unique<Vec3[]>(5);<br>
>> ><br>
>> > std::cout << "make_unique<Vec3>(): " << *v1 << '\n'<br>
>> > << "make_unique<Vec3>(0,1,2): " << *v2 << '\n'<br>
>> > << "make_unique<Vec3[]>(5): ";<br>
>> > for (int i = 0; i < 5; i++) {<br>
>> > std::cout << std::setw(i ? 30 : 0) << v3[i] << '\n';<br>
>> > }<br>
>> > }<br>
>> ><br>
>> ><br>
>> > It failed with the following errors:<br>
>> > Error: no member named 'make_unique' in namespace 'std'<br>
>> > std::unique_ptr<Vec3> v1 = std::make_unique<Vec3>();<br>
>> > ... ...<br>
>> ><br>
>> > Any idea and suggestion about what is going on? or have I missed something? The command I used to compile the code above:<br>
>> > $ clang++ a.cpp<br>
>> ><br>
>> > 2. Comparing this llvm with my current gcc/8.2.0 on a project (openmp code running 1 thread), it showed that llvm is almost twice as slow as gcc (both compile with -O3) on my IBM power8 machine. Is it suppose to be with such slower performance than gcc?<br>
>> ><br>
>> > Thank you very much for any advice!<br>
>> ><br>
>> > Best Regards,<br>
>> > Shelton<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > LLVM Developers mailing list<br>
>> > <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>> > <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div></div></div>