Bug 237825 - sysutils/bareos-server: bcopy, bextract, and bscan must be linked to the pthread library
Summary: sysutils/bareos-server: bcopy, bextract, and bscan must be linked to the pthr...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jose Alonso Cardenas Marquez
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2019-05-10 10:19 UTC by Trond Endrestøl
Modified: 2019-05-11 01:56 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Trond Endrestøl 2019-05-10 10:19:33 UTC
bareos-server is configured like this:

===> The following configuration options are available for bareos-server-18.2.6:
     MTX=off: Install mtx for control of autochanger devices
     NDMP=off: Enable build of NDMP support
     NLS=off: Native Language Support
     PYTHON=off: Python bindings or support
     SCSICRYPTO=off: Build LTO AME crypto plugin
====> Cryptographic library: you have to select exactly one of them
     OPENSSL=on: SSL/TLS support via OpenSSL
     GNUTLS=off: SSL/TLS support via GnuTLS
====> Database support: you have to select exactly one of them
     SQLITE3=off: SQLite 3 database support
     MYSQL=off: MySQL database support
     PGSQL=on: PostgreSQL database support
===> Use 'make config' to modify these settings

Which leads to:

[177/190] : && /usr/local/libexec/ccache/c++  -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -Wall -Wno-deprecated-register -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing  -L/usr/local/lib -ljansson -L/usr/local/lib  -L/usr/local/lib -fstack-protector-strong core/src/stored/CMakeFiles/bcopy.dir/bcopy.cc.o  -o core/src/stored/bcopy -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lintl core/src/stored/libbareossd.so -lbareos -lintl && :
FAILED: core/src/stored/bcopy
: && /usr/local/libexec/ccache/c++  -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -Wall -Wno-deprecated-register -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing  -L/usr/local/lib -ljansson -L/usr/local/lib  -L/usr/local/lib -fstack-protector-strong core/src/stored/CMakeFiles/bcopy.dir/bcopy.cc.o  -o core/src/stored/bcopy -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lintl core/src/stored/libbareossd.so -lbareos -lintl && :
ld: error: core/src/stored/libbareossd.so: undefined reference to pthread_create
c++: error: linker command failed with exit code 1 (use -v to see invocation)
[178/190] /usr/local/libexec/ccache/c++  -DVERSION=\"18.2.6\" -D_FILE_OFFSET_BITS=64 -Dpython_sd_EXPORTS -I/usr/local/include -I/usr/local/include/python2.7 -Icore/src -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -Wall -Wno-deprecated-register -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fPIC   -std=gnu++11 -MD -MT core/src/plugins/stored/CMakeFiles/python-sd.dir/python-sd.cc.o -MF core/src/plugins/stored/CMakeFiles/python-sd.dir/python-sd.cc.o.d -o core/src/plugins/stored/CMakeFiles/python-sd.dir/python-sd.cc.o -c core/src/plugins/stored/python-sd.cc
ninja: build stopped: subcommand failed.
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /xports/sysutils/bareos-server
*** Error code 1
Comment 1 Trond Endrestøl 2019-05-10 10:39:05 UTC
This issue was extended to bextract, and bscan.

Augmenting existing sysutils/bareos-server/files/patch-core-src-stored_CMakeLists.txt with the lines below eliminates this issue.

@@ -202,6 +202,7 @@
 add_executable(bextract ${BEXTRACTSRS})
 target_link_libraries(bextract
    bareossd bareosfind bareos
+   ${PTHREAD_LIBRARIES}
     )

 add_executable(bscan ${BSCANSRCS})
@@ -212,6 +213,7 @@
 add_executable(btape ${BTAPESRCS})
 target_link_libraries(btape
    bareossd bareos
+   ${PTHREAD_LIBRARIES}
     )

 add_executable(bcopy ${BCOPYSRCS})
@@ -219,6 +221,7 @@

 target_link_libraries(bcopy
    bareossd bareos
+   ${PTHREAD_LIBRARIES}
     )

 INSTALL(TARGETS bareossd DESTINATION ${libdir})
Comment 2 O. Hartmann 2019-05-10 10:52:38 UTC
Same to me here, a quick and dirty patch is to append "-lpthread" to LDFLAGS+= ...
Comment 3 commit-hook freebsd_committer freebsd_triage 2019-05-10 20:19:59 UTC
A commit references this bug:

Author: acm
Date: Fri May 10 20:19:44 UTC 2019
New revision: 501197
URL: https://svnweb.freebsd.org/changeset/ports/501197

Log:
  - Fix pthread error [1]
  - Fix build when python 2.x is not default version [2]
  - Fix build when NLS option is not selected [3]
  - Fix pkg-plist
  - Few other modifications

  PR:		237818 237823 237825
  Submitted by:	Trond.Endrestol _ at _ ximalas.info [1][3], beldin _ at _ beldin.org [2]
  Reported by:	pkg-fallout

Changes:
  head/sysutils/bareos-server/Makefile
  head/sysutils/bareos-server/files/patch-core-CMakeLists.txt
  head/sysutils/bareos-server/files/patch-core-cmake_BareosFindAllLibraries.cmake
  head/sysutils/bareos-server/files/patch-core-cmake_BareosSetVariableDefaults.cmake
  head/sysutils/bareos-server/files/patch-core-src-include_baconfig.h
  head/sysutils/bareos-server/files/patch-core-src-plugins-filed_CMakeLists.txt
  head/sysutils/bareos-server/files/patch-core-src-stored_CMakeLists.txt
  head/sysutils/bareos-server/pkg-plist