I'm going to assemble a program. But errors followed.
gcc -no-pie final.s -ldl -lm -lz -lrt -lpthread -lcrypt -lgmp -m64
/usr/bin/ld: error in /tmp/ccjXcZiN.o(.eh_frame); no .eh_frame_hdr table will be created.
/tmp/ccjXcZiN.o: In function `S_0x404C5A':
(.text+0x775): undefined reference to `have_libloaded'
/tmp/ccjXcZiN.o: In function `BB_73':
(.text+0x78f): undefined reference to `libhandle'
/tmp/ccjXcZiN.o: In function `BB_74':
(.text+0x79c): undefined reference to `load_library_errmsg'
/tmp/ccjXcZiN.o: In function `S_0x404CA0':
(.text+0x7bf): undefined reference to `have_libloaded'
collect2: error: ld returned 1 exit status
I know that there're some other libraries needed on the machine. But i can't search for the specific library name.
Related
I flow the Official website to build mcsema using native build approach.Everything seems OK.Since my ida is on Windows,so I use the command of
%IDA_ROOT%\ida64.exe -S"C:\Users\dkl\Desktop\source\mcsema\tools\mcsema_disass\ida7\get_cfg.py --output
C:\Users\dkl\Desktop\output.cfg --arch amd64 --os linux" C:\Users\dkl\Desktop\work\t2\a.out
to generate output.cfg ,that is OK
then
mcsema-lift-11.0 --arch amd64 --os linux --cfg ./output.cfg --output ./output.bc
that is OK,then
remill-clang-11 -o ./output ./output.bc -lpthread -lm -ldl -llzma -Wl,--section-start=.section_1ff00000=0x1ff00000
COUNTER A ERROR
root#DESKTOP-CS6BMJI:/mnt/c/Users/dkl/Desktop# mcsema-lift-11.0 --arch amd64 --os linux --cfg ./output.cfg --output ./output.bc
root#DESKTOP-CS6BMJI:/mnt/c/Users/dkl/Desktop# remill-clang-11 -o ./output ./output.bc -lpthread -lm -ldl -llzma -Wl,--section-start=.section_1ff00000=0x1ff00000
warning: overriding the module target triple with x86_64-unknown-linux-gnu [-Woverride-module]
1 warning generated.
/usr/bin/ld: /tmp/output-3e1099.o: in function sub_401020': llvm-link:(.text+0x152): undefined reference to __remill_jump'
/usr/bin/ld: /tmp/output-3e1099.o: in function sub_401040__start': llvm-link:(.text+0x2cb): undefined reference to __remill_function_call'
/usr/bin/ld: /tmp/output-3e1099.o: in function sub_401160___libc_csu_init': llvm-link:(.text+0x939): undefined reference to __remill_function_call'
/usr/bin/ld: /tmp/output-3e1099.o: in function sub_401000__init_proc': llvm-link:(.text+0xe2d): undefined reference to __remill_function_call'
/usr/bin/ld: /tmp/output-3e1099.o: in function ext_404040_printf': llvm-link:(.text+0x10da): undefined reference to __remill_function_call'
/usr/bin/ld: /tmp/output-3e1099.o:(.rodata+0x2138): undefined reference to `__mcsema_attach_call'
remill-clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
root#DESKTOP-CS6BMJI:/mnt/c/Users/dkl/Desktop#
For my bachelor thesis I want to apply this algorithm proposed here: Binarization by Tissier
I cloned the repository and tried to run cd near-lossless-binarization in the corrsponding directory.
However there comes up an error I don't know how to solve.
cd near-lossless-binarization && make
gcc binarize.c -o binarize -ansi -pedantic -Wall -Wextra -Wno-unused-result -Ofast -funroll-loops -lblas -lm
/usr/bin/ld: /tmp/ccxe5d0J.o: in function `apply_regularizarion_gradient':
binarize.c:(.text+0xddc): undefined reference to `cblas_sgemm'
/usr/bin/ld: binarize.c:(.text+0xf9e): undefined reference to `cblas_sgemm'
/usr/bin/ld: /tmp/ccxe5d0J.o: in function `apply_reconstruction_gradient':
binarize.c:(.text+0x1059): undefined reference to `cblas_sgemm'
/usr/bin/ld: binarize.c:(.text+0x12fb): undefined reference to `cblas_sgemm'
/usr/bin/ld: binarize.c:(.text+0x1800): undefined reference to `cblas_sgemm'
/usr/bin/ld: /tmp/ccxe5d0J.o:binarize.c:(.text+0x1e71): more undefined references to `cblas_sgemm' follow
collect2: Error: ld gab 1 as end-Status returned
Seems like there is an issue inside the corresponding file.
I already opened an issue in the repo, but need answers pretty soon..
Hoped to find anyone with C experience here who may solve my problem.
Requirements named in the repo are fulfilled.
(I am on Ubuntu) I am trying to run the PortAudio examples, but getting many errors (mentioned below). I have placed the header file portaudio.h in the directory of the program. I have no idea about it. I think it is linker error. Please help!
/tmp/cc5EbTlT.o: In function main':
paex_record.c:(.text+0x37e): undefined reference toPa_Initialize'
paex_record.c:(.text+0x397): undefined reference to Pa_GetDefaultInputDevice'
paex_record.c:(.text+0x3de): undefined reference toPa_GetDeviceInfo'
paex_record.c:(.text+0x436): undefined reference to Pa_OpenStream'
paex_record.c:(.text+0x45a): undefined reference toPa_StartStream'
paex_record.c:(.text+0x493): undefined reference to Pa_Sleep'
paex_record.c:(.text+0x4c2): undefined reference toPa_IsStreamActive'
paex_record.c:(.text+0x4eb): undefined reference to Pa_CloseStream'
paex_record.c:(.text+0x5fa): undefined reference toPa_GetDefaultOutputDevice'
paex_record.c:(.text+0x641): undefined reference to Pa_GetDeviceInfo'
paex_record.c:(.text+0x6b2): undefined reference toPa_OpenStream'
paex_record.c:(.text+0x6e3): undefined reference to Pa_StartStream'
paex_record.c:(.text+0x71c): undefined reference toPa_Sleep'
paex_record.c:(.text+0x728): undefined reference to Pa_IsStreamActive'
paex_record.c:(.text+0x74e): undefined reference toPa_CloseStream'
paex_record.c:(.text+0x77d): undefined reference to Pa_Terminate'
paex_record.c:(.text+0x7e5): undefined reference toPa_GetErrorText'
collect2: error: ld returned 1 exit status
Assuming you are compiling using gcc and you have a single C file foo.c, the compiler command would be
gcc -o foo foo.c -lrt -lasound -ljack -lpthread -lportaudio
The -l parameters are there to link the required libraries to your program, e.g. -lrt will link librt.a. The order does matter.
I got the required libraries from here: http://www.portaudio.com/docs/v19-doxydocs/compile_linux.html#comp_linux3. Don't know if they are correct. At least you need -lportaudio, obviously.
If the libraries are not found, you have to provide gcc a path, e.g.
gcc -L/usr/lib -o foo foo.c -lrt -lasound -ljack -lpthread -lportaudio
Regarding the header, you don't actually need to copy it into your program's directory. You'd rather include it as
#include <portaudio.h>
and add its directory to the include search path:
gcc -I/usr/include -L/usr/lib -o foo foo.c -lrt -lasound -ljack -lpthread -lportaudio
Of course, all this is better done in a Makefile.
i experience the undefined reference to `dlopen' problems since I have upgraded to ubuntu 13.10 and gcc 4.8.1.
The makefiles are working for years already. the particular call is
gcc -rdynamic -o ov_dbutil ov_dbutil.o libov.so -ldl
The errors are:
libov.so: undefined reference to `dlopen'
libov.so: undefined reference to `dlclose'
libov.so: undefined reference to `dlerror'
libov.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make: *** [ov_dbutil] Error 1
is it a gcc problem?
ov_dbutil is compiled with the following lines
gcc -g -Wall -O0 -shared -std=c99 -fno-strict-aliasing -DPLT_SYSTEM_LINUX=1 -DPLT_USE_BUFFERED_STREAMS=1 -DPLT_SERVER_TRUNC_ONLY=1 -DNDEBUG -DOV_SYSTEM_LINUX=1 -I../../../plt/include/ -I../../../ks/include/ -I../../include/ -I../../model/ -I../../source/codegen/ -I../../source/builder/ -I../../source/example/ -I../../source/kshist/ -I../../source/dynov/ -I../../source/tasklib/ -I../../source/dbparse/ -I../../source/dbdump/ -I../../../../libml/ -I../../include/runtimeserver/ -I. -c ../../source/dbutil/ov_dbutil.c -o ov_dbutil.o
no errors or warnings
Add -Wl,--no-as-needed as linker arguments.
My issue was solved by adding -ldl in the lining line of the .so you want to link agains, it was called libov.so in the upper example.
How to correct following error when I compiled test code written in C using credis API:
gcc -g -Wall -lcredis test_redis.c -o redisOUT
/tmp/ccetckOb.o: In function `main':
/home/faris/Downloads/credis-0.2.3/test_redis.c:12: undefined reference to `credis_connect'
/home/faris/Downloads/credis-0.2.3/test_redis.c:15: undefined reference to `credis_ping'
/home/faris/Downloads/credis-0.2.3/test_redis.c:18: undefined reference to `credis_set'
/home/faris/Downloads/credis-0.2.3/test_redis.c:21: undefined reference to `credis_get'
/home/faris/Downloads/credis-0.2.3/test_redis.c:25: undefined reference to `credis_close'
collect2: error: ld returned 1 exit status
Example on: http://code.google.com/p/credis/wiki/Examples
I'm busting my head for so long.
Thanks for solution.
Sam Iverish
Put the library after the source file that references it:
gcc -g -Wall test_redis.c -lcredis -o redisOUT