Hi Aki, Thanks for your response! On Tue, 26 Jan 2021 at 14:11, Aki Tuomi <aki.tuomi@open-xchange.com> wrote:
On 22/01/2021 12:04 Duc Anh Do <doducanh2710@gmail.com> wrote:
Hi all,
I'm building Dovecot from source of Dovecot 2.3.13. When doing make check, I saw an error: make[1]: Entering directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream' for bin in test-iostream-ssl; do \ if ! /bin/sh ../../run-test.sh ../.. ./$bin; then exit 1; fi; \ done collect2: error: ld returned 213 exit status Failed to run: ./test-iostream-ssl
This is my configuration in spec file: %configure \ INSTALL_DATA="install -c -p -m644" \ --docdir=%{_docdir}/%{name} \ --disable-static \ --disable-rpath \ --with-nss \ --with-shadow \ --with-pam \ --with-gssapi=plugin \ --with-ldap=plugin \ --with-sql=plugin \ --with-pgsql \ --with-mysql \ --with-sqlite \ --with-zlib \ --with-libcap \ --with-ssl=openssl \ --with-ssldir=%{ssldir} \ --with-docs
I installed OpenSSL and Valgrind: # yum list installed | egrep "valgrind|openssl" openssl-devel.x86_64 1:1.1.1g-12.el8_3 @BaseOS openssl-libs.x86_64 1:1.1.1g-12.el8_3 @BaseOS valgrind.x86_64 1:3.16.0-2.el8 @AppStream valgrind-devel.x86_64 1:3.16.0-2.el8 @AppStream
I investigated the problem and found something: * Unlike other lib-xxx, libtool doesn't generate executable binary test-iostream-ssl inside lib-ssl-iostream directory. That's a shell script and actual executable binary is inside ./libs directory ( https://www.gnu.org/software/libtool/manual/libtool.html#Linking-executables ): $ pwd /home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream $ file test-iostream-ssl test-iostream-ssl: POSIX shell script, ASCII text executable, with very long lines $ file .libs/test-iostream-ssl .libs/test-iostream-ssl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=c6a800c253c38a7eb78886286ef779d871550a6c, with debug_info, not stripped, too many notes (256)
That means when running make check, Valgrind will monitor the shell script generated by libtool instead of the actual test code. And error occurs. * To confirm, I changed Makefile a bit: $ pwd /home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream $ vim Makefile check-local: for bin in $(test_programs); do \ export LD_LIBRARY_PATH=./.libs; \ if ! $(RUN_TEST) ./.libs/$$bin; then exit 1; fi; \ done
Then do make check: $ cd ~/rpmbuild/BUILD/xxx/dovecot-2.3.13 $ make -C src/lib-ssl-iostream/ clean $ make -C src/lib-ssl-iostream/ check make[1]: Entering directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream' for bin in test-iostream-ssl; do \ export LD_LIBRARY_PATH=./.libs; \ if ! /bin/sh -x ../../run-test.sh ../.. ./.libs/$bin; then exit 1; fi; \ #if ! /bin/sh -x ../../run-test.sh ../.. ./$bin; then exit 1; fi; \ done ssl: handshake ....................................................... : ok ssl: o_stream_get_buffer_avail_size .................................. : ok ssl: small packets ................................................... : ok 0 / 3 tests failed + ret=0 + test -s test.out~19257 + test 0 '!=' 0 + exit 0 + rm -f test.out~19257 make[1]: Leaving directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream' make: Leaving directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream' * According to the manual of libtool, if I use libtool to generate library and executable binary, I should use libtool to execute (or debug or anything else). That will avoid misconfiguration and unexpected errors: * https://www.gnu.org/software/libtool/manual/html_node/Debugging-executables.... * https://stackoverflow.com/a/14186488 My patch looks like this: diff --git a/src/lib-ssl-iostream/Makefile.am b/src/lib-ssl-iostream/Makefile.am index 5aaea5d..17ebf1d 100644 --- a/src/lib-ssl-iostream/Makefile.am +++ b/src/lib-ssl-iostream/Makefile.am @@ -56,6 +56,6 @@ noinst_PROGRAMS = $(test_programs)
check-local: for bin in $(test_programs); do \ - if ! $(RUN_TEST) ./$$bin; then exit 1; fi; \ + if ! $(LIBTOOL) --mode execute $(RUN_TEST) ./$$bin; then exit 1; fi; \ done endif
Result: make[2]: Entering directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream' make check-local make[3]: Entering directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream' for bin in test-iostream-ssl; do \ if ! /bin/sh ../../libtool --mode execute /bin/sh ../../run-test.sh ../.. ./$bin; then exit 1; fi; \ done ssl: handshake ....................................................... : ok ssl: o_stream_get_buffer_avail_size .................................. : ok ssl: small packets ................................................... : ok 0 / 3 tests failed make[3]: Leaving directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream' make[2]: Leaving directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream'
Can anyone help to correct my understanding and my patch?
Thanks, Anh Do
I think better fix is to change run-test.sh to use libtool instead. I'll submit patch.
Aki
-- Thanks, Duc Anh ---------------------------------------------------------------------------------------------------- Email: doducanh2710@gmail.com Skype: ducanh.do88 Mobile: +84975730526