crystal can't find libevent on CentOS 6.9

Created on 28 Jan 2018  路  14Comments  路  Source: crystal-lang/crystal

Hello dear sirs,

I have problems running/building any .cr on my CentOS 6.9 system (Linode VM actually).

Here's error message:

E-vent5858B-ase.o: In function `*Event::Base#new_event<Int32, LibEvent2::EventFlags, Fiber, &Proc(Int32, LibEvent2::EventFlags, Pointer(Void), Nil)>:Event::Event':
Event::Base:(.text+0xbf): undefined reference to `event_new'
E-vent5858B-ase.o: In function `*Event::Base#new_event<Int32, LibEvent2::EventFlags, IO::FileDescriptor+, &Proc(Int32, LibEvent2::EventFlags, Pointer(Void), Nil)>:Event::Event':
Event::Base:(.text+0x15f): undefined reference to `event_new'
E-vent5858B-ase.o: In function `*Event::Base#new_event<Int32, LibEvent2::EventFlags, IO::FileDescriptor, &Proc(Int32, LibEvent2::EventFlags, Pointer(Void), Nil)>:Event::Event':
Event::Base:(.text+0x1ef): undefined reference to `event_new'
E-vent5858B-ase.o: In function `*Event::Base#new_event<Int32, LibEvent2::EventFlags, File, &Proc(Int32, LibEvent2::EventFlags, Pointer(Void), Nil)>:Event::Event':
Event::Base:(.text+0x27f): undefined reference to `event_new'
E-vent5858E-vent.o: In function `*Event::Event#free:Bool':
Event::Event:(.text+0x1a7): undefined reference to `event_free'
collect2: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o '/home/kost/.cache/crystal/crystal-run-test.tmp'  -rdynamic  -lpcre -lgc -lpthread /usr/share/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib`

Here's additional info:

[kost@dev]% cat /etc/redhat-release
CentOS release 6.9 (Final)

[kost@dev]% ldconfig -p | grep event
    libevent_extra-1.4.so.2 (libc6,x86-64) => /usr/lib64/libevent_extra-1.4.so.2
    libevent_core-1.4.so.2 (libc6,x86-64) => /usr/lib64/libevent_core-1.4.so.2
    libevent-1.4.so.2 (libc6,x86-64) => /usr/lib64/libevent-1.4.so.2
    libdevmapper-event.so.1.02 (libc6,x86-64) => /lib64/libdevmapper-event.so.1.02
    libdevmapper-event-lvm2thin.so (libc6,x86-64) => /lib64/libdevmapper-event-lvm2thin.so
    libdevmapper-event-lvm2snapshot.so (libc6,x86-64) => /lib64/libdevmapper-event-lvm2snapshot.so
    libdevmapper-event-lvm2raid.so (libc6,x86-64) => /lib64/libdevmapper-event-lvm2raid.so
    libdevmapper-event-lvm2mirror.so (libc6,x86-64) => /lib64/libdevmapper-event-lvm2mirror.so
    libdevmapper-event-lvm2.so.2.02 (libc6,x86-64) => /lib64/libdevmapper-event-lvm2.so.2.02

[kost@dev]% crystal --version
Crystal 0.24.1 (2017-12-22)

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

[kost@dev]% cc --version
cc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Ready to submit more diagnostic info as needed.

Thanks for all your efforts.

Most helpful comment

This kind of problem is exactly why we should work to get crystal into distro packages, not work to make our own standalone packages.

All 14 comments

May be you could try with --link-flags "-L/usr/lib64"

@S-YOU Nice point, but I forgot to mention that I tried without any result :(

[kost@dev]% crystal run --link-flags "-L/usr/lib64" test.cr
E-vent5858B-ase.o: In function `*Event::Base#new_event<Int32, LibEvent2::EventFlags, Fiber, &Proc(Int32, LibEvent2::EventFlags, Pointer(Void), Nil)>:Event::Event':
Event::Base:(.text+0xbf): undefined reference to `event_new'
E-vent5858B-ase.o: In function `*Event::Base#new_event<Int32, LibEvent2::EventFlags, IO::FileDescriptor+, &Proc(Int32, LibEvent2::EventFlags, Pointer(Void), Nil)>:Event::Event':
Event::Base:(.text+0x15f): undefined reference to `event_new'
E-vent5858B-ase.o: In function `*Event::Base#new_event<Int32, LibEvent2::EventFlags, IO::FileDescriptor, &Proc(Int32, LibEvent2::EventFlags, Pointer(Void), Nil)>:Event::Event':
Event::Base:(.text+0x1ef): undefined reference to `event_new'
E-vent5858B-ase.o: In function `*Event::Base#new_event<Int32, LibEvent2::EventFlags, File, &Proc(Int32, LibEvent2::EventFlags, Pointer(Void), Nil)>:Event::Event':
Event::Base:(.text+0x27f): undefined reference to `event_new'
E-vent5858E-vent.o: In function `*Event::Event#free:Bool':
Event::Event:(.text+0x1a7): undefined reference to `event_free'
collect2: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o '/home/kost/.cache/crystal/crystal-run-test.tmp' -L/usr/lib64 -rdynamic  -lpcre -lgc -lpthread /usr/share/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib`

You need libevent2 not libevent 1.x.

@ysbaddaden that's strange, because this version of libevent was installed by crystal package intself (from https://dist.crystal-lang.org/rpm/ repo).

[kost@dev]% repoquery --requires --recursive --resolve --pkgnarrow=all crystal | grep event
libevent-devel-0:1.4.13-4.el6.x86_64
libevent-devel-0:1.4.13-4.el6.i686

Just tried it on clean updated CentOS 6.9 as a doublecheck - same results.

@zarianu could you confirm if this also happened in 0.23.1 ?
For 0.24.1 the packaging for 64 bits version was redone and maybe some dependency needs to be improved.
Note that the 0.24.1 packaging for 32 bits is the same as in 0.23.1.

@bcardiff just installed 0.23.1, same results:

[kost@dev]% crystal version
Crystal 0.23.1 [e2a1389e8] (2017-07-13) LLVM 3.8.1
[kost@dev]% crystal test.cr
E-vent5858B-ase.o: In function `*Event::Base#new_event<Int32, LibEvent2::EventFlags, IO::FileDescriptor, &Proc(Int32, LibEvent2::EventFlags, Pointer(Void), Nil)>:Event::Event':
Event::Base:(.text+0xbf): undefined reference to `event_new'
E-vent5858B-ase.o: In function `*Event::Base#new_event<Int32, LibEvent2::EventFlags, IO::FileDescriptor+, &Proc(Int32, LibEvent2::EventFlags, Pointer(Void), Nil)>:Event::Event':
Event::Base:(.text+0x14f): undefined reference to `event_new'
E-vent5858B-ase.o: In function `*Event::Base#new_event<Int32, LibEvent2::EventFlags, File, &Proc(Int32, LibEvent2::EventFlags, Pointer(Void), Nil)>:Event::Event':
Event::Base:(.text+0x1ff): undefined reference to `event_new'
E-vent5858B-ase.o: In function `*Event::Base#new_event<Int32, LibEvent2::EventFlags, Fiber, &Proc(Int32, LibEvent2::EventFlags, Pointer(Void), Nil)>:Event::Event':
Event::Base:(.text+0x28f): undefined reference to `event_new'
E-vent5858E-vent.o: In function `*Event::Event#free:Bool':
Event::Event:(.text+0x197): undefined reference to `event_free'
collect2: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o '/home/kost/.cache/crystal/crystal-run-test.tmp'  -rdynamic  -lpcre -lgc -lpthread /opt/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib`

This is a Centos vs Fedora packaging compatibility issue. Centos provides both libevent (v1.4) and libevent2 (2.0) whereas Fedora only has libevent (2.0). The same RPM package can't be defined/installed properly for both, it would seem?

I've installed last release from .tar.gz and it works like a charm (with libevent2-devel package installed).

But libevent2-devel conflicts with libevent-devel so this might be a problem in some cases.

This kind of problem is exactly why we should work to get crystal into distro packages, not work to make our own standalone packages.

Hey guys, is there any solution for this issue ?

@plassa-b install the libevent2-devel package.

Yes but if I do this, the libevent-devel package conflicts with libevent2-devel. But if I uninstall libevent-devel, I can't install crystal because it requires libevent-devel.
So is a new rpm iteration planned ?

We'd need to have seperate RPMs for fedora and centos which differ only in the lists of dependencies. Shouldn't be too hard technically but then that requires 2 rpm repositories and changes all over the place in the packaging setup and instructions. So for now i'd say it's low priority since you can always use the tar.gz package.

Question to people that uses redhat/centos . I see that some .rpm packages include the distro like .el6. somewhere in the name.

Would it be ok if we treat RedHat and Centos as equals, but separate from fedora?

So,

  • .el6 packages can be used for RHEL6 and Centos 6.
  • .el7 packages can be used for RHEL7 and Centos 7.
  • .fc30 packages can be used for Fedora 30.
  • etc.
Was this page helpful?
0 / 5 - 0 ratings