HAProxy 1.9.0 & 1.9.1 failed to compile with USE_LIBCRYPT=1

Hello ! I am trying to compile HAProxy 1.9.1 with USE_LIBCRYPT=1 (I have the same problem with 1.9.0) :

make -j 8 TARGET=custom \
USE_POLL=default \

But I have a compilation error :

src/auth.c:45:28: error: variable ‘crypt_data’ has initializer but incomplete type
static THREAD_LOCAL struct crypt_data crypt_data = { .initialized = 0 };
src/auth.c:45:55: error: ‘struct crypt_data’ has no member named ‘initialized’
static THREAD_LOCAL struct crypt_data crypt_data = { .initialized = 0 };
src/auth.c:45:69: warning: excess elements in struct initializer
static THREAD_LOCAL struct crypt_data crypt_data = { .initialized = 0 };
src/auth.c:45:69: note: (near initialization for ‘crypt_data’)
src/auth.c: In function ‘check_user’:
src/auth.c:261:8: warning: implicit declaration of function ‘crypt_r’; did you mean ‘crypt’? [-Wimplicit-function-declaration]
ep = crypt_r(pass, u->pass, &crypt_data);
src/auth.c:261:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
ep = crypt_r(pass, u->pass, &crypt_data);
src/auth.c: At top level:
src/auth.c:45:39: error: storage size of ‘crypt_data’ isn’t known
static THREAD_LOCAL struct crypt_data crypt_data = { .initialized = 0 };
Makefile:985: recipe for target ‘src/auth.o’ failed
make: *** [src/auth.o] Error 1
make: *** Waiting for unfinished jobs…

Do you know what I am doing wrong ? Thank you and have a nice day !

What OS, what cc is this and why are you compiling with TARGET=custom ?

Ubuntu 18.04 x64

cc -v :

Using built-in specs.
Target: x86_64-linux-gnu
Configured with: …/src/configure -v --with-pkgversion=‘Ubuntu 7.3.0-27ubuntu1~18.04’ --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)

For TARGET=custom I thought it was necessary to customize compilation flags

I suspect you also need to add USE_CRYPT_H=1 in this case, as it looks like issues with some libcrypt definitions that are not present by default in your libc.


Thank you willy, it works !

But it’s weird because this option is not documented here : https://github.com/haproxy/haproxy/blob/master/INSTALL

There are very few presented there. There’s even an instruction saying : “If you need to pass other defines, includes, libraries, etc… then please check the Makefile to see which ones will be available in your case, and use/override the USE_* variables from the Makefile.”

by the way, with these options you’ll get poor performance, please have a look at the makefile to figure the other options available. For example you deifnitely want to have USE_EPOLL=1. I suggest you to steal options from the linux2628 target which is the most complete.

Ok, thank you, I will have a look !

As a matter of fact, you probably don’t want to use the custom target at all, but the linux2628 target instead. There is no reason to use the custom target, unless you have very specific problems with an option that linux2628 enables.