Mailing List Archive

Newbie help
I've installed libgcrypt 1.1.42 and libgpg-error 0.6 but am having problems
building the example "basic.c" from the tests directory. This is likely to
be something quite simple because I've never manually built anything before
on Linux!

I'm using Borland CBuilderX and it compiles fine, but on linking I get many
errors. By doing the linking step manually I can reproduce the problem in a
more portable way;

[root@splosh Debug_Build]# g++ -o test basic.o -lgcrypt -lgpg-error
basic.o(.text+0x10e): In function `check_cbc_mac_cipher':
/usr/NETDRIVE/Work/basic.c:108: undefined reference to
`gpg_strerror(unsigned)'
basic.o(.text+0x2a8):/usr/NETDRIVE/Work/basic.c:130: undefined reference to
`gpg_strerror(unsigned)'
basic.o(.text+0x328):/usr/NETDRIVE/Work/basic.c:138: undefined reference to
`gpg_strerror(unsigned)'
basic.o(.text+0x467):/usr/NETDRIVE/Work/basic.c:152: undefined reference to
`gpg_strerror(unsigned)'
basic.o(.text+0x621): In function `check_aes128_cbc_cts_cipher':
/usr/NETDRIVE/Work/basic.c:224: undefined reference to
`gpg_strerror(unsigned)'
basic.o(.text+0x670):/usr/NETDRIVE/Work/basic.c:231: more undefined
references to `gpg_strerror(unsigned)' follow
collect2: ld returned 1 exit status

It makes no difference which order I put the last three arguments in.

I've confirmed that the function is in the library;

[root@splosh craig]# nm /usr/local/lib/libgpg-error.so |grep
gpg_strerror
00000990 T gpg_strerror
00000af0 T gpg_strerror_r
[root@splosh craig]#

and since g+ has given no error about being able to find the two libraries,
and it does give errors if I mistype the name to test, it seems to be able
to load them.

Can anyone point out my mistake?

--
Dr. Craig Graham, Software Engineer
Advanced Analysis and Integration Limited, UK. http://www.aail.co.uk/
Re: Newbie help [ In reply to ]
Craig Graham wrote:
> I'm using Borland CBuilderX and it compiles fine, but on linking I
> get many errors. By doing the linking step manually I can reproduce
> the problem in a more portable way;

I remembered that I had to make some code changes to get things to compile-
mainly because I'm unfamiliar with all the "dialect" options and was getting
errors about illegal typecasting (I first started playing with this a couple
of weeks ago and have been trying things on and off). So I've gone back to
the original directory and tried doing simply "make basic" and "make
keygen"; the results are the same

