FS#48407 - [crystal] Cannot build or run crystal code

Attached to Project: Community Packages
Opened by Stephanie Wilde-Hobbs (RX14) - Wednesday, 02 March 2016, 20:56 GMT
Last edited by Anatol Pomozov (anatolik) - Friday, 04 March 2016, 20:39 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Anatol Pomozov (anatolik)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

When using any of crystal's compile or run functions, I get the following error:

/usr/bin/ld: /usr/lib/crystal/ext/libcrystal.a(sigfault.o): relocation R_X86_64_32S against `sigfault_handler' can not be used when making a shared object; recompile with -fPIC
/usr/lib/crystal/ext/libcrystal.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc -o "fast_irc" "${@}" -rdynamic /usr/lib/crystal/ext/libcrystal.a -levent -lrt -lpcre -lgc -lpthread -ldl`


Additional info:
Crystal package 0.12.0-1


Steps to reproduce:
$ touch empty.cr
$ crystal empty.cr
This task depends upon

Closed by  Anatol Pomozov (anatolik)
Friday, 04 March 2016, 20:39 GMT
Reason for closing:  Fixed
Additional comments about closing:  0.12.0-2
Comment by Anatol Pomozov (anatolik) - Thursday, 03 March 2016, 14:14 GMT
Repro steps work for me

$ sudo pacman -S crystal
$ touch empty.cr
$ crystal empty.cr
empty.cr
$ crystal build empty.cr
$ ls
empty empty.cr
$ ./empty
Comment by Jonne Haß (MrZYX) - Friday, 04 March 2016, 13:40 GMT
It looks like this is caused by installing hardening-wrapper

$ sudo pacman -S crystal hardening-wrapper
[Get a new login shell]
$ touch empty.cr
$ crystal empty.cr
/usr/bin/ld: /usr/lib/crystal/ext/libcrystal.a(sigfault.o): relocation R_X86_64_32S against `sigfault_handler' can not be used when making a shared object; recompile with -fPIC
[...]
$ export PATH="$(echo "$PATH" | tr -s ':' '\n' | grep -v "hardening-wrapper" | tr -s '\n' ':')"
$ crystal empty.cr
$

I fixed this upstream by compiling libcrystal.a with -fPIC: https://github.com/crystal-lang/crystal/commit/c73d9322a6dca580bacfaf58070391317294af43

Comment by Anatol Pomozov (anatolik) - Friday, 04 March 2016, 15:12 GMT
Thanks Jonne. When do you plan to make a new crystal release? Should I wait for it or it is better to pull the commit and rebuild 0.12.0?
Comment by Jonne Haß (MrZYX) - Friday, 04 March 2016, 20:01 GMT
Release should come these days, exporting CFLAGS="-fPIC" during build time should workaround this too.
Comment by Anatol Pomozov (anatolik) - Friday, 04 March 2016, 20:39 GMT
I actually just pushed 0.12.0-2 to [community].

Loading...