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

undefined reference to `__muloti4' (crystal 0.31.1-1) #8286

Closed
gummybears opened this issue Oct 7, 2019 · 7 comments
Closed

undefined reference to `__muloti4' (crystal 0.31.1-1) #8286

gummybears opened this issue Oct 7, 2019 · 7 comments

Comments

@gummybears
Copy link

$ uname -a
Linux laptop 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ crystal version
Crystal 0.31.1 [0e2e1d067] (2019-09-30)

LLVM: 8.0.0
Default target: x86_64-unknown-linux-gnu

$ crystal build src/repl/main.cr -o a.out --debug
I-nt128.o: In function `**':
/usr/share/crystal/src/int.cr:272: undefined reference to `__muloti4'
/usr/share/crystal/src/int.cr:274: undefined reference to `__muloti4'
I-nterpreter5858V-M-.o: In function `do_negate':
/home/gummybears/crystal/interp/src/vm/do.cr:39: undefined reference to `__muloti4'
I-nterpreter5858V-M-.o: In function `operation':
/home/gummybears/crystal/interp/src/vm/value.cr:77: undefined reference to `__muloti4'
I-nterpreter5858V-M-.o: In function `do_imultiply':
/home/gummybears/crystal/interp/src/vm/do.cr:645: undefined reference to `__muloti4'
I-nterpreter5858V-M-.o:/home/gummybears/crystal/interp/src/vm/do.cr:716: more undefined references to `__muloti4' follow
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o '/home/gummybears/crystal/interp/a.out'  -rdynamic  -lreadline -lz -lxml2 -lpcre -lm /usr/bin/../lib/crystal/lib/libgc.a -lpthread /usr/share/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/bin/../lib/crystal/lib -L/usr/lib -L/usr/local/lib`
@gummybears
Copy link
Author

I think this is the cause http://lists.llvm.org/pipermail/llvm-bugs/2013-June/028981.html
as I am doing i128 multiplications

@bcardiff
Copy link
Member

bcardiff commented Oct 7, 2019

@gummybears, I left a comment at #7514 (comment) . If you want int128 bits right now you might need to to compile and link compiler-rt.

@gummybears
Copy link
Author

@bcardiff,
I don't need the int128 bits multiplication/division/addition/subtraction right now, I am already using it,
no problems with Crystal 0.30.1

Crystal 0.30.1 [5e6a1b672] (2019-08-12)
LLVM: 4.0.0
Default target: x86_64-unknown-linux-gnu

@bcardiff
Copy link
Member

bcardiff commented Oct 7, 2019

@gummybears but the stacktrace shows you are. Overflow is now enabled by default and that changes some operations. Use -Ddisable_overflow to double-check this. This flag is temporal though. More info at #8170

@gummybears
Copy link
Author

Things are getting confusing now. I am working with Crystal 0.30.1 and I am using int128 which works fine.

However today I thought to do an upgrade from Crystal 0.30.1 to 0.31.1 and see what happens with my code and test specs. So I decided to run my test specs but alas I am getting a link error which I am reporting here.

@bcardiff
Copy link
Member

bcardiff commented Oct 7, 2019

muloti4 is used to detect overflow in Int128. You should get the same error in 0.30.1 if -Dpreview_overflow is used.

@gummybears
Copy link
Author

Sorry for the delay, I had to read the links you were referring to. I did a test per your suggestion with the -Dpreview_overflow flag and indeed I am seeing the same error message with 0.30.1.
I am not going to use compiler-rt but think I will use i64 instead.
Thanks for the help

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