[root@splosh tests]# make basic
/bin/sh ../libtool --mode=link gcc -g -O2 -Wall -o basic basic.o
../src/libgcrypt.la -lnsl -lnsl
gcc -g -O2 -Wall -o .libs/basic basic.o
../src/.libs/libgcrypt.so -lnsl -Wl,--rpath -Wl,/usr/local/lib
basic.o(.text+0x2a0): In function `check_cbc_mac_cipher':
/usr/NETDRIVE/Inbox/PGP/libgcrypt-1.1.42/tests/basic.c:120: undefined
reference to `gpg_strerror'
basic.o(.text+0x30d):/usr/NETDRIVE/Inbox/PGP/libgcrypt-1.1.42/tests/basic.c:
154: undefined reference to `gpg_strerror'
basic.o(.text+0x32f):/usr/NETDRIVE/Inbox/PGP/libgcrypt-1.1.42/tests/basic.c:
145: undefined reference to `gpg_strerror'
basic.o(.text+0x351):/usr/NETDRIVE/Inbox/PGP/libgcrypt-1.1.42/tests/basic.c:
168: undefined reference to `gpg_strerror'
basic.o(.text+0x3e3): In function `check_aes128_cbc_cts_cipher':
/usr/NETDRIVE/Inbox/PGP/libgcrypt-1.1.42/tests/basic.c:235: undefined
reference to `gpg_strerror'
basic.o(.text+0x56d):/usr/NETDRIVE/Inbox/PGP/libgcrypt-1.1.42/tests/basic.c:
242: more undefined references to `gpg_strerror' follow
../src/.libs/libgcrypt.so: undefined reference to `gpg_err_code_from_errno'
../src/.libs/libgcrypt.so: undefined reference to `gpg_strsource'
collect2: ld returned 1 exit status
make: *** [basic] Error 1
[root@splosh tests]# make keygen
/bin/sh ../libtool --mode=link gcc -g -O2 -Wall -o keygen keygen.o
../src/libgcrypt.la -lnsl -lnsl
gcc -g -O2 -Wall -o .libs/keygen keygen.o
../src/.libs/libgcrypt.so -lnsl -Wl,--rpath -Wl,/usr/local/lib
keygen.o(.text+0x85): In function `print_mpi':
/usr/NETDRIVE/Inbox/PGP/libgcrypt-1.1.42/tests/keygen.c:64: undefined
reference to `gpg_strerror'
keygen.o(.text+0x1da): In function `check_generated_rsa_key':
/usr/NETDRIVE/Inbox/PGP/libgcrypt-1.1.42/tests/keygen.c:111: undefined
reference to `gpg_strerror'
keygen.o(.text+0x3e5): In function `check_rsa_keys':
/usr/NETDRIVE/Inbox/PGP/libgcrypt-1.1.42/tests/keygen.c:131: undefined
reference to `gpg_strerror'
keygen.o(.text+0x425):/usr/NETDRIVE/Inbox/PGP/libgcrypt-1.1.42/tests/keygen.
c:135: undefined reference to `gpg_strerror'
keygen.o(.text+0x445):/usr/NETDRIVE/Inbox/PGP/libgcrypt-1.1.42/tests/keygen.
c:171: undefined reference to `gpg_strerror'
keygen.o(.text+0x47d):/usr/NETDRIVE/Inbox/PGP/libgcrypt-1.1.42/tests/keygen.
c:167: more undefined references to `gpg_strerror' follow
../src/.libs/libgcrypt.so: undefined reference to `gpg_err_code_from_errno'
../src/.libs/libgcrypt.so: undefined reference to `gpg_strsource'
collect2: ld returned 1 exit status
make: *** [keygen] Error 1

Can't get simpler than this. Any suggestions as to what is going wrong?

--
Dr. Craig Graham, Software Engineer
Advanced Analysis and Integration Limited, UK. http://www.aail.co.uk/
Re: Newbie help [ In reply to ]
On Wed, 14 Apr 2004 07:23:15 +0100, Craig Graham said:

> I've installed libgcrypt 1.1.42 and libgpg-error 0.6 but am having problems
> building the example "basic.c" from the tests directory. This is likely to

Please don't use this versions - use 1.1.94 this will be the real
stable thing in a couple of days.

> [root@splosh Debug_Build]# g++ -o test basic.o -lgcrypt -lgpg-error

You are using a C++ compiler to build C programs - that may work or
may not work. In this case you should get the latest libgpg-error
(0.7) because it allows to use gpg-error.h with C++.

> and since g+ has given no error about being able to find the two libraries,

It did ("undefined reference..."). You should also run

libgcrypt-config --libs

to see the command line arguments you need to pass to the compiler
(note the -L)


Hth,

Werner
Re: Newbie help [ In reply to ]
Werner Koch wrote:
> Please don't use this versions - use 1.1.94 this will be the real
> stable thing in a couple of days.

Thanks for the response.

How do I obtain 1.1.94 and the new gpg-error? The latest tarball I can find
is 1.1.42 and I can't seem to get it from CVS;

[root@splosh libgcrypt-CVS]# cvs -z3 -d
:pserver:anoncvs@cvs.gnupg.org:/cvs/gnupg checkout libgcrypt
cvs checkout: warning: failed to open /root/.cvspass for reading: No such
file or directory
cvs checkout: authorization failed: server cvs.gnupg.org rejected access to
/cvs/gnupg for user anoncvs
cvs checkout: used empty password; try "cvs login" with a real password
[root@splosh libgcrypt-CVS]#

--
Dr. Craig Graham, Software Engineer
Advanced Analysis and Integration Limited, UK. http://www.aail.co.uk/
Re: Newbie help [ In reply to ]
Craig Graham wrote:

>How do I obtain 1.1.94 and the new gpg-error?
>

ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/libgcrypt-1.1.94.tar.gz
ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/libgcrypt-1.1.94.tar.gz.sig

ftp://ftp.gnupg.org/gcrypt/alpha/libgpg-error/libgpg-error-0.7.tar.gz
ftp://ftp.gnupg.org/gcrypt/alpha/libgpg-error/libgpg-error-0.7.tar.gz.sig

The link on the gnupg.org web site still links to v1.1.42, so its
not your fault that you couldn't find these...

- Joe
Re: Newbie help [ In reply to ]
On Wed, 14 Apr 2004 07:30:07 -0400, Joseph S Testa said:

> The link on the gnupg.org web site still links to v1.1.42, so its
> not your fault that you couldn't find these...

Thanks, I'll fix it.

Werner
Re: Newbie help [ In reply to ]
On Wed, 14 Apr 2004 11:22:29 +0100, Craig Graham said:

> How do I obtain 1.1.94 and the new gpg-error? The latest tarball I can find
> is 1.1.42 and I can't seem to get it from CVS;

I see now that the GNU directory lists the excact tarball instead of
just the directory.

ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/

is the canonical location for the development version of library; the
URL without "alpha" will soon carry the stable version.

> [root@splosh libgcrypt-CVS]# cvs -z3 -d
> :pserver:anoncvs@cvs.gnupg.org:/cvs/gnupg checkout libgcrypt

Did you do a

cvs -d :pserver:anoncvs@cvs.gnupg.org:/cvs/gnupg login

using password "anoncvs" prior of checking out?


Werner
Re: Newbie help [ In reply to ]
Werner Koch wrote:
> On Wed, 14 Apr 2004 11:22:29 +0100, Craig Graham said:

>> [root@splosh libgcrypt-CVS]# cvs -z3 -d
>>> pserver:anoncvs@cvs.gnupg.org:/cvs/gnupg checkout libgcrypt
>
> Did you do a
>
> cvs -d :pserver:anoncvs@cvs.gnupg.org:/cvs/gnupg login
>
> using password "anoncvs" prior of checking out?
>
>
> Werner

Ah- now it works. I've not done anonymous CVS before.

From an email from you earlier it seems I've been barking up the wrong tree.
GPGME seems a more appropriate way to go, and I'm playing with it at the
moment. Having trouble running (not building) the test apps manually, but
since "make" is able to do it it's my lack of understanding on library
linking and search paths. My attemps build and link but cannot find the
library at run time. I'm ready to quit for the day now, so maybe inspiration
will hit overnight. At least I've actually got somewhere today :)

--
Dr. Craig Graham, Software Engineer
Advanced Analysis and Integration Limited, UK. http://www.aail.co.uk/