RejectedSoftware Forums

Sign up

Problem linking mysqlclient when compiling mysql-d

I have a DUB project that uses mysql-d [1]. When DUB tries to build mysql-d, the linker reports an error:

$ dub
Target mysql-d 0.3.1 is up to date. Use --force to rebuild.
Building dataexp ~master configuration "application", build type debug.
Compiling using dmd...
Linking...
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
--- errorlevel 1

The solution would be to compile with -L/usr/lib64/mysql. Is this possible?

I think I have everything properly configured:

$ cat /etc/ld.so.conf
include ld.so.conf.d/*.conf

$ cat /etc/ld.so.conf.d/mariadb-x86_64.conf 
/usr/lib64/mysql

$ ls /usr/lib64/mysql/libmysqlclient.so
/usr/lib64/mysql/libmysqlclient.so

$ ldconfig -v 2>/dev/null | grep mysql
/usr/lib64/mysql:
	libmysqlclient.so.1018 -> libmysqlclient_r.so.1018.1.0
	libmysqlclient.so.18 -> libmysqlclient.so.18.0.0
	libmysqlpp.so.3 -> libmysqlpp.so.3.1.0


Do you have any suggestion for me?

[1] http://code.dlang.org/packages/mysql-d

Re: Problem linking mysqlclient when compiling mysql-d

On Mon, 02 Feb 2015 11:20:52 GMT, Tudor Berariu wrote:

I have a DUB project that uses mysql-d [1]. When DUB tries to build mysql-d, the linker reports an error:

$ dub
Target mysql-d 0.3.1 is up to date. Use --force to rebuild.
Building dataexp ~master configuration "application", build type debug.
Compiling using dmd...
Linking...
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
--- errorlevel 1

The solution would be to compile with -L/usr/lib64/mysql. Is this possible?

The answer is in the documentation [1], adding "lflags": ["-L/usr/lib64/mysql"] in dub.json solved the problem.

[1] http://code.dlang.org/package-format#build-settings