Skip to content
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

hello.t and a few other tests broken on llvm15 #646

Open
sh4r1k7 opened this issue Oct 9, 2023 · 4 comments
Open

hello.t and a few other tests broken on llvm15 #646

sh4r1k7 opened this issue Oct 9, 2023 · 4 comments

Comments

@sh4r1k7
Copy link

sh4r1k7 commented Oct 9, 2023

bash-5.2$ ~/net/terra/bin/terra hello.t
terra: /llvm/include/llvm/Support/ErrorOr.h:237: llvm::ErrorOr<T>::storage_type* llvm::ErrorOr<T>::getStorage() [with T = std::__cxx11::basic_string<char>; llvm::ErrorOr<T>::storage_type = std::__cxx11::basic_string<char>]: Assertion `!HasError && "Cannot get value when an error exists!"' failed.
Aborted

This is using the pre-built downloaded binary and tests.

I had a total of 12 (including this one) seemingly simple tests fail but strangely the rest passed.

Another odd thing I found is different behaviour between running using terra and the simple.cpp example (which I was able to compile and run but it dies with the same error as above, as well as the next example):

Running the following shows the different behaviour:

local c = terralib.includec("stdio.h")

terra hello()
	c.printf("hello, world\n")
end

print'a'
hello()
print'b'
bash-5.2$ ./simple hello.t
a
bash-5.2$ echo $?
1

bash-5.2$ ~/net/terra/bin/terra hello.t
a
hello, world
b
bash-5.2$ echo $?
0

System:

bash-5.2$ clang++ --version
clang version 15.0.7
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

bash-5.2$ uname -a
Linux 6.4.16-0-generic #1 SMP PREEMPT_DYNAMIC Wed Sep 13 22:59:43 UTC 2023 x86_64 GNU/Linux

Not sure what other info I can provide, but happy to help.

@elliottslaughter
Copy link
Member

To be clear, is this using a Terra pre-built binary, or an LLVM pre-built binary? Can you link the specific binary you used?

What distro and version is this?

@sh4r1k7
Copy link
Author

sh4r1k7 commented Oct 11, 2023

Sorry for muddling things a bit. Yes, this is using the pre-built binary: terra-Linux-x86_64-094c5ad

And I should've mentioned this, I'm running via a voidlinux chroot: void-x86_64-ROOTFS-20230628 not the musl version, just regular glibc (I'm running on a musl system, hence the chroot).

@elliottslaughter
Copy link
Member

The official Terra binaries are compiled on Ubuntu 18.04. Cross-distro usage is always a bit screwy. Sometimes it works (e.g., I've tested Ubuntu -> RHEL), but it's not hard to see it blowing up on you.

If you have working LLVM/Clang binaries you may be able to build Terra yourself. On Ubuntu, you'd need something like:

sudo apt-get install llvm-15-dev libclang-15-dev clang-15 libmlir-15-dev libedit-dev libncurses5-dev zlib1g-dev libpfm4-dev

The exact set of dependencies depends on how LLVM is packaged. LLVM can be built without any external dependencies, but the Debian/Ubuntu packagers choose to include some (as noted above).

You may need to fiddle with CMAKE_PREFIX_PATH to tell it where LLVM is installed.

Alternatively, if the packaged LLVM doesn't work for you, there's a build recipe here that is guarranteed to work with Terra, but will take a while to build (depending on how beefy your machine is):

https://github.com/terralang/terra/tree/master#instructions-for-building-llvm-from-source

Good luck!

@sh4r1k7
Copy link
Author

sh4r1k7 commented Oct 12, 2023

Fair enough, might try an ubuntu chroot first then. Thanks.

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

No branches or pull requests

2 participants