<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Hi Aki,</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Thanks for your response!<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 26 Jan 2021 at 14:11, Aki Tuomi <<a href="mailto:aki.tuomi@open-xchange.com">aki.tuomi@open-xchange.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
> On 22/01/2021 12:04 Duc Anh Do <<a href="mailto:doducanh2710@gmail.com" target="_blank">doducanh2710@gmail.com</a>> wrote:<br>
> <br>
> <br>
> Hi all,<br>
> <br>
> I'm building Dovecot from source of Dovecot 2.3.13. When doing make check, I saw an error:<br>
> make[1]: Entering directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream'<br>
> for bin in test-iostream-ssl; do \<br>
>  if ! /bin/sh ../../run-test.sh ../.. ./$bin; then exit 1; fi; \<br>
> done<br>
> collect2: error: ld returned 213 exit status<br>
> Failed to run: ./test-iostream-ssl<br>
> <br>
> This is my configuration in spec file:<br>
> %configure \<br>
>  INSTALL_DATA="install -c -p -m644" \<br>
>  --docdir=%{_docdir}/%{name} \<br>
>  --disable-static \<br>
>  --disable-rpath \<br>
>  --with-nss \<br>
>  --with-shadow \<br>
>  --with-pam \<br>
>  --with-gssapi=plugin \<br>
>  --with-ldap=plugin \<br>
>  --with-sql=plugin \<br>
>  --with-pgsql \<br>
>  --with-mysql \<br>
>  --with-sqlite \<br>
>  --with-zlib \<br>
>  --with-libcap \<br>
>  --with-ssl=openssl \<br>
>  --with-ssldir=%{ssldir} \<br>
>  --with-docs<br>
> <br>
> I installed OpenSSL and Valgrind:<br>
> # yum list installed | egrep "valgrind|openssl"<br>
> openssl-devel.x86_64 1:1.1.1g-12.el8_3 @BaseOS<br>
> openssl-libs.x86_64 1:1.1.1g-12.el8_3 @BaseOS<br>
> valgrind.x86_64 1:3.16.0-2.el8 @AppStream<br>
> valgrind-devel.x86_64 1:3.16.0-2.el8 @AppStream<br>
> <br>
> I investigated the problem and found something:<br>
>   * 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 (<a href="https://www.gnu.org/software/libtool/manual/libtool.html#Linking-executables" rel="noreferrer" target="_blank">https://www.gnu.org/software/libtool/manual/libtool.html#Linking-executables</a>):<br>
> $ pwd<br>
> /home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream<br>
> $ file test-iostream-ssl<br>
> test-iostream-ssl: POSIX shell script, ASCII text executable, with very long lines<br>
> $ file .libs/test-iostream-ssl<br>
> .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)<br>
> <br>
> That means when running make check, Valgrind will monitor the shell script generated by libtool instead of the actual test code. And error occurs.<br>
>   * To confirm, I changed Makefile a bit:<br>
> $ pwd<br>
> /home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream<br>
> $ vim Makefile<br>
> check-local:<br>
> for bin in $(test_programs); do \<br>
> export LD_LIBRARY_PATH=./.libs; \<br>
> if ! $(RUN_TEST) ./.libs/$$bin; then exit 1; fi; \<br>
> done<br>
> <br>
> Then do make check:<br>
> $ cd ~/rpmbuild/BUILD/xxx/dovecot-2.3.13<br>
> $ make -C src/lib-ssl-iostream/ clean<br>
> $ make -C src/lib-ssl-iostream/ check<br>
> make[1]: Entering directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream'<br>
> for bin in test-iostream-ssl; do \<br>
> export LD_LIBRARY_PATH=./.libs; \<br>
> if ! /bin/sh -x ../../run-test.sh ../.. ./.libs/$bin; then exit 1; fi; \<br>
> #if ! /bin/sh -x ../../run-test.sh ../.. ./$bin; then exit 1; fi; \<br>
> done<br>
> ssl: handshake ....................................................... : ok<br>
> ssl: o_stream_get_buffer_avail_size .................................. : ok<br>
> ssl: small packets ................................................... : ok<br>
> 0 / 3 tests failed<br>
> + ret=0<br>
> + test -s test.out~19257<br>
> + test 0 '!=' 0<br>
> + exit 0<br>
> + rm -f test.out~19257<br>
> make[1]: Leaving directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream'<br>
> make: Leaving directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream'<br>
>   * 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:<br>
>     * <a href="https://www.gnu.org/software/libtool/manual/html_node/Debugging-executables.html#Debugging-executables" rel="noreferrer" target="_blank">https://www.gnu.org/software/libtool/manual/html_node/Debugging-executables.html#Debugging-executables</a><br>
>     * <a href="https://stackoverflow.com/a/14186488" rel="noreferrer" target="_blank">https://stackoverflow.com/a/14186488</a><br>
> My patch looks like this:<br>
> diff --git a/src/lib-ssl-iostream/Makefile.am b/src/lib-ssl-iostream/Makefile.am<br>
> index 5aaea5d..17ebf1d 100644<br>
> --- a/src/lib-ssl-iostream/Makefile.am<br>
> +++ b/src/lib-ssl-iostream/Makefile.am<br>
> @@ -56,6 +56,6 @@ noinst_PROGRAMS = $(test_programs)<br>
> <br>
> check-local:<br>
> for bin in $(test_programs); do \<br>
> - if ! $(RUN_TEST) ./$$bin; then exit 1; fi; \<br>
> + if ! $(LIBTOOL) --mode execute $(RUN_TEST) ./$$bin; then exit 1; fi; \<br>
> done<br>
> endif<br>
> <br>
> Result:<br>
> make[2]: Entering directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream'<br>
> make check-local<br>
> make[3]: Entering directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream'<br>
> for bin in test-iostream-ssl; do \<br>
>  if ! /bin/sh ../../libtool --mode execute /bin/sh ../../run-test.sh ../.. ./$bin; then exit 1; fi; \<br>
> done<br>
> ssl: handshake ....................................................... : ok<br>
> ssl: o_stream_get_buffer_avail_size .................................. : ok<br>
> ssl: small packets ................................................... : ok<br>
> 0 / 3 tests failed<br>
> make[3]: Leaving directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream'<br>
> make[2]: Leaving directory '/home/xxx/rpmbuild/BUILD/xxx/dovecot-2.3.13/src/lib-ssl-iostream'<br>
> <br>
> Can anyone help to correct my understanding and my patch?<br>
> <br>
> Thanks,<br>
> Anh Do<br>
><br>
<br>
I think better fix is to change run-test.sh to use libtool instead. I'll submit patch.<br>
<br>
Aki<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Thanks,<br>Duc Anh<br>----------------------------------------------------------------------------------------------------<br>Email: <a href="mailto:doducanh2710@gmail.com" target="_blank">doducanh2710@gmail.com</a><br>Skype: ducanh.do88<br></div>Mobile: +84975730526<br></div></div>