kernigh added a comment.

I'm stuck. I didn't put a test in this patch because I can't run the tests yet. 
So far, I can build a clang executable but can't build the rest of the project. 
I won't run the tests without a complete build, and I won't edit the tests 
without running them.

I had difficulty because llvm is a large C++ project that takes a long time to 
build. I tried to save time by building it on my fastest machine, an x86 
desktop with 2 cores and 4G RAM running OpenBSD 6.4 amd64. I tried a parallel 
build in my usual way, `cmake -GNinja ...` then `ninja`, but it got stuck near 
the end when it tried to run 3 linkers in parallel. The linkers used too much 
RAM, so my machine got stuck in swap. (Do other people have more RAM?) I 
learned to save RAM by building the project with clang -Oz and without -g (so 
there is no debug info), and by using `ninja -j2 clang` to link only the clang 
executable and nothing else.

My "running OpenBSD 6.4" is a problem. Code in 
llvm/lib/Support/Unix/Threading.inc for OpenBSD tries to call 
pthread_get_name_np(), which will appear in OpenBSD 6.5. I needed to edit that 
file. Then I built a clang executable, but it didn't run, because of an "Out of 
memory" error. The kernel of OpenBSD 6.4 seems to refuse to run such a large 
executable. I worked around it by hacking clang into a large shared library 
named almost_clang, then building a tiny clang executable that just calls the 
shared library (by editing clang/tools/driver/{CMakeLists.txt,driver.cpp}). 
That caused another error, because llvm tried to set the shared library's 
version to "9svn", which isn't legal. I edited llvm/cmake/modules/AddLLVM.cmake 
to remove the shared library's version. Now I can run clang.

If I try to build the rest of the project, like `ninja -j1` (because I don't 
want parallel linkers), then I get a linker error. It seems confused about the 
shared library version. The trick that I used to build clang might have broken 
something else. Before I try to fix my build, I want to upgrade this machine to 
OpenBSD 6.5 amd64. (So I am waiting for 6.5 to release; I already have 6.5-beta 
on my slow PowerPC machine.) That should at least let me undo the 
pthread_get_name_np() removal, so I don't have too many local changes. If I can 
build the rest of llvm and clang on OpenBSD 6.5, then I can try to run and edit 
the tests.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60335/new/

https://reviews.llvm.org/D60335



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to