Bug 273370 - irc/anope: MySQL database support not working with databases/mariadb106-client
Summary: irc/anope: MySQL database support not working with databases/mariadb106-client
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-26 21:41 UTC by Fabian Wenk
Modified: 2023-08-30 21:06 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Wenk 2023-08-26 21:41:54 UTC
I have configured the port with:
[x] MYSQL    MySQL database support

I am running on FreeBSD 12.4 and with mariadb106-client-10.6.14 installed.

On startup anope reports this in the current /usr/local/anope/logs/services.log.*:
[Aug 26 21:20:59 2023] lib/modules/m_mysql.so: Undefined symbol "mysql_init"

Relevant steps and output of a test build:

# cd /usr/ports/irc/anope/
# make
[...]
===>  Applying FreeBSD patches for anope-2.0.14 from /usr/ports/irc/anope/files
/bin/ln -s /usr/ports/irc/anope/work/anope-2.0.14/modules/extra/m_mysql.cpp /usr/ports/irc/anope/work/anope-2.0.14/modules/
[...]
===>   anope-2.0.14 depends on shared library: libpcre.so - found (/usr/local/lib/libpcre.so)
===>   anope-2.0.14 depends on shared library: libmariadb.so.3 - found (/usr/local/lib/mysql/libmariadb.so.3)
===>   anope-2.0.14 depends on shared library: libintl.so - found (/usr/local/lib/libintl.so)
(/usr/local/lib/mysql/libmariadb.so.3)
[...]
[ 76% 311/402] /usr/bin/c++ -Dm_mysql_so_EXPORTS -I/usr/ports/irc/anope/work/.build/include -I/usr/ports/irc/anope/work/anope-2.0.14/include -I/usr/ports/irc/anope/work/.build/language -I/usr/ports/irc/anope/work/anope-2.0.14/modules/pseudoclients -I/usr/ports/irc/anope/work/anope-2.0.14/modules -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fPIC  -isystem /usr/local/include -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fPIC  -isystem /usr/local/include  -DNDEBUG -fPIC -Wall -Wshadow -ansi -pedantic -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fPIC  -isystem /usr/local/include -pipe -MD -MT modules/CMakeFiles/m_mysql.so.dir/m_mysql.o -MF modules/CMakeFiles/m_mysql.so.dir/m_mysql.o.d -o modules/CMakeFiles/m_mysql.so.dir/m_mysql.o -c /usr/ports/irc/anope/work/anope-2.0.14/modules/m_mysql.cpp
[ 76% 312/402] : && /usr/bin/c++ -fPIC -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fPIC  -isystem /usr/local/include -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fPIC  -isystem /usr/local/include  -DNDEBUG  -Wl,-rpath,/usr/local/lib -fstack-protector-strong -L/usr/local/lib  -pthread -shared  -o modules/m_mysql.so modules/CMakeFiles/m_mysql.so.dir/m_mysql.o   && :
[...]
-- Installing: /usr/ports/irc/anope/work/stage/usr/local/anope/lib/modules/m_mysql.so
[...]
# ldd /usr/ports/irc/anope/work/stage/usr/local/anope/lib/modules/m_mysql.so
/usr/ports/irc/anope/work/stage/usr/local/anope/lib/modules/m_mysql.so:
	libc++.so.1 => /usr/lib/libc++.so.1 (0x8006a7000)
	libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x80077e000)
	libm.so.5 => /lib/libm.so.5 (0x8007a0000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x8007d7000)
	libthr.so.3 => /lib/libthr.so.3 (0x800e00000)
	libc.so.7 => /lib/libc.so.7 (0x80024e000)

Any idea where this fails in the build process?
Comment 1 Fabian Wenk 2023-08-27 13:30:48 UTC
As Sadie recommended the patch irc/anope/files/patch-modules_extra_m__mysql.cpp does prevent anope from building with mysql, I have removed it and tried to build again, which now gives a build error:

riddler:/usr/ports/irc/anope/ # rm files/patch-modules_extra_m__mysql.cpp 
riddler:/usr/ports/irc/anope/ # make      
[...]
===>  Applying FreeBSD patches for anope-2.0.14 from /usr/ports/irc/anope/files
/bin/ln -s /usr/ports/irc/anope/work/anope-2.0.14/modules/extra/m_mysql.cpp /usr/ports/irc/anope/work/anope-2.0.14/modules/
/bin/ln -s /usr/ports/irc/anope/work/anope-2.0.14/modules/extra/m_sql_authentication.cpp /usr/ports/irc/anope/work/anope-2.0.14/modules/
[...]
===>   anope-2.0.14 depends on shared library: libpcre.so - found (/usr/local/lib/libpcre.so)
===>   anope-2.0.14 depends on shared library: libmariadb.so.3 - found (/usr/local/lib/mysql/libmariadb.so.3)
===>   anope-2.0.14 depends on shared library: libintl.so - found (/usr/local/lib/libintl.so)
[...]
-- Looking for kqueue
-- Looking for kqueue - found
CMake Error at cmake/Anope.cmake:477 (message):
  /usr/ports/irc/anope/work/anope-2.0.14/modules/m_mysql.cpp needs library
  mysqlclient but we were unable to locate that library! Check that the
  library is within the search path of your OS.
Call Stack (most recent call first):
  modules/CMakeLists.txt:74 (calculate_libraries)
  modules/CMakeLists.txt:203 (build_modules)


-- Configuring incomplete, errors occurred!
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/irc/anope
*** Error code 1

Stop.
make: stopped in /usr/ports/irc/anope


I also have added this to upstream, see:
https://github.com/anope/anope/issues/319#issuecomment-1694668291
Comment 2 Rafael Grether 2023-08-27 16:23:47 UTC
Thanks Fabian,
I will look into this tomorrow.
Comment 3 Fabian Wenk 2023-08-29 13:23:01 UTC
(In reply to Rafael Grether from comment #2)

Maybe this could be helpful for you. Related to the missing mysqlclient.pc (reported in the upstream ticket), I found out that I also had build problems with ftp/axel not building with OpenSSL, based on bug #266051 it helped to just do:
touch /usr/libdata/pkgconfig/openssl.pc

So I tried this cheap trick as well with:
touch /usr/libdata/pkgconfig/mysqlclient.pc

But with the still removed irc/anope/files/patch-modules_extra_m__mysql.cpp the build fails with the same error.

Please remember my systems are still on FreeBSD 12.4.
Comment 4 Rafael Grether 2023-08-30 21:06:33 UTC
Thanks, Fabian.

But nothing related to mysqlclient.pc.

I was able to simulate this problem in current. And I managed to solve it, but I don't know if it's the best solution. I need to do more tests at runtime execution.