Mailing List Archive

Missing stpcpy on Solaris 8
Hello,

I tried to compile libgcrypt 1.1.6 on Solaris 8, but compile fails with
message:

gcc -DHAVE_CONFIG_H -I. -I. -I.. -O2 -Wall -c `test -f testapi.c || echo
'./'`testapi.c
/bin/sh ../libtool --mode=link gcc -O2 -Wall -o testapi testapi.o
libgcrypt.la -ldl -lnsl -lsocket
gcc -O2 -Wall -o .libs/testapi testapi.o
./.libs/libgcrypt.so -ldl -lnsl -lsocket -Wl,--rpath -Wl,/usr/local/lib
./.libs/libgcrypt.so: undefined reference to `stpcpy'
./.libs/libgcrypt.so: undefined reference to `_gcry_rndunix_constructor'
./.libs/libgcrypt.so: undefined reference to `__udiv_qrnnd'
./.libs/libgcrypt.so: undefined reference to
`register_internal_cipher_extension'
collect2: ld returned 1 exit status
make[3]: *** [testapi] Error 1
make[3]: Leaving directory `/usr/local/src/libgcrypt-1.1.6/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/local/src/libgcrypt-1.1.6/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/libgcrypt-1.1.6'
make: *** [all] Error 2

I fixed missing stpcpy function adding ../jnlib/stringhelp.o to the last gcc
line:

make all-am
make[1]: Entering directory `/usr/local/src/libgcrypt-1.1.6/src'
/bin/sh ../libtool --mode=link gcc -O2 -Wall -o testapi testapi.o
libgcrypt.la -ldl -lnsl -lsocket ../jnlib/stringhelp.o
gcc -O2 -Wall -o .libs/testapi testapi.o ../jnlib/stringhelp.o
./.libs/libgcrypt.so -ldl -lnsl -lsocket -Wl,--rpath -Wl,/usr/local/lib
./.libs/libgcrypt.so: undefined reference to `_gcry_rndunix_constructor'
./.libs/libgcrypt.so: undefined reference to `__udiv_qrnnd'
./.libs/libgcrypt.so: undefined reference to
`register_internal_cipher_extension'
collect2: ld returned 1 exit status
make[1]: *** [testapi] Error 1
make[1]: Leaving directory `/usr/local/src/libgcrypt-1.1.6/src'
make: *** [all] Error 2

But problem with _gcry_rndunix_constructor, __udiv_qrnnd and
register_internal_cipher_extension remains. I saw some functions with
similar names having underscore at the beginning and without underscore and
I supose this is just problem with function names. Probably configure script
fails to make the right configuration.

Machine info: SunOS riemann 5.8 Generic_108528-12 sun4u sparc SUNW,Ultra-4

I need to compile libgcrypt to be able to upgrade AIDE to version 0.8.
Please let me know what shell I do to fix this.

Best regards,
Boban Acimovic
www.mbl.is
Re: Missing stpcpy on Solaris 8 [ In reply to ]
On Mon, 18 Feb 2002 19:56:06 +0100, Boban Acimovic said:

