Why I obtain "cannot find -ljvm" error message when I try to compile a C project? - c

I have the following problem compiling a C project into Linux Ubuntu 12.04 shell
I first execute:
make clean
and it work well
Thene I execute:
make all
and then I obtain the following error message:
gcc -L/usr/local/default/jre/lib/i386/client -o "atmosfs" ./bbfs.o ./cimeparser.o ./settingsparser.o ./log.o ./hashtable.o ./jniHelper.o ./decodeError.o -lpthread -lxml2 -lfuse -ljvm -lrt -ldl
/usr/bin/ld: cannot find -ljvm
collect2: ld returned 1 exit status
make: *** [atmosfs] Errore 1
As you can see the error is:
/usr/bin/ld: cannot find -ljvm
What can I do to try to solve this issue?
Tnx

Related

using .rodata and -fPIE in compliation [duplicate]

This question already has an answer here:
32-bit absolute addresses no longer allowed in x86-64 Linux?
(1 answer)
Closed last month.
I'm a student currently taking a computer structures course and I have an assignement for writing in aseembly and C. I've found an issue I don't quite understand. We were given a makefile for running the program, and when connecting to our school's servers it works as intended. The issue arises when trying to use the same makefile on my personal machine. One of the assembly files (and likely more as I continue working) utilizes a .rodata section. Attempting to use the makefile as it was given results in the following error:
gcc -g -o a.out main.o run_main.o func_select.o pstring.o
/usr/bin/ld: func_select.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make: *** [makefile:2: a.out] Error 1
attempting to add one of the following
-fpie -fPIE or -no-pie
in between
-o
and a.out
results in the following error
gcc -g -o -fPIE a.out main.o run_main.o func_select.o pstring.o
/usr/bin/ld: cannot find a.out: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [makefile:2: a.out] Error 1
I'm sorry if this is considered a silly question however I can't figuere it out.
The expectation was for the makefile to create all of the .o files and a.out, however the a.out file never works.
In addition writing the following: gcc -g -fPIE -o a.out main.o run_main.o func_select.o pstring.o still creates an error, specifically
gcc -g -fPIE -o a.out main.o run_main.o func_select.o pstring.o
/usr/bin/ld: func_select.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make: *** [makefile:2: a.out] Error 1
As per man gcc:
gcc [-c|-S|-E] [-std=standard]
[-g] [-pg] [-Olevel]
[-Wwarn...] [-Wpedantic]
[-Idir...] [-Ldir...]
[-Dmacro[=defn]...] [-Umacro]
[-foption...] [-mmachine-option...]
[-o outfile] [#file] infile...
-o requires outfile parameter. This should work:
gcc -g -fPIE -o a.out main.o run_main.o func_select.o pstring.o

How to solve the linking error in libwebsockets

I use libwebsockets for a client program in C. Therefore I build the library for the libwebsocktes locally on my machine (ubuntu). After I want to Build the Project in Eclipse, I get the following output:
14:58:40 **** Incremental Build of configuration Build (GNU) for project ClientA ****
make all
cc -o clientA ifaddrs.o mo.o misc.o dm.o ws.o -lcurl -lrt -lxml2 -ljson-c -lssl -lcrypto -lpthread -Wl,-Bstatic -L/home/vps/src/libwebsockets/build/lib -lwebsockets -Wl,-Bdynamic
/usr/bin/ld: /home/bla/libwebsockets/build/lib/libwebsockets.a(ssl.c.o): undefined reference to symbol 'SSL_get_fd##OPENSSL_1.0.0'
/usr/lib/gcc/i686-linux-gnu/4.7/../../../i386-linux-gnu/libssl.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [clientA] Error 1
14:58:41 Build Finished (took 1s.223ms)
It seems to be a problem with the libwebsockets.a. But how I can solve it ?

What openGL package am I missing?

I am trying to resurrect on old OpenGL program on a Linux Mint system. I installed freeglut3-dev using Synaptic Package Manager. The compiler does not complain about not being able to find the glut include file anymore, but now I have other problems:
cc -Wall -o gears main.c draw_gears.c gl_drawing.c load_data.c normal.c prep_data.c -lglut
/usr/bin/ld: /tmp/ccfNsT0O.o: undefined reference to symbol 'glNewList'
//usr/lib/i386-linux-gnu/mesa/libGL.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [gears] Error 1
Try this:
cc -Wall -o gears main.c draw_gears.c gl_drawing.c load_data.c normal.c prep_data.c -lglut -lGLU -lGL

ld: Mismatched Data ABI

When I am trying to compile a C code in HP-UX I am getting the following error :
gcc -g -O2 -o autocode /disk1/peru-dev/NIKIRATOOLS/FLEX/lib/hpux64/libfl.a grammer.o tokens.o pgen.o javapgen.o
ld: Mismatched Data ABI. Expected None but found EF_IA_64_ABI64 in file /disk1/peru-dev/NIKIRATOOLS/FLEX/lib/hpux64/libfl.a[libmain.o]
Fatal error.
collect2: ld returned 1 exit status
gmake[1]: *** [autocode] Error 1
I am not able to understand this "Mismatched Data ABI" error. Please help me out.

when linking with "ld" am getting following error?

Am getting following error when doing linking.
/usr/bin/ld: cannot find -lfl
======
cc -g .//obj/add.o .//obj/append.o .//obj/check.o .//obj/compare.o .//obj/free_mem.o
.//obj/output.o .//obj/postmosy.o .//obj/premosyy.o .//obj/premosyl.o .//obj/process.o
.//obj/store.o -o v2comp -lfl
/usr/bin/ld: cannot find -lfl
collect2: ld returned 1 exit status
make: *** [v2comp] Error 1
thanks
Rajesh kumar V
This should help:
sudo apt-get install libfl-dev

Resources