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
Related
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
I'm trying to install HLA-LA on my 2016 MacBookPro (running Mojave 10.14.3) but I've been having issues compiling the makefile. I've installed all the dependencies, added the bamtools and boost paths as the README describes, and added CFLAGS to specify c++11. Still, when I run the makefile I get the following error:
$ make all
/usr/local/Cellar/gcc/8.3.0/bin/g++-8 -I/usr/local/Cellar/boost/1.68.0_1/include -I/usr/local/Cellar/bamtools/2.5.1/include/bamtools -I/usr/local/Cellar/bamtools/2.5.1/src -std=c++11 -ggdb -O2 -fopenmp -std=gnu++0x -fstack-protector-all HLA-LA.cpp -c -o ../obj/HLA-LA.o;
/usr/local/Cellar/gcc/8.3.0/bin/g++-8 -I/usr/local/Cellar/boost/1.68.0_1/include -I/usr/local/Cellar/bamtools/2.5.1/include/bamtools -I/usr/local/Cellar/bamtools/2.5.1/src -std=c++11 -ggdb -O2 -fopenmp -std=gnu++0x -fstack-protector-all ../obj/Edge.o ../obj/Graph.o ../obj/GraphAndEdgeIndex.o ../obj/Node.o ../obj/HaplotypePanel.o ../obj/simpleGraphSimulator.o ../obj/LocusCodeAllocation.o ../obj/simulator.o ../obj/readSimulator.o ../obj/trueReadLevels.o ../obj/processBAM.o ../obj/protoSeeds.o ../obj/oneRead.o ../obj/oneReadPair.o ../obj/oneReadPairwithSeedChains.o ../obj/alignerBase.o ../obj/alignmentContext.o ../obj/extensionAligner.o ../obj/BWAmapper.o ../obj/Bowtie2mapper.o ../obj/statistics.o ../obj/VirtualNWUnique.o ../obj/PRGContigBAMAlignment.o ../obj/verboseSeedChain.o ../obj/HLATyper.o ../obj/pathFinder.o ../obj/linearALTs.o ../obj/oneExonPosition.o ../obj/seedChain.o ../obj/Utilities.o ../obj/HLA-LA.o -o ../bin/HLA-LA -L/usr/local/Cellar/boost/1.68.0_1/lib -L/usr/local/Cellar/bamtools/2.5.1/lib64 -L/usr/local/Cellar/zlib/1.2.11/lib -lboost_random -lboost_filesystem -lboost_system -lbamtools -lz -lboost_serialization;
collect2: fatal error: ld terminated with signal 11 [Segmentation fault: 11]
compilation terminated.
ld: unexpected token: !tapi-tbd-v3 file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64
make: *** [HLA-LA] Error 1
I've seen other people with similar errors, but the recommended fixes havent worked. I've also tried specifying CLT via the path: /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/ but it doesn't change the outcome at all. I read some thread that suggested it could be an ld issue but I'm not sure how I can fix that? Here are my specs:
macOS: 10.14.3-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
I am trying to install readline using the command "python setup.py install" by navigating to the directory where i untarred readline 6.2.4.1.
ncurses-6.0 is currently installed in the server.
I have tried recompiling with -fPIC but that also doesnt seem to solve the problem
Command: sudo CFLAGS="-fPIC" python setup.py install
Error Log:
building 'readline' extension
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -fPIC -DHAVE_RL_CALLBACK -DHAVE_RL_CATCH_SIGNAL -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_COMPLETION_SUPPRESS_APPEND -DHAVE_RL_PRE_INPUT_HOOK -I. -I/home/roaming/i332346/opt/Python-local/include/python2.7 -c Modules/2.x/readline.c -o build/temp.linux-x86_64-2.7/Modules/2.x/readline.o -Wno-strict-prototypes
In file included from /home/roaming/i332346/opt/Python-local/include/python2.7/Python.h:126:0,
from Modules/2.x/readline.c:8:
/home/roaming/i332346/opt/Python-local/include/python2.7/modsupport.h:27:1: warning: ‘PyArg_ParseTuple’ is an unrecognized format function type [-Wformat=]
PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);
^
gcc -pthread -shared -fPIC build/temp.linux-x86_64-2.7/Modules/2.x/readline.o readline/libreadline.a readline/libhistory.a -lncurses -o build/lib.linux-x86_64-2.7/readline.so
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: /usr/lib/libncurses.a(lib_termcap.o): relocation R_X86_64_32 against `_nc_globals' can not be used when making a shared object; recompile with -fPIC
/usr/lib/libncurses.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
I tried the following and it worked.
Navigate to ncurses directory that contains configure and run the following
./configure --with-shared --without-debug
make
make install
Then install readline again. The error desappeared. The module was successfully installed.
I installed GLFW3 and am trying to compile my OpenGL program with the following:
g++ -std=c++11 main.cpp -lGL -lGLEW -lglfw3
But here's the library error I get:
/usr/bin/ld: cannot find -lglfw3
collect2: error: ld returned 1 exit status
I also tried with pkg-config:
g++ `pkg-config --cflags glfw3 glew` -o myprog main.cpp `pkg-config --static --libs glfw3 glew`
it compiles but when I run myprog it says it can't find libglfw.so.3
But it is located in /usr/local/lib
http://www.brandonfoltz.com/2012/12/compile-glfw-on-ubuntu-and-fix-libglfw-so-cannot-open-error/
Ubuntu installs libglfw.so.3 in /usr/local/lib so you have to add this line to /etc/ld.so.conf
I had the same problem.
In my case was usefull following steps:
Download glfw source code
unzip it
cd glfw_folder
cmake . (with dot)
make
sudo make install
To check, copy and paste following command in your console "whereis libglfw3".
you should have output like this one: "libglfw3: /usr/local/lib/libglfw3.a" (or another path after ":").
My config: VAIO Pro 13/Ubuntu 16.04 LTS/ Intel HD4000.
P.S.: Yes, I'd tryed "sudo apt-get install libglfw3" and all dependenses.
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