> ./.libs/libgcrypt.so -ldl -lnsl -lsocket -Wl,--rpath -Wl,/usr/local/lib
> ./.libs/libgcrypt.so: undefined reference to `stpcpy'

Please grep for HAVE_STPCPY in config.h - it should be defined and
thus the version from jnlib/stringhelp should get used.

> ./.libs/libgcrypt.so: undefined reference to `_gcry_rndunix_constructor'
> ./.libs/libgcrypt.so: undefined reference to `__udiv_qrnnd'

I probably fixed this:

diff -u -r1.8 -r1.9
--- configure.ac 2002/02/07 19:15:51 1.8
+++ configure.ac 2002/02/18 11:52:31 1.9
@@ -36,6 +36,7 @@

AC_CONFIG_SRCDIR([src/gcrypt.h])
AC_CONFIG_AUX_DIR(scripts)
+AC_CANONICAL_TARGET()
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AM_CONFIG_HEADER(config.h)

@@ -682,7 +683,7 @@
if test "$ac_cv_mpi_extra_asm_modules" != ""; then
for i in $ac_cv_mpi_extra_asm_modules; do
show_extraasm="$show_extraasm $i"
- MPI_EXTRA_ASM_OBJS="$MPI_EXTRA_ASM_OBJS $i.o"
+ MPI_EXTRA_ASM_OBJS="$MPI_EXTRA_ASM_OBJS $i.lo"
done
fi
AC_SUBST(MPI_EXTRA_ASM_OBJS)

> But problem with _gcry_rndunix_constructor, __udiv_qrnnd and
> register_internal_cipher_extension remains. I saw some functions with

This should help:

RCS file: /cvs/gnupg/libgcrypt/cipher/rndunix.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- rndunix.c 2001/08/03 10:57:34 1.21
+++ rndunix.c 2002/02/18 11:52:42 1.22
@@ -853,7 +853,7 @@
#ifndef IS_MODULE
static
#endif
-const char * const gnupgext_version = "RNDUNIX ($Revision: 1.21 $)";
+const char * const gnupgext_version = "RNDUNIX ($Revision: 1.22 $)";


static struct {
@@ -909,8 +909,8 @@
void
rndunix_constructor(void)
{
- register_internal_cipher_extension( gnupgext_version,
- gnupgext_enum_func );
+ _gcry_register_internal_cipher_extension (gnupgext_version,
+ gnupgext_enum_func);
}
#endif



--
Werner Koch Omnis enim res, quae dando non deficit, dum habetur
g10 Code GmbH et non datur, nondum habetur, quomodo habenda est.
Privacy Solutions -- Augustinus
Re: Missing stpcpy on Solaris 8 [ In reply to ]
Thank you for your help :)

gcc -O2 -Wall -o .libs/testapi testapi.o
./.libs/libgcrypt.so -ldl -lnsl -lsocket -Wl,--rpath -Wl,/usr/local/lib
./.libs/libgcrypt.so: undefined reference to `stpcpy'
./.libs/libgcrypt.so: undefined reference to `_gcry_rndunix_constructor'
./.libs/libgcrypt.so: undefined reference to `__udiv_qrnnd'
collect2: ld returned 1 exit status
make[3]: *** [testapi] Error 1
make[3]: Leaving directory `/usr/local/src/libgcrypt-1.1.6/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/local/src/libgcrypt-1.1.6/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/libgcrypt-1.1.6'
make: *** [all] Error 2

I still have problem with stpcpy, _gcry_rndunix_constructor and
__udiv_qrnnd.

I think I did with HAVE_STPCPY what you said:

[root@riemann libgcrypt-1.1.6]# grep HAVE_STPCPY *
config.h:/* #undef HAVE_STPCPY */
config.h:#define HAVE_STPCPY 1
config.h.in:/* #undef HAVE_STPCPY */
config.h.in:#define HAVE_STPCPY 1

Still, I can resolve problem with this function in the old way I did, but
problem with another two functions is still there. I visually checked file
configure.in and it is patched correctly. Have you made changes to CVS?
Shell I download CVS version of libgcrypt? Thank you in advance.

Regards,
Boban Acimovic
www.mbl.is
Re: Missing stpcpy on Solaris 8 [ In reply to ]
On Tue, 19 Feb 2002 14:41:48 +0100, Boban Acimovic said:

> config.h:#define HAVE_STPCPY 1

So the configure believes that there is a stpcpy available

> problem with another two functions is still there. I visually checked file
> configure.in and it is patched correctly. Have you made changes to CVS?

Ahhh. This is not 1.1.6 - we use configure.ac; there should be no
configure.in anymore.

--
Werner Koch Omnis enim res, quae dando non deficit, dum habetur
g10 Code GmbH et non datur, nondum habetur, quomodo habenda est.
Privacy Solutions -- Augustinus
Re: Missing stpcpy on Solaris 8 [ In reply to ]
I still have problems compiling libgcrypt on Solaris 8 Sparc machine. I am
using GNU C and other utilities to make this.

creating libgcrypt.la
(cd .libs && rm -f libgcrypt.la && ln -s ../libgcrypt.la libgcrypt.la)
source='testapi.c' object='testapi.o' libtool=no \
depfile='.deps/testapi.Po' tmpdepfile='.deps/testapi.TPo' \
depmode=gcc /bin/sh ../scripts/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -Os -Wall -c `test -f testapi.c || echo
'./'`testapi.c
/bin/sh ../libtool --mode=link gcc -Os -Wall -o testapi testapi.o
libgcrypt.la -ldl -lnsl -lsocket
gcc -Os -Wall -o .libs/testapi testapi.o
./.libs/libgcrypt.so -ldl -lnsl -lsocket -Wl,--rpath -Wl,/usr/local/lib
./.libs/libgcrypt.so: undefined reference to `stpcpy'
./.libs/libgcrypt.so: undefined reference to `_gcry_rndunix_constructor'
./.libs/libgcrypt.so: undefined reference to `__udiv_qrnnd'
./.libs/libgcrypt.so: undefined reference to
`register_internal_cipher_extension'
collect2: ld returned 1 exit status
make[3]: *** [testapi] Error 1
make[3]: Leaving directory `/usr/local/src/libgcrypt-1.1.6/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/local/src/libgcrypt-1.1.6/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/libgcrypt-1.1.6'
make: *** [all] Error 2

# grep HAVE_STPCPY *
config.h:/* #undef HAVE_STPCPY */
config.h.in:#undef HAVE_STPCPY

Please let me know what to do? Is there any newer version of libgcrypt?
Thank you in advance.

Regards,
Boban Acimovic
www.mbl.is
Re: Missing stpcpy on Solaris 8 [ In reply to ]
> Hmmm, put this into jnlib/stringhelp.c
>
> #ifndef HAVE_STPCPY
> char *
> stpcpy(char *a,const char *b)
> {
> while( *b )
> *a++ = *b++;
> *a = 0;
>
> return (char*)a;
> }
> #endif

This definition is already in stringhelp.c

bin/sh ../libtool --mode=compile
-DHAVE_CONFIG_H -I. -I. -I.. -I../src -Os -Wall -c -o stringhelp.lo
`test -f stringhelp.c || echo './'`stringhelp.c
rm -f .libs/stringhelp.lo
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../src -Os -Wall -c
stringhelp.c -Wp,-MD,.deps/stringhelp.TPlo -fPIC -DPIC -o
.libs/stringhelp.lo
stringhelp.c:358: redefinition of `stpcpy'
stringhelp.c:33: `stpcpy' previously defined here
make[2]: *** [stringhelp.lo] Error 1
make[2]: Leaving directory `/usr/local/src/libgcrypt-1.1.6/jnlib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/libgcrypt-1.1.6'
make: *** [all] Error 2

This look to me just like a problem in configuration script. If I do

gcc -Os -Wall -o .libs/testapi testapi.o ../jnlib/stringhelp.o
./.libs/libgcrypt.so -ldl -lnsl -lsocket -Wl,--rpath -Wl,/usr/local/lib

(../jnlib/stringhelp.o addes to original line)

then I get rid of stpcpy error. However, I still get other errors:

./.libs/libgcrypt.so: undefined reference to `_gcry_rndunix_constructor'
./.libs/libgcrypt.so: undefined reference to `__udiv_qrnnd'
./.libs/libgcrypt.so: undefined reference to
`register_internal_cipher_extension'
collect2: ld returned 1 exit status

Regards,
Boban Acimovic