Skip to content
This repository has been archived by the owner on Jan 6, 2020. It is now read-only.

Wiki: Couple of improvements to Hacking with Clang llvm abi and llvm libc #122

Open
jeanphilippeD opened this issue Jul 20, 2014 · 6 comments

Comments

@jeanphilippeD
Copy link

Hello,
First thanks for the great instructions. This is a very nice all in one page to get started with clang on linux.

https://github.com/maidsafe/MaidSafe/wiki/Hacking-with-Clang-llvm-abi-and-llvm-libc

While setting up there are a couple of things that came up and there seems to be no easy way to submit wiki modification as pull request, so I'm just raising an issue.

Best Regards,
Jean-Philippe

1 - The instruction only really work for 64bit platform (x86_64), and it might be good to highlight it at the beginning.
Everything works up to the point of linking MaidSafe code. make ExperCommon will fail to link seemingly due to the use of sanitizers which most seems to not be implemented/supported on non x86_64 platform.
Maybe that can be fixed, but without them, building clang on 32 bit linux seems a less valuable endeavour, and this should probably still be highlighted.

2 - A minor issue that wasted some time:
in "install libc++ (using libc++abi)"
"
cd build
CC=clang CXX=clang++ cmake -G "Unix Makefiles" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_LIBCXXABI_INCLUDE_PATHS="libc++abi-source-dir/include" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ../
"
If you follow the instruction, at this point, libc++abi-source-dir would be ../../libcxxabi.
Because libc++-source-dir is already replaced with ../, I expected the command to work, and the failure is not immediately as it just indicates that it cannot find a header.The problematic part is this is only visible if you use the horizontal scrollbar. At this point I had been copy pasting a bit mindlessly for a bit.

So maybe either replacing libc++abi-source-dir with ../../libcxxabi or make it more obvious that we need to replace the libc++abi-source-dir.

3 - I only realized my mistake with (2) when reaching the page which I guess you got a lot of the instructions from, If might be nice to keep a link to it here.
https://llvm.org/svn/llvm-project/libcxx/trunk/www/index.html

@ned14
Copy link

ned14 commented Jul 20, 2014

Using libc++ instead of libstdc++ on Linux is definitely an advanced feature. It's far less problematic to always use libstdc++.

I am also not aware of 32 bit and 64 bit problems. There is a CI which builds with both clang and gcc on Linux in both 32 bit and 64 bit flavours (using libstdc++) and I've seen no issue with that.

@dirvine
Copy link
Contributor

dirvine commented Jul 20, 2014

I agree with Niall I use a 64 bit linux version with libc++ as well as libstdc++ versions mainly for curiosity and for a while playing with some c++1y features. I will add these improvements though and probably advise against libc++ in linux unless you are curios. I think the 64/32 bit issues are possibly sanitiser related. I will try and get a look at that to.

Just out of curiosity, if using just clang and not setting HAVE_LIBC++ etc. does it all work? (you can switch those off by running ccmake ../ and select t for advanced options)

@jeanphilippeD
Copy link
Author

Sorry, I won't be able to answer question about 32bit linux, I installed a 64bit linux to fix the issues.
I did not have any issue with building on x86_64 with libc++.

The wiki is very clear on the experimental nature of using clang on linux, was just curious about it, particularly the sanitizer and other tools.

http://compiler-rt.llvm.org/
"Most sanitizer runtimes are supported only on Linux x86-64. See tool-specific pages in Clang docs for more details." I might have misunderstood, but I did not get the same issue once I switched to an x86_64 platform.

Yes, it might be worth indicating that the CI build uses libstdc++ as the wiki seems to suggest the right path is using libc++.

Thanks a lot.

@dirvine
Copy link
Contributor

dirvine commented Jul 20, 2014

On Sun, Jul 20, 2014 at 11:08 PM, jeanphilippeD [email protected]
wrote:

Yes, it might be worth indicating that the CI build uses libstdc++ as the
wiki seems to suggest the right path is using libc++.

Yes I will update this, its too skewed to my clang worship :-) (kidding)

David Irvine
twitter: @metaquestions
blog: http://metaquestions.me

@ned14
Copy link

ned14 commented Jul 21, 2014

Just to be clear Jean Philippe, clang on Linux is extremely mature and not experimental. Using the libc++ STL on Linux is experimental however. Certainly myself and at least David primarily work with Maidsafe code using clang as it's much faster to compile than gcc for debug, but on Linux I'd say we all use libstdc++ not libc++ with clang as that's mature. Niall

@jeanphilippeD
Copy link
Author

Thanks a lot for all the answers, I will use libstdc++ in the future.
Best Regards,
Jean-Philippe.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants