Bug 220865 - databases/mysql57*: Fails to link: cannot find -lmysqld. Cannot upgrade to 5.7.19
Summary: databases/mysql57*: Fails to link: cannot find -lmysqld. Cannot upgrade to 5....
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: Mahdi Mokhtari
URL: https://reviews.freebsd.org/D11667
Keywords:
: 220918 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-07-19 20:37 UTC by Vladimir Omelchuk
Modified: 2018-01-12 17:55 UTC (History)
4 users (show)

See Also:
mmokhi: merge-quarterly+


Attachments
Full log (245.07 KB, text/x-log)
2017-07-19 20:37 UTC, Vladimir Omelchuk
no flags Details
poudriere log (571.93 KB, text/x-log)
2017-07-19 23:13 UTC, Vladimir Omelchuk
no flags Details
make log (244.49 KB, text/x-log)
2017-07-19 23:14 UTC, Vladimir Omelchuk
no flags Details
Patch to fix SASL link error and add option (2.60 KB, patch)
2017-07-20 14:29 UTC, Mahdi Mokhtari
mmokhi: maintainer-approval+
Details | Diff
Better patch to fix sasl with mysql57 (3.69 KB, patch)
2017-07-20 23:28 UTC, Mahdi Mokhtari
mmokhi: maintainer-approval+
Details | Diff
Newer patch that fixes problem (10.50 KB, patch)
2017-07-22 13:35 UTC, Mahdi Mokhtari
mmokhi: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Omelchuk 2017-07-19 20:37:51 UTC
Created attachment 184515 [details]
Full log

Part of log:
[…]
[ 58%] Linking CXX shared module authentication_ldap_sasl_client.so
cd /usr/ports/databases/mysql57-client/work/.build/libmysql/authentication_ldap && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/authentication_ldap_sasl_client.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -O2 -pipe -march=core2 -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter -Wno-null-conversion -Wno-unused-private-field -O2 -pipe -march=core2 -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -DDBUG_OFF -fPIC    -Wl,-rpath,/usr/local/lib -fstack-protector -shared  -o authentication_ldap_sasl_client.so CMakeFiles/authentication_ldap_sasl_client.dir/auth_ldap_sasl_client.cc.o CMakeFiles/authentication_ldap_sasl_client.dir/log_client.cc.o -pthread ../../libservices/libmysqlservices.a -lmysqld -lsasl2 -lsasl2 -pthread 
/usr/bin/ld: cannot find -lmysqld
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1
[…]

# pkg version -v | grep mysql57
mysql57-client-5.7.18              <   needs updating (index has 5.7.19)
mysql57-server-5.7.18              <   needs updating (index has 5.7.19)

<uname>
FreeBSD 11.1-RC3 amd64

<make.conf>
DISABLE_VULNERABILITIES=YES
CPUTYPE?=core2
OPTIONS_SET=CUPS
WITHOUT_LPR=YES
DEFAULT_VERSIONS+= apache=2.4
QT4_OPTIONS=CUPS NAS QGTKSTYLE
LOCALIZED_LANG=ru
MAKE_JOBS_UNSAFE=yes
DEFAULT_VERSIONS+= mysql=5.7
.if ${.CURDIR:M*/ports/devel/ccache}
NO_CCACHE=yes
.endif
DEFAULT_VERSIONS+= ssl=openssl
.if ${.CURDIR:M*/emulators/linux-c6}
OPTIONS_SET=NVIDIA_GL
.endif
.if ${.CURDIR:M*/graphics/linux-c6-glx-utils}
OPTIONS_SET=NVIDIA_GL
.endif
.if ${.CURDIR:M*/x11-toolkits/linux-c6-qt47-x11}
OPTIONS_SET=NVIDIA_GL
.endif
DEFAULT_VERSIONS+= pgsql=9.6
Comment 1 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-07-19 21:41:39 UTC
Hi.
Could you please test it (building mysql57-client) with other tools [like poudriere].
I was unable to reproduce the problem.
Tested on all FreeBSD 10, 11 and 12...
Comment 2 Vladimir Omelchuk 2017-07-19 23:13:18 UTC
Created attachment 184522 [details]
poudriere log
Comment 3 Vladimir Omelchuk 2017-07-19 23:14:24 UTC
Created attachment 184523 [details]
make log

(In reply to Mahdi Mokhtari from comment #1)

1. With poudriere build without error (log in the attachment)
2. If build in the port — some error  (log in the attachment)
3. The difference in the build parameters:
portupgrade:
-- Looking for include file sasl/sasl.h
-- Looking for include file sasl/sasl.h – found

poudriere:
-- Looking for include file sasl/sasl.h
-- Looking for include file sasl/sasl.h - not found

error:
[ 58%] Linking CXX shared module authentication_ldap_sasl_client.so
Comment 4 mvharding 2017-07-20 00:37:12 UTC
Note - I am running into the exact same issue on a 11.0 box.  I can't update or do an install from source of the 5.7.19 version after removing 5.7.18.  It fails at the same '-lmysqld' line.  I assume that this is because I have one or more ldap/SASL libraries installed that trigger this issue.
Comment 5 Andrey Pevnev 2017-07-20 12:43:56 UTC
Same problem with 11.0 - 
--- libmysql/authentication_ldap/CMakeFiles/authentication_ldap_sasl_client.dir/all ---
/usr/bin/ld: cannot find -lsasl2
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** [libmysql/authentication_ldap/authentication_ldap_sasl_client.so] Error code 1
Comment 6 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-07-20 14:27:06 UTC
I've created a patch and tested it.
Now it's on review.
Comment 7 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-07-20 14:29:31 UTC
Created attachment 184548 [details]
Patch to fix SASL link error and add option

This is the patch, in case you want to test it too.
Comment 8 Vladimir Omelchuk 2017-07-20 15:01:29 UTC
(In reply to Mahdi Mokhtari from comment #7)

With SASLCLIENT=on – “mysql57-client” build without error,
but if SASLCLIENT=off – still error ...

[…]
[ 58%] Linking CXX shared module authentication_ldap_sasl_client.so
cd /usr/ports/databases/mysql57-client/work/.build/libmysql/authentication_ldap && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/authentication_ldap_sasl_client.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -O2 -pipe -march=core2 -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter -Wno-null-conversion -Wno-unused-private-field -O2 -pipe -march=core2 -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -DDBUG_OFF -L%%FREEBSD_LOCAL_LIB%%    -Wl,-rpath,/usr/local/lib -fstack-protector -shared  -o authentication_ldap_sasl_client.so CMakeFiles/authentication_ldap_sasl_client.dir/auth_ldap_sasl_client.cc.o CMakeFiles/authentication_ldap_sasl_client.dir/log_client.cc.o -pthread ../../libservices/libmysqlservices.a -lsasl2 -pthread 
/usr/bin/ld: cannot find -lsasl2
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Is it correct?
Comment 9 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-07-20 23:28:18 UTC
Created attachment 184559 [details]
Better patch to fix sasl with mysql57

You're right. Thanks :)
The better patch is attached.
As I tested, it works on both select/deselect cases on all 10, 11 and 12-CURRENT.
Comment 10 Vladimir Omelchuk 2017-07-21 05:59:09 UTC
(In reply to Mahdi Mokhtari from comment #9)

1. For “mysql57-client” patch work is fine.
2. For “mysql57-server” - still problem:

[ 84%] Linking CXX shared module authentication_ldap_sasl_client.so
cd /usr/ports/databases/mysql57-server/work/.build/libmysql/authentication_ldap && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/authentication_ldap_sasl_client.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -O2 -pipe -march=core2 -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter -Wno-null-conversion -Wno-unused-private-field -O2 -pipe -march=core2 -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -DDBUG_OFF -fPIC    -Wl,-rpath,/usr/local/lib -fstack-protector -shared  -o authentication_ldap_sasl_client.so CMakeFiles/authentication_ldap_sasl_client.dir/auth_ldap_sasl_client.cc.o CMakeFiles/authentication_ldap_sasl_client.dir/log_client.cc.o -pthread ../../libservices/libmysqlservices.a -lsasl2 -lsasl2 -pthread -lrt 
/usr/bin/ld: cannot find -lsasl2
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1
Comment 11 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-07-22 09:52:55 UTC
*** Bug 220918 has been marked as a duplicate of this bug. ***
Comment 12 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-07-22 13:35:15 UTC
Created attachment 184596 [details]
Newer patch that fixes problem

This patch should also fix the case you encountered with mysql-server
Comment 13 Vladimir Omelchuk 2017-07-22 15:19:17 UTC
(In reply to Mahdi Mokhtari from comment #12)

Now patch work is fine and you can committed to the ports tree. Thanks!
PR can be closed.
Comment 14 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-07-22 16:56:46 UTC
(In reply to Vladimir Omelchuk from comment #13)
Great!
Thanks for testing it :-)
Comment 15 commit-hook freebsd_committer freebsd_triage 2017-07-23 16:45:30 UTC
A commit references this bug:

Author: mmokhi
Date: Sun Jul 23 16:45:08 UTC 2017
New revision: 446496
URL: https://svnweb.freebsd.org/changeset/ports/446496

Log:
  databases/mysql57-{server client}: Fix broken SASL/LDAP integration on newest 5.7.19 upgrade
  -Add a SASL/LDAP option for mysql57-client
  -Fix plugin.cmake for "FreeBSD != Linux" case

  For new plugin, MySQL build assumes everything is MacOS or Windows or Linux.
  This breaks upgrades when you have SASL/LDAP client-library installed.
  Because it "Decides" that you "Want" SASL/LDAP support and tries to build it.

  PR:		220865
  Submitted by:	mmokhi
  Reported by:	Vladimir Omelchuk <admin@vladiom.com.ua>
  Reviewed by:	mat, feld (mentors)
  Approved by:	feld (mentor)
  MFH:		2017Q3
  Differential Revision:	https://reviews.freebsd.org/D11667

Changes:
  head/databases/mysql57-client/Makefile
  head/databases/mysql57-client/files/patch-cmake_plugin.cmake
  head/databases/mysql57-client/files/patch-libmysql_authentication__ldap_CMakeLists.txt
  head/databases/mysql57-client/pkg-plist
  head/databases/mysql57-server/Makefile
  head/databases/mysql57-server/files/patch-cmake_plugin.cmake
  head/databases/mysql57-server/files/patch-libmysql_authentication__ldap_CMakeLists.txt
Comment 16 commit-hook freebsd_committer freebsd_triage 2017-07-23 16:53:39 UTC
A commit references this bug:

Author: mmokhi
Date: Sun Jul 23 16:52:45 UTC 2017
New revision: 446497
URL: https://svnweb.freebsd.org/changeset/ports/446497

Log:
  MFH: r446496

  databases/mysql57-{server client}: Fix broken SASL/LDAP integration on newest 5.7.19 upgrade
  -Add a SASL/LDAP option for mysql57-client
  -Fix plugin.cmake for "FreeBSD != Linux" case

  For new plugin, MySQL build assumes everything is MacOS or Windows or Linux.
  This breaks upgrades when you have SASL/LDAP client-library installed.
  Because it "Decides" that you "Want" SASL/LDAP support and tries to build it.

  PR:		220865
  Submitted by:	mmokhi
  Reported by:	Vladimir Omelchuk <admin@vladiom.com.ua>
  Reviewed by:	mat, feld (mentors)
  Approved by:	feld (mentor)
  Differential Revision:	https://reviews.freebsd.org/D11667

  Approved by:	ports-secteam (feld)

Changes:
_U  branches/2017Q3/
  branches/2017Q3/databases/mysql57-client/Makefile
  branches/2017Q3/databases/mysql57-client/files/patch-cmake_plugin.cmake
  branches/2017Q3/databases/mysql57-client/files/patch-libmysql_authentication__ldap_CMakeLists.txt
  branches/2017Q3/databases/mysql57-client/pkg-plist
  branches/2017Q3/databases/mysql57-server/Makefile
  branches/2017Q3/databases/mysql57-server/files/patch-cmake_plugin.cmake
  branches/2017Q3/databases/mysql57-server/files/patch-libmysql_authentication__ldap_CMakeLists.txt
Comment 17 Mahdi Mokhtari freebsd_committer freebsd_triage 2017-07-23 16:55:12 UTC
Committed
and also MFH'd with approval of feld@

Thanks :)
Comment 18 commit-hook freebsd_committer freebsd_triage 2018-01-12 17:53:59 UTC
A commit references this bug:

Author: feld
Date: Fri Jan 12 17:53:31 UTC 2018
New revision: 458861
URL: https://svnweb.freebsd.org/changeset/ports/458861

Log:
  databases/percona57: Fix build with SASL

  If SASL is detected at build time it assumes you want SASL and also
  errors due to assuming we're Linux. This was already patched in our tree
  for MySQL.

  Also enable SASL support by default for the databases/percona57-client.
  This is expected to be the default by upstream now.

  Special thanks to mmokhi for figuring this out for us.

  PR:		220865
  MFH:		2018Q1

Changes:
  head/databases/percona57-client/Makefile
  head/databases/percona57-client/files/patch-cmake_plugin.cmake
  head/databases/percona57-client/files/patch-libmysql_authentication__ldap_CMakeLists.txt
  head/databases/percona57-client/pkg-plist
  head/databases/percona57-pam-for-mysql/pkg-plist
  head/databases/percona57-server/Makefile
  head/databases/percona57-server/files/patch-cmake_plugin.cmake
  head/databases/percona57-server/files/patch-libmysql_authentication__ldap_CMakeLists.txt
  head/databases/percona57-server/pkg-plist
Comment 19 commit-hook freebsd_committer freebsd_triage 2018-01-12 17:55:04 UTC
A commit references this bug:

Author: feld
Date: Fri Jan 12 17:54:15 UTC 2018
New revision: 458862
URL: https://svnweb.freebsd.org/changeset/ports/458862

Log:
  MFH: r458861

  databases/percona57: Fix build with SASL

  If SASL is detected at build time it assumes you want SASL and also
  errors due to assuming we're Linux. This was already patched in our tree
  for MySQL.

  Also enable SASL support by default for the databases/percona57-client.
  This is expected to be the default by upstream now.

  Special thanks to mmokhi for figuring this out for us.

  PR:		220865

Changes:
_U  branches/2018Q1/
  branches/2018Q1/databases/percona57-client/Makefile
  branches/2018Q1/databases/percona57-client/files/patch-cmake_plugin.cmake
  branches/2018Q1/databases/percona57-client/files/patch-libmysql_authentication__ldap_CMakeLists.txt
  branches/2018Q1/databases/percona57-client/pkg-plist
  branches/2018Q1/databases/percona57-pam-for-mysql/pkg-plist
  branches/2018Q1/databases/percona57-server/Makefile
  branches/2018Q1/databases/percona57-server/files/patch-cmake_plugin.cmake
  branches/2018Q1/databases/percona57-server/files/patch-libmysql_authentication__ldap_CMakeLists.txt
  branches/2018Q1/databases/percona57-server/pkg-plist