tony#tony-HP-2000-Notebook-PC:~$ cd '/home/tony/Desktop/run-privexec'
tony#tony-HP-2000-Notebook-PC:~/Desktop/run-privexec$ make install
mkdir -p build build/obj
gcc -lcap -lecryptfs build/obj/main.o build/obj/privexec.o build/obj/utils.o build/obj/perms.o -o build/privexec
build/obj/privexec.o: In function `insert_key':
privexec.c:(.text+0x7df): undefined reference to `ecryptfs_add_passphrase_key_to_keyring'
build/obj/privexec.o: In function `remove_key':
privexec.c:(.text+0xdcb): undefined reference to `ecryptfs_remove_auth_tok_from_keyring'
build/obj/perms.o: In function `drop_privileges':
perms.c:(.text+0x73): undefined reference to `cap_get_proc'
perms.c:(.text+0x9d): undefined reference to `cap_set_flag'
perms.c:(.text+0xa5): undefined reference to `cap_set_proc'
perms.c:(.text+0xad): undefined reference to `cap_free'
build/obj/perms.o: In function `raise_privileges':
perms.c:(.text+0x125): undefined reference to `cap_get_proc'
perms.c:(.text+0x14f): undefined reference to `cap_set_flag'
perms.c:(.text+0x157): undefined reference to `cap_set_proc'
perms.c:(.text+0x15f): undefined reference to `cap_free'
collect2: ld returned 1 exit status
make: *** [privexec] Error 1
Your Makefile produces this command:
gcc -lcap -lecryptfs build/obj/main.o ...
which is incorrect. It should be:
gcc build/obj/main.o ... -lcap -lecryptfs
The order of object files and libraries on the link line matters. You can read here or here to understand why it does.
Related
I am trying to access Oracle database using OCILIB on Ubuntu.
I use that on the command line:
gcc -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_ANSI -L/u01/app/oracle/product/11.2.0/xe//lib -lclntsh -I$/home/user/Desktop/ocilib-4.3.1/include -locilib test.c -o con
But I am getting the following error:
test.c:(.text+0x20): undefined reference to `OCI_Initialize'
test.c:(.text+0x39): undefined reference to `OCI_ConnectionCreate'
test.c:(.text+0x49): undefined reference to `OCI_StatementCreate'
test.c:(.text+0x5e): undefined reference to `OCI_ExecuteStmt'
test.c:(.text+0x6a): undefined reference to `OCI_GetResultset'
test.c:(.text+0x81): undefined reference to `OCI_GetString'
test.c:(.text+0x95): undefined reference to `OCI_GetInt'
test.c:(.text+0xb5): undefined reference to `OCI_FetchNext'
test.c:(.text+0xbe): undefined reference to `OCI_Cleanup'
collect2: error: ld returned 1 exit status
You didn't link against ocilib library. Add -llibocilib to your command line.
For testing and fun purposes I downloaded the Shakespeare Programming language.
http://shakespearelang.sourceforge.net/
I tried to run the Makefile through make
and it spits out this result:
gcc grammar.tab.o scanner.o strutils.o -O2 -Wall -lfl -o spl2c
grammar.tab.o: In function `report_error':
grammar.tab.c:(.text+0x9): undefined reference to `yylineno'
grammar.tab.o: In function `report_warning':
grammar.tab.c:(.text+0x49): undefined reference to `yylineno'
grammar.tab.o: In function `yyparse':
grammar.tab.c:(.text+0x515): undefined reference to `yylex'
grammar.tab.c:(.text+0x682): undefined reference to `yylineno'
grammar.tab.c:(.text+0x708): undefined reference to `yylineno'
grammar.tab.c:(.text+0x7ce): undefined reference to `yylineno'
grammar.tab.c:(.text+0x882): undefined reference to `yylineno'
grammar.tab.c:(.text+0x8f6): undefined reference to `yylineno'
grammar.tab.o:grammar.tab.c:(.text+0x9aa): more undefined references to `yylineno' follow
collect2: error: ld returned 1 exit status
make: *** [spl2c] Error 1
Does anyone know what could be going wrong when trying to make?
I tried looking at this to resolve my issue but found nothing.
I am getting the following errors:
/tmp/ccno287V.o: In function `download_feed':
feedObtain.c:(.text+0xb9): undefined reference to `curl_easy_init'
feedObtain.c:(.text+0xde): undefined reference to `curl_easy_setopt'
feedObtain.c:(.text+0xff): undefined reference to `curl_easy_setopt'
feedObtain.c:(.text+0x10b): undefined reference to `curl_easy_perform'
collect2: error: ld returned 1 exit status
Command used to get libcurl:
apt-get install libcurl4-gnut
Your program is not linked with the libcurl library and hence the linker complains that it could resolve symbols. Link the library with:
cc feedObtain.c -lcurl
Note that the library must be specified at the end of the commandline options.
I am trying to install a program that consist of a folder with some C files. I run the makefile but i get the following error:
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1128: undefined reference to `tgoto'
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1129: undefined reference to `tputs'
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1138: undefined reference to `tputs'
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1145: undefined reference to `tputs'
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1154: undefined reference to `tputs'
readline/libreadline.a(display.o): In function `delete_chars':
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1182: undefined reference to `tgoto'
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1183: undefined reference to `tputs'
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/display.c:1189: undefined reference to `tputs'
readline/libreadline.a(signals.o): In function `cr':
/home/silviu/Desktop/tipsy-2.2.3d/code/readline/signals.c:301: undefined reference to `tputs'
collect2: error: ld returned 1 exit status
Do you know how can I solve it? (on Ubuntu)
You have used tputs in c program so you must have use #include <curses.h> and #include <term.h>. Undefined reference is linker error. In Makefile while compiling c program you should link -lcurses or -lncurses. Add similar line to your Makefile. compile with appropriate linking library.
For example
gcc file.c -o output_file -lcurses -ltermcap
or
gcc file.c -o output_file -lcurses -ltermcap
I want to compile the client for redis in C. I've downloaded and installed the libevent library and the hiredis files. I've used this command:
gcc -I/home/tasos/Dropbox/lists/hiredis example-libevent.c -levent
but I get these errors:
/tmp/ccxoerYJ.o: In function `redisLibeventReadEvent':
example-libevent.c:(.text+0x28): undefined reference to `redisAsyncHandleRead'
/tmp/ccxoerYJ.o: In function `redisLibeventWriteEvent':
example-libevent.c:(.text+0x56): undefined reference to `redisAsyncHandleWrite'
/tmp/ccxoerYJ.o: In function `getCallback':
example-libevent.c:(.text+0x2d2): undefined reference to `redisAsyncDisconnect'
/tmp/ccxoerYJ.o: In function `main':
example-libevent.c:(.text+0x393): undefined reference to `redisAsyncConnect'
example-libevent.c:(.text+0x3f3): undefined reference to `redisAsyncSetConnectCallback'
example-libevent.c:(.text+0x404): undefined reference to `redisAsyncSetDisconnectCallback'
example-libevent.c:(.text+0x45d): undefined reference to `redisAsyncCommand'
example-libevent.c:(.text+0x47d): undefined reference to `redisAsyncCommand'
collect2: ld returned 1 exit status
why isn't this working?
Use -levent and -lhiredis compile option in command.