Add options to Configure in formula Dovecot --with-mysql


(James Brown) #1

I’ve used Brew to install Dovecot but it is not authenticating for me because it was not compiled with MySQL support.

I edited /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/dovecot.rb and added ‘–with-mysql’ to the args section. Then ran ‘brew reinstall dovecot’.

But I still get ‘auth: Fatal: Unknown database driver ‘mysql’’

Anything I’m doing wrong?

Thanks, James.


(Sean Molenaar) #2

This seems like a question that’s better of at the dovecot people, as you’re not really using anything of homebrew anymore. https://dovecot.org


(James Brown) #3

Thanks Sean.

Not sure why you say that. I’m installing using brew (re)install dovecot, so I am using homebrew. I am just trying to slightly modify the config the formula that home-brew uses.

I think what I am doing wrong is not using ‘–build-from-source’?

(Sorry, new to Homebrew).


(Sean Molenaar) #4

You’re compiling dovecot and brew isn’t the one throwing an error, dovecot is. In comparison this is a bit like writing apple about a website that you opened on your Mac not delivering the things you ordered.


(Tangerine62) #5

I’m using dovecot
If you build from source instead of pouring the bottle you will solve your troubles with MySQL
Enjoy


(James Brown) #6

Thanks all. I edited brew’s dovecot config file to include ‘–with-mysql’ and then used:

brew install dovecot --build-from-source

and it now works:

Install prefix . : /usr/local/Cellar/dovecot/2.3.2.1
File offsets ... : 64bit
I/O polling .... : kqueue
I/O notifys .... : kqueue
SSL ............ : yes (OpenSSL)
GSSAPI ......... : no
passdbs ........ : static passwd passwd-file pam checkpassword sql
CFLAGS ......... : -std=gnu99 -g -O2 -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -Wno-duplicate-decl-specifier -Wstrict-aliasing=2 
                 : -shadow -bsdauth -sia -ldap -vpopmail
userdbs ........ : static prefetch passwd passwd-file checkpassword sql
                 : -ldap -vpopmail
SQL drivers .... : mysql sqlite
                 : -pgsql -cassandra
Full text search : squat
                 : -lucene -solr

It’s still trying to use pam for authentication, but that’s another discussion!

Thanks again for your help.


(James Brown) #7

Trying on a Mojave-based Mac mini, and this time it is not working. I edited /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/dovecot.rb to finished the ‘args’ section with ‘–with-mysql’. Now when I run:

brew install dovecot --build-from-source

I get:

$ brew install dovecot --build-from-source
==> **Downloading https://dovecot.org/releases/2.3/dovecot-2.3.2.1.tar.gz**
Already downloaded: /Users/jlbrown/Library/Caches/Homebrew/downloads/88cc632b6f7119644e33ae10d0073afca899626297992707dac8c1639068d95f--dovecot-2.3.2.1.tar.gz
==> **./configure --prefix=/usr/local/Cellar/dovecot/2.3.2.1 --libexecdir=/usr/local/Cellar/dovecot/2.3.2.1/libexec --sysconf**
Last 15 lines from /Users/jlbrown/Library/Logs/Homebrew/dovecot/01.configure:
checking for EC_KEY_new in -lssl... yes
checking whether we will be linking in Lua... no
checking for getspnam... no
checking for pam_start in -lpam... yes
checking security/pam_appl.h usability... yes
checking security/pam_appl.h presence... yes
checking for security/pam_appl.h... yes
checking pam/pam_appl.h usability... no
checking pam/pam_appl.h presence... no
checking for pam/pam_appl.h... no
checking for pam_setcred in -lpam... yes
checking for auth_userokay... no
checking for mysql_config... NO
checking for mysql_init in -lmysqlclient... no
configure: error: Can't build with MySQL support: libmysqlclient not found

I even run:

export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib"
export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include"

beforehand and it still didn’t work.

Any suggestions? Thanks.


(Sean Molenaar) #8

Those variables need to be in the formula, otherwise they’ll be filtered out by homebrew.


(James Brown) #9

Thanks Sean. So just add those two lines (without the ‘export’) into /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/dovecot.rb ?


(Sean Molenaar) #10

You’d have to check other formula. I don’t remember and I’m on my phone right now.


(James Brown) #11

I added:

 ENV['LD']="-L/usr/local/opt/mysql@5.7/lib"
 ENV['CPP']="-I/usr/local/opt/mysql@5.7/include"

to the ‘def install’ section, but it fails with:

checking whether clang understands -c and -o together... (cached) yes
checking dependency style of clang... (cached) none
checking how to run the C preprocessor... -I/usr/local/opt/mysql@5.7/include
configure: error: in `/private/tmp/dovecot-20181115-10034-1eiava3/dovecot-2.3.2.1':
configure: error: C preprocessor "-I/usr/local/opt/mysql@5.7/include" fails sanity check
See `config.log' for more details

(James Brown) #12

I have got it to compile! I commented out the second ‘ENV’ line. So it is just:

ENV['LD']="-L/usr/local/opt/mysql@5.7/lib"


(James Brown) #13

Actually that didn’t work. It compiled OK but when I went to connect to Dovecot, it said it didn’t know what mysql was. I then looked at the formula and my edits were not there.

Adding back ‘–with-mysql’ to the args section and ENV[‘LD’]="-L/usr/local/opt/mysql@5.7/lib" after the ‘]’ didn’t work. ‘brew install dovecot --with-mysql’ fails with:

checking for auth_userokay... no
checking for mysql_config... NO
checking for mysql_init in -lmysqlclient... no
configure: error: Can't build with MySQL support: libmysqlclient not found

The libraries are definitely at /usr/local/opt/mysql@5.7/lib.

UPDATE:
Actually, they have not been installed there. There are only in Cellar:

locate libmysqlclient /usr/local/Cellar/mysql@5.7/5.7.24/lib/libmysqlclient.20.dylib /usr/local/Cellar/mysql@5.7/5.7.24/lib/libmysqlclient.a /usr/local/Cellar/mysql@5.7/5.7.24/lib/libmysqlclient.dylib

Have run ‘brew remove mysql@5.7’ and ‘brew install mysql@5.7’ to no avail.

2nd UPDATE:

Have given up on Homebrew for Dovecot and have manually installed it. :frowning: