Jan Palus wrote: > The error was spotted when building lftp on Linux which uses > -Wl,--whole-archive that appears to trigger the behavior. > > I was able to reproduce it with just gnulib: > > cd gnulib > ./gnulib-tool --create-testdir --dir=build crypto/md5 > cd build > ./configure --with-openssl=yes > make > cd gltests > > GNU ld: > > $ gcc -fuse-ld=bfd -o test-md5-buffer test-md5-buffer.o -Wl,--whole-archive > ../gllib/libgnu.a -Wl,-no-whole-archive -lcrypto > /usr/bin/ld.bfd: ../gllib/libgnu.a(md5.o): in function `md5_init_ctx': > /.../gnulib/build/gllib/md5.c:81: multiple definition of `md5_init_ctx'; > ../gllib/libgnu.a(md5-stream.o):/.../gnulib/build/gllib/md5-stream.c:81: > first defined here
Thanks; this simple reproducer makes it clear what the problem is: Without OpenSSL, the symbols defined in each .o file are: $ nm md5.o | grep ' T ' 000001f4 T md5_buffer 000000e9 T md5_finish_ctx 00000000 T md5_init_ctx 00000452 T md5_process_block 0000027d T md5_process_bytes 00000077 T md5_read_ctx $ nm md5-stream.o | grep ' T ' 00000014 T md5_stream With OpenSSL, the symbols defined are: $ nm md5.o | grep ' T ' 00000000000000b0 T md5_buffer 0000000000000083 T md5_finish_ctx 0000000000000000 T md5_init_ctx 0000000000000051 T md5_process_block 000000000000001f T md5_process_bytes 00000000000000e1 T md5_read_ctx $ nm md5-stream.o | grep ' T ' 00000000000000b0 T md5_buffer 0000000000000083 T md5_finish_ctx 0000000000000000 T md5_init_ctx 0000000000000051 T md5_process_block 000000000000001f T md5_process_bytes 00000000000000e1 T md5_read_ctx 00000000000001c4 T md5_stream So, what needs to be done is to remove the first 6 symbols from md5-stream.o. Your patch does that. I have applied it. Thanks! Bruno