-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
root@hadoop-kae:/opt/KAE_repos/hth/kaezip2/test# make
gcc -g -lz -Wall -L/usr/local/kaezip/lib -I /usr/local/kaezip/include/ -o kaezip_perf kaezip_perf.c
kaezip_perf.c: In function ‘do_compress_perf’:
kaezip_perf.c:122:9: warning: unused variable ‘i’ [-Wunused-variable]
int i = 0;
^
kaezip_perf.c: In function ‘do_decompress_perf’:
kaezip_perf.c:147:12: warning: unused variable ‘j’ [-Wunused-variable]
int i, j;
^
kaezip_perf.c:147:9: warning: unused variable ‘i’ [-Wunused-variable]
int i, j;
^
/tmp/ccWTksRC.o: In function `get_decompress_input':
/opt/KAE_repos/hth/kaezip2/test/kaezip_perf.c:46: undefined reference to `compressBound'
/opt/KAE_repos/hth/kaezip2/test/kaezip_perf.c:49: undefined reference to `compress2'
/tmp/ccWTksRC.o: In function `do_multi_perf':
/opt/KAE_repos/hth/kaezip2/test/kaezip_perf.c:79: undefined reference to `compressBound'
/opt/KAE_repos/hth/kaezip2/test/kaezip_perf.c:80: undefined reference to `compress2'
/opt/KAE_repos/hth/kaezip2/test/kaezip_perf.c:86: undefined reference to `uncompress'
/tmp/ccWTksRC.o: In function `do_compress_perf':
/opt/KAE_repos/hth/kaezip2/test/kaezip_perf.c:128: undefined reference to `compressBound'
collect2: error: ld returned 1 exit status
makefile:14: recipe for target 'kaezip_perf' failed
make: *** [kaezip_perf] Error 1
root@hadoop-kae:/opt/KAE_repos/hth/kaezip2/test# gcc --version
gcc (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Then I put -lz option after kaezip_perf.c, it works.
According the docs https://gcc.gnu.org/onlinedocs/gcc-7.4.0/gcc/Link-Options.html#Link-Options :
It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, ‘foo.o -lz bar.o’ searches library ‘z’ after file foo.o but before bar.o. If bar.o refers to functions in ‘z’, those functions may not be loaded.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels