[Botan-devel] Segmentation fault

Jack Lloyd lloyd at randombit.net
Sun Dec 12 15:08:29 EST 2004


You don't want -shared; that tells gcc to build a shared
library. Since a shared library does not (usually) have the
proper stubs for actually executing, it fails sort of badly. The
only exception I know of to this is glibc, which will print out
version info if you run the shared library.

You can verify this by running the `file` command on the
executable, it should be reported as a executable, not a shared
object.

For linking, all you'll need is -lbotan, since /usr/local/lib is
in the default library search path for GCC on most systems
(except OpenBSD). Oh, but depending on your exact environment you
may want to use `botan-config --libs` instead; if your system had
every dependency as a shared object than -lbotan will pull in
everything that's needed, but if libz or something was an archive
instead of shared, you'll want to use the config script.

Finally, the long long warnings are due to a bug in gcc 3.3.x and
3.4.x. It is supposed to be fixed in 4.0.

-Jack

On Sun, Dec 12, 2004 at 11:56:59AM -0800, Dominic Chambers wrote:
> Hello world!
> 
> 
> I've downloaded Botan 1.4.4 and built and installed it
> as per the instructions. The build seemed to go okay
> but with quite a few warnings about long long types.
> 
> I created a simple command line app 'addler32sum'
> which works the same as md5sum but using addler32, and
> it seg-faulted. So instead I tried building one of the
> example programs (hash.cpp), but it also seg-faults
> when I run it.
> 
> I built the program using:
> 
>   g++ hash.cpp -shared /usr/local/lib/libbotan.so -o
> hash
> 
> I am using 'gcc --version':
> 
>   gcc (GCC) 3.4.1 (Mandrakelinux (Alpha 3.4.1-3mdk)
> 
> and my platform is Mandrake Linux 10.1 CE; 'uname
> -srmp' gives:
> 
>   Linux 2.6.8.1-10mdk i686 Celeron (Mendocino)
> 
> The program seems to be linked okay (I had to add
> '/usr/local/lib' to my lib-path); 'ldd hash' now
> gives:
> 
>   linux-gate.so.1 =>  (0xffffe000)
>   libbotan-1.4.4.so =>
> /usr/local/lib/libbotan-1.4.4.so (0x40015000)
>   libstdc++.so.6 => /usr/lib/libstdc++.so.6
> (0x40281000)
>   libm.so.6 => /lib/tls/libm.so.6 (0x40353000)
>   libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40376000)
>   libc.so.6 => /lib/tls/libc.so.6 (0x4037f000)
>   libpthread.so.0 => /lib/tls/libpthread.so.0
> (0x4049f000)
>   librt.so.1 => /lib/tls/librt.so.1 (0x404b0000)
>   /lib/ld-linux.so.2 => /lib/ld-linux.so.2
> (0x80000000)
> 
> It's been a while since I wrote any C/C++, and this is
> the first time I've tried to do it on Linux without an
> IDE (I don't have an IDE available on this machine) so
> I am probably making a silly n00b mistake! Hope you
> can help -- I'm using md5sum at the moment and it is a
> real bottleneck in my program, and complete overkill
> for what I need.
> 
> 
> Thanks in advance for any help, Dominic.
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> Read only the mail you want - Yahoo! Mail SpamGuard. 
> http://promotions.yahoo.com/new_mail 
> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://www.randombit.net/mailman/listinfo/botan-devel



More information about the botan-devel mailing list