yeah, It works if places -lintl -lz to the end of the cmd. I think It will work with --start-group/--end-group, but It doesn't . 2018-05-17 15:34 GMT+08:00 Jonathan Wakely <jwakely.gcc@xxxxxxxxx>: > On 17 May 2018 at 07:58, tong chen wrote: >> hi, all: >> >> I'm compiling libelf.so of elfutils with: >> >> cc -std=gnu99 -Wall -Wshadow -Wformat=2 -Wold-style-definition >> -Wstrict-prototypes -Werror -Wunused -Wextra -Wstack-usage=262144 >> -I/home/tom/new_from_st_170401/code/code/julp/build/host/include >> -fgnu89-inline -fbuiltin >> -L/home/tom/new_from_st_170401/code/code/julp/build/host/lib -lintl >> -lz -o libelf.so -shared -o libelf.so >> -Wl,--whole-archive,./libelf/libelf_pic.a,--no-whole-archive,--no-undefined >> -Wl,--version-script,./libelf/libelf.map,--no-undefined >> -Wl,--soname,libelf.so.1,-z,defs,-z,relro >> >> It reports some undefined reference from libelf_pic.a archive. >> But if surround "-lint -lz" with --start-group/--end-group, like this: >> >> -Wl,--start-group -lintl -lz -Wl,--end-group >> >> It still reports undefined symbols. To remove this error, I must >> place "-lint -lz" in the end of the cmd, after libelf_pic.a. >> >> Am I using wrong? lintl and lz archives seem haven't been searched >> repeatedly. > > Have you tried moving -lint -lz to the end of the command? -- ------------- Tom Chen