openwrt / packages

Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
GNU General Public License v2.0
3.94k stars 3.45k forks source link

ocserv 0.8.7 fails to compile on Arch Linux #544

Closed plntyk closed 9 years ago

plntyk commented 9 years ago

compiling this package in a clean build tree leads to different results debian (and buildbots) : package seems to build fine arch linux: package fails with

CCLD   ocpasswd
ocpasswd.o: In function `main':
ocpasswd.c:(.text.startup+0x424): undefined reference to `crypt'
ocpasswd.c:(.text.startup+0x438): undefined reference to `crypt'
collect2: error: ld returned 1 exit status

examining a little bit further (config.log): ac_cv_libcrypt=no (archlinux) while ac_cv_libcrypt=yes (debian)

adding to that some research show that crypt() in unistd.h is guarded / sometimes not exposed:

/* XPG4.2 specifies that prototypes for the encryption functions must
be defined here.  */
#ifdef  __USE_XOPEN
# if defined __UCLIBC_HAS_CRYPT__
/* Encrypt at most 8 characters from KEY using salt to perturb DES.  */
extern char *crypt (__const char *__key, __const char *__salt)
 __THROW __nonnull ((1, 2));

I don't know if this is a bug in the toolchain, autotools (libcrypt detection), environment (__USE_XOPEN) or source code (not declaring code XOPEN/POSIX compliant affecting) or a mix of the above.

nmav commented 9 years ago

I've added _XOPEN_SOURCE prior to searching for crypt(). That should resolve the issue.

RinCat commented 9 years ago

Hello, it's happened again. Should I use this patch?

ocserv 0.8.8 on Archlinux ocpasswd.o: In function main': ocpasswd.c:(.text.startup+0x362): undefined reference tocrypt' ocpasswd.c:(.text.startup+0x5a6): undefined reference to `crypt' collect2: error: ld returned 1 exit status

nmav commented 9 years ago

The latest version is 0.8.9 and includes the patch.

danielcra commented 9 years ago

I'm still getting the same error when I try to compile the latest ocserv-0.9.0.tar.gz for OpenWRT on SLES (Suse):

ocpasswd.c:(.text.startup+0x424): undefined reference to `crypt'

What can I do to fix it?

nmav commented 9 years ago

No idea, the current code should compile out of the box.