-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LLVM LexicalScopes build exception when building with --release flag #4719
Comments
Has anyone tried build with --release on llvm 3.8.1 on mac? Mac ships with llvm 4.0, so this could be an llvm version issue. |
quote from @matiasgarciaisaia
It's really weird. That |
I have similar (but maybe not identical) problem:
https://travis-ci.org/konovod/linalg/builds/253769479 |
I also don't have # on Ubuntu 14.04
sudo apt-get install crystal
echo 'p "hello world"' > test.cr
crystal build test.cr --release
crystal: /var/cache/omnibus/src/llvm/llvm-3.8.1.src/lib/CodeGen/LexicalScopes.cpp:160: llvm::LexicalScope* llvm::LexicalScopes::getOrCreateRegularScope(const llvm::DILocalScope*): Assertion `cast<DISubprogram>(Scope)->describes(MF->getFunction())' failed.
/usr/bin/crystal: line 102: 16249 Aborted "$INSTALL_DIR/embedded/bin/crystal" "$@" |
I don't find it confusing at all. It's telling you the location in the source file where the runtime assertion failed, doesn't mean the source file has to be there on the PC where it runs, because it's a compiled library. It's exactly the same as |
It appears to me that LLVM was manually compiled by the omnibus, instead of using a prebuilt version. By the appearance of assertion errors, it's probably not a release build either. It's likely a release build would simply not have these runtime checks. |
Still haven't managed to get it on local build. If assertions in llvm are present, perhaps this problem is unrelated. |
Also
|
Not sure if this is relevant but the old llvm setup used to configure crystal-lang/omnibus-crystal@57e0ebc#diff-004ad5a5c6f368464daff6c7cbde83a5L26 |
Looks like setting CMAKE_BUILD_TYPE to debug makes it enable assertions otherwise it's in disabled. So probably not that then. |
@crisward confusingly, I think that's the wrong branch: https://github.com/crystal-lang/omnibus-crystal/blob/current/config/software/llvm.rb Still has assertions disabled, even though it's not a release build. |
That version doesn't appear to have |
@RX14 you can compile LLVM in release mode yet keep assertions. It's a little slower, but still a good idea, as it will catch understandable errors, that would otherwise lead to segfaults that are hard to understand. |
Which happened to me before. I couldn't understand an LLVM segfault, which was catched quickly by asterite which had assertions turned on. |
So, any idea what the failing assertion is telling us? :) |
googling text of error shows some links:
|
@ysbaddaden I'm sure you can, but i'm not sure how that're relevant to this error: the omnibus repo shows that LLVM appears to be compiled in debug mode with assertions turned off. Which makes getting assertion errors more weird. Perhaps the latest commit of the omnibus doesn't exactly represent the state of the distributed package. |
Interestingly, i've been noticing lots of bogus debug info in release builds, perhaps this is the cause and somehow we've never had assertions turned on before. |
So, right now I can't install latest Crystal in Arch Linux because of this bug crashing the compiler build in release mode, any fixes or tips to "baypass" this ? |
@bararchy This has been limited to the omnibus compiler, and the crystal package in arch community is up to date. Are you using crenv perhaps? |
Nope, building crystal-git from AUR, which show me the same issue, I can post output also if needed |
Using /usr/bin/llvm-config [version=4.0.1]
g++ -c -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -o src/llvm/ext/llvm_ext.o src/llvm/ext/llvm_ext.cc `/usr/bin/llvm-config --cxxflags`
cc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -fPIC -D_FORTIFY_SOURCE=2 -c -o src/ext/sigfault.o src/ext/sigfault.c
ar -rcs src/ext/libcrystal.a src/ext/sigfault.o
./bin/crystal build --release -o .build/crystal src/compiler/crystal.cr -D without_openssl -D without_zlib
crystal: /var/cache/omnibus/src/llvm/llvm-3.8.1.src/lib/CodeGen/LexicalScopes.cpp:160: llvm::LexicalScope* llvm::LexicalScopes::getOrCreateRegularScope(const llvm::DILocalScope*): Assertion `cast<DISubprogram>(Scope)->describes(MF->getFunction())' failed.
/tmp/yaourt-tmp-unshadow/aur-crystal-git/src/crystal-0.23.1-3/bin/crystal: line 102: 7853 Aborted (core dumped) "$INSTALL_DIR/embedded/bin/crystal" "$@"
make: *** [Makefile:117: .build/crystal] Error 134 |
@bararchy yes that package also uses the omnibus as it's bootstrap compiler |
What I'm saying is, most of the previous comments suggest this is an LLVM bug that was fixed in 3.9. We should just make sure to use that LLVM version, or a later one, when doing the next release. There's nothing we can do in this repository to mitigate this problem. |
It works with LLVM 4.0.1. |
I've installed the pre-release debian package 0.24.0-2_amd64 on Ubunutu 14.05.5 LTS in Windows Subsystem for Linux.
Unfortunately, it seems the issue still persists with LLVM 3.9.1:
Adding |
* omnibus 5.5.0 works with Ruby 2.4 (current stable) * Centos standard git doesn't work with Omnibus Omnibus assumes git >=1.7.7, which Centos doesn't have, so we use a third-party repo that provides a newer git version * Build releases with --no-debug So we don't hit the 4GB limit in 32 bits, and avoid using more than 8G memory in 64 bits * Use stable RVM See rvm/rvm#4068 * Automatic build & packaging for Debian releases * Update PCRE library to v8.40 * Build LLVM 3.8.1 from sources * LLVM 3.8.1 binaries built with old distros support * Link to /usr/local/bin if OSX El Capitan (or later) * LLVM 3.9.1 built in release mode See crystal-lang/crystal#4719 * Crystal 0.24.0 with LLVM 3.9.1
If this omnibus issue still isn't solved, i'm going to have another crack at my statically-compiled omnibus. |
I have a new omnibus that I would like people to try and see if it fixes the You can build it yourself by running This package (correctly) only contains a statically compiled libgc. This means that you may have to install some new packages (libevent-dev, libpcre3-dev) to get it to compile. This is essentially the same as when compiling the compiler yourself, but without the requirement for llvm. |
If it includes libgc, it could be good to compile it with
as per this thread. It allows it to return memory back to the OS after 3 GC cycles and works really well at allowing processes to return memory after high usage. The GC seems to slow down the frequency of it's cycles during high memory consumption, so 3 cycles isn't as often as you may think. |
We shouldn't enable memory shrink by default: we'll (probably) have another GC in the future, and while growing memory is easy, shrinking is more complex and may not be available or even a goal to achieve. |
Long running processes holding onto the memory they need at peak traffic seems wasteful. I'm not aware of any other languages doing this. Node, Go, even PHP return memory after a few minutes. I've been running Crystal with libgc compiled with this flag since that comment in march without any obvious ill effects. Not using something because it may be difficult to replicate later on seems a little overly cautious and something that could be worked out if the need arises. |
Sure. Implementing a GC with moving pointers to defragment memory isn't hard to implement. On free time. Without money support from Google. If you need to give back memory then compile boehm-gc manually and be aware that this isn't to be expected by default. A custom GC likely won't have this feature to begin with. Don't give wrong expectations, otherwise implementing a GC for Crystal will never happen, because the mountain to climb will seem absurdly too high. |
Per @ivmai
This looks like a very good reason not to make this the default. Still looking for feedback on how well my omnibus build works. |
As discussed in chat yesterday, Ubunutu 16.04.3 LTS works. On Ubuntu 14.04.5 LTS on Windows Subsystem for Linux it throws a segmentation fault.
|
This still happens in the latest available Crystal on Fedora, 0.23.1. |
Please take a look at the debian package crystal_0.24.2-1_i386.deb from http://dist.crystal-lang.org/apt, I have the similar/same issue with it:
|
@stronny |
It does seem like that indeed, however I can't really judge how much sense does it make. |
Doesn't the 32 bit version was still built with omnibus? The next release shall fix that, I believe. |
ohh yeah, 32 bit x86, I forgot that exists |
I've tested building crystal in a vagrant xenial 32 bits machine with llvm-4.0 as part of test-ecosystem and seems to work fine so far. |
I was able to build fine in OSX, however Ubuntu 16.04 is failing with this error:
remote: crystal: /var/cache/omnibus/src/llvm/llvm-3.8.1.src/lib/CodeGen/LexicalScopes.cpp:160: llvm::LexicalScope* llvm::LexicalScopes::getOrCreateRegularScope(const llvm::DILocalScope*): Assertion
cast(Scope)->describes(MF->getFunction())' failed.`Originally reported by @crisward here
Replicated by @hak8or and @matiasgarciaisaia. @matiasgarciaisaia mentioned that building with
--no-debug
works as a temporary workaround.The text was updated successfully, but these errors were encountered: