Crystal build fails with error - cannot find -levent - crystal-lang

I was getting this error while trying to run a simple crystal program in my ubuntu.
/usr/bin/ld: cannot find -levent (this usually means you need to install the development package for libevent)
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: cc "${#}" -o /home/xyz/.cache/crystal/crystal-run-test.tmp -rdynamic -L/home/xyz/.asdf/installs/crystal/1.1.1/bin/../lib/crystal/lib -lpcre -lm -lgc -lpthread -levent -lrt -ldl

Issue has been solved by installing libevent packages by running the following command:
sudo apt-get install libevent-dev

Related

SDL library error: cannot find -lSDL_ttf cannot find -lSDL_image

I'm running a C++ program using sdl, my ubuntu version is 16.04.
After I sudo apt-get install libsdl1.2-dev and run the following displays :
g++ sdl-config --cflags -g -W -Wall -Weffc++ -Wextra -pedantic -O0 main.cpp -o run generateFrames.o sdl-config --libs -lSDL_ttf -lSDL_image
/usr/bin/ld: cannot find -lSDL_ttf
/usr/bin/ld: cannot find -lSDL_image
collect2: error: ld returned 1 exit status
Makefile:10: recipe for target 'run' failed
make: *** [run] Error 1
How to get rid of this error ?
You only installed SDL library. SDL_image and SDL_ttf are different libraries. You can download them via sudo apt-get install libsdl-image1.2-dev libsdl-ttf2.0-dev. There is also another popular SDL extension SDL_mixer: libsdl-mixer1.2-dev

/usr/bin/ld: cannot find -lGL (Ubuntu 14.04)

I'm trying to build a project created in QT Creator and unfortunately every time I try to compile I get an error. Here is my compiler output:
23:02:20: Running steps for project WallpaperAppQt...
23:02:20: Configuration unchanged, skipping qmake step.
23:02:20: Starting: "/usr/bin/make"
g++ -m64 -o WallpaperAppQt main.o mainwindow.o moc_mainwindow.o -L/usr/X11R6/lib64 -lQt5Widgets -L/usr/lib/x86_64-linux-gnu -lQt5Gui -lQt5Core -lGL -lpthread
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make: *** [WallpaperAppQt] Error 1
23:02:20: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project WallpaperAppQt (kit: Desktop)
When executing step 'Make'
23:02:20: Elapsed time: 00:00.
You need a package that provides the libGL.so (no version suffix) symlink. In Ubuntu, it's in the libgl1-mesa-dev package. So just do:
sudo apt install libgl1-mesa-dev
I was able to fix my problem by following the instructions in this link:
http://techtidings.blogspot.com/2012/01/problem-with-libglso-on-64-bit-ubuntu.html
(the final two commands)
sudo rm /usr/lib/x86_64-linux-gnu/libGL.so
sudo ln -s /usr/lib/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so
I was having the same problem. Then I used the following command in the terminal:
sudo apt install mesa-common-dev libglu1-mesa-dev"
and the application run perfectly.
It's obvious that ld doesn't find lib GL in default library path which should be include /lib* /usr/lib*. You should install library GL or tell g++ where lib GL was installed with cmd args -L if that was installed already.

Crystal build fails with linker error

I've just tried to run the simple HTTP server from the language documentation. The program fails with an error.
/usr/bin/ld: cannot find -lssl
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc -o "/home/rasmus/dev/crystal/projects/hello/.crystal/crystal-run-hello.tmp" "${#}" -rdynamic -lssl -levent -lrt -lpcl -lpcre -lgc -lpthread -ldl`
The program has been copy-pasted from the documentation.
I can confirm that the program did/does run on my guest machine, but not on my host. Both are Ubuntu 14.04.3 installs.
The problem was simply that the SSL libraries weren't installed. If you have the same problem you can simply run sudo apt-get install libssl-dev. This should install everything needed to fix the error.

gcc: cannot find -lasound when crosscompiling

I try to crosscompile this small program to my arm device, but get error:
arm-none-linux-gnueabi/bin/ld: cannot find -lasound
collect2: error: ld returned 1 exit status
Then i found libasound files in my target device and have copied to my folder /usr/lib but still no effect.
I use the commands:
export CFLAGS="-I/usr/include -I/usr/lib"
$CC -o play sound_playback.c $CFLAGS -lasound
I have installed libasound2-dev package on my Ubuntu 14.04 x64 and be able to compile the program on my native computer without any errors.
UPDATE WITH SOLUTION
As Marc and John have said below, i just should use -L flag to set my library path. So my command line should be:
$CC -o play sound_playback.c $CFLAGS -L/usr/lib -lasound

Install gdb-7.2 on Solaris 11 for segmentation fault error

I am trying to install gdb-7.2 on Solaris 11 for debugging a c++ script that is issuing a segmentation fault alert.
Once configured (./configure),
checking whether -fkeep-inline-functions is supported... yes
configure: creating ./config.status
config.status: creating Makefile
I move on make (make) however this fails with the following errors:
ar: creating libgdb.a ranlib libgdb.a
rm -f gdb
gcc -g -O2 -rdynamic \
-o gdb gdb.o libgdb.a \
../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a \
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a \
-ldl -lcurses -lz -lsocket -lnsl -lm -lsocket -lnsl -ldl -lm \
-lpython2.6 -lexpat ../libiberty/libiberty.a gnulib/libgnu.a
Undefined first referenced symbol in file
wattr_on libgdb.a(tui-wingeneral.o)
wattr_off libgdb.a(tui-wingeneral.o)
ld: fatal: symbol referencing errors. No output written to gdb collect2: ld returned 1 exit status
*** Error code 1 make: Fatal error: Command failed for target `gdb'
What could be the possible issue and is there any solution for this?
It looks like some bug linking against the Solaris curses library. Offhand I can't diagnose it. It's worth digging into and patching upstream...
Meanwhile, you can probably work around it by configuring with --disable-tui.