Bug 230813 - ftp/lftp: 4.8.4 fails to build
Summary: ftp/lftp: 4.8.4 fails to build
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Ganael LAPLANCHE
Depends on:
Reported: 2018-08-22 08:07 UTC by Pascal Christen
Modified: 2018-08-27 11:09 UTC (History)
6 users (show)

See Also:
bugzilla: maintainer-feedback? (martymac)

lftp build output (1.06 KB, text/plain)
2018-08-22 08:07 UTC, Pascal Christen
no flags Details
Add missing -pthread (387 bytes, patch)
2018-08-23 10:16 UTC, Ganael LAPLANCHE
no flags Details | Diff
Add missing -pthread (take 2) (415 bytes, patch)
2018-08-23 21:24 UTC, Ganael LAPLANCHE
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Christen 2018-08-22 08:07:35 UTC
Created attachment 196438 [details]
lftp build output


After Update to 4.8.4,  lftp failed to build with freebsd10.4 &6 11.2
Comment 1 Ganael LAPLANCHE freebsd_committer 2018-08-23 10:16:38 UTC
Created attachment 196470 [details]
Add missing -pthread
Comment 2 Ganael LAPLANCHE freebsd_committer 2018-08-23 10:17:37 UTC
Hi Pascal,

Thanks for your report. I think your are trying to build lftp with GnuTLS (it builds fine with OpenSSL). Can you try the attached patch and tell me if it fixes your problem ?

Best regards,

Comment 3 Pascal Christen 2018-08-23 10:31:08 UTC
(In reply to Ganael LAPLANCHE from comment #2)


No, I'm building with openssl (openssl-1.0.2p) too:

---Begin OPTIONS List---
===> The following configuration options are available for lftp-4.8.4:
     DOCS=on: Build and/or install documentation
     NLS=on: Native Language Support
====> SSL protocol support: you can only select none or one of them
     OPENSSL=on: SSL/TLS support via OpenSSL
     GNUTLS=off: SSL/TLS support via GnuTLS
===> Use 'make config' to modify these settings
---End OPTIONS List---


--enable-nls --with-openssl --without-gnutls --prefix=/usr/local ${_LATE_CONFIGURE_ARGS}
Comment 4 Kamigishi Rei 2018-08-23 12:54:36 UTC
I can confirm that lftp builds with OpenSSL fail due to missing pthread.
Poudriere log: https://poudriere.koumakan.jp/data/11amd64-default/2018-08-23_21h39m03s/logs/errors/lftp-4.8.4.log
Comment 5 Ganael LAPLANCHE freebsd_committer 2018-08-23 21:24:54 UTC
Created attachment 196485 [details]
Add missing -pthread (take 2)
Comment 6 Ganael LAPLANCHE freebsd_committer 2018-08-23 21:30:59 UTC
Hi Kamigishi, Pascal,

OK, you are using OpenSSL from *ports* while I was testing the build against OpenSSL from *base*.

I can now reproduce the problem when using OpenSSL from ports (with 'DEFAULT_VERSIONS+= ssl=openssl' set in make.conf).

Adding -pthread fixes the problem too.

Can you try the more generic patch attached ? It now adds the missing -pthead flag unconditionally.
Comment 7 Kamigishi Rei 2018-08-23 21:39:44 UTC
It builds fine for me with OpenSSL from ports. I wonder if there is a way to properly tell if OpenSSL was built with multi-threading enabled, since it is likely wrong to link libthr if it is not.
Comment 8 Kamigishi Rei 2018-08-23 21:45:39 UTC
Seems “openssl version -f” will have -pthread for ports-built OpenSSL. The problem is that we would have to test for /usr/local/bin/openssl first, because base has PATH priority.

Base OpenSSL's version -f shows just “clang”.

The other, likely safer, option is to check “ldd /path/to/openssl” output for libthr.so.
Comment 9 Simeon Simeonov 2018-08-24 06:41:48 UTC
Note: The build fails also when DEFAULT_VERSIONS+= ssl=libressl
Comment 10 Pascal Christen 2018-08-24 07:07:44 UTC
(In reply to Ganael LAPLANCHE from comment #6)

> Can you try the more generic patch attached ? It now adds the missing -pthead flag unconditionally.

This one works for me
Comment 11 Ganael LAPLANCHE freebsd_committer 2018-08-24 10:15:29 UTC

Thanks for your reports.

I'll be working on a new version of the patch, stay tuned (ENOTIME right now, probably at the beginning of next week).

Best regards,

Comment 12 Peter Putzer 2018-08-25 08:35:46 UTC
(In reply to Ganael LAPLANCHE from comment #6)

It also fails with libressl from ports.
Comment 13 Walter Schwarzenfeld freebsd_triage 2018-08-25 09:36:16 UTC
Libressl could be solved by adding:

Comment 14 commit-hook freebsd_committer 2018-08-27 10:16:22 UTC
A commit references this bug:

Author: martymac
Date: Mon Aug 27 10:16:03 UTC 2018
New revision: 478188
URL: https://svnweb.freebsd.org/changeset/ports/478188

  Fix build when selected SSL library is linked to libthr

  When a non-default SSL library is used (GnuTLS, OpenSSL or LibreSSL from
  ports) and if it is linked to libthr, compilation fails with the following
  error :

  /usr/bin/ld: undefined reference to symbol `pthread_mutexattr_gettype@@FBSD_1.0' (try adding -lthr)
  //lib/libthr.so.3: could not read symbols: Bad value

  As OpenSSL-like ports (OpenSSL from base, OpenSSL and OpenSSL-devel from ports,
  LibreSSL and LibreSSL-devel from ports) may or may not be linked to libthr, fix
  build by detecting if the selected library is linked to libthr or not.

  PR:		230813
  Submitted by:	Pascal Christen <pascal.christen@hostpoint.ch>

Comment 15 Ganael LAPLANCHE freebsd_committer 2018-08-27 11:09:41 UTC
Should be fixed right now. Thanks for your report!