compiling for debug on Linux

2013-09-03 Thread Ken Goldman
I know this is a FAQ, but the answers I found all included the response 
that didn't work.


openssl 1.0.1c on Linux:  How do I compile and link so the debugger can 
step into the openssl code?


Are there definitive instructions anywhere, or does everyone use trial 
and error?


I'm using a local copy of the source, and do not want to touch /usr/bin.

I tried various combinations that worked in the past:

./config with
-d
-g
shared
linux-elf
--prefix ...
./Configure with the above and
-shared
debug-linux-elf

They either didn't compile, didn't link, or gdb would not step in.

__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Compiling for debug

2012-08-20 Thread Ken Goldman

I'm trying to compile openssl for:

Linux, 32-bit on a 64-bit machine, shared libraries, and debug.

The closest I found was:

 ./Configure linux-elf -m32 -shared -g

but this still does -O3, and the optimizer doesn't work well with the 
source level debugger.


Any clues for changing -O3 to -O0?

~~

Bonus meta-question:

When does one use ./Configure vs. ./config?  The documentation shows 
examples of both, but doesn't explain the difference.



__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: Compiling for debug

2012-08-20 Thread Jeffrey Walton
On Mon, Aug 20, 2012 at 4:54 PM, Ken Goldman kgold...@us.ibm.com wrote:

 I'm trying to compile openssl for:

 Linux, 32-bit on a 64-bit machine, shared libraries, and debug.

 The closest I found was:

  ./Configure linux-elf -m32 -shared -g

 but this still does -O3, and the optimizer doesn't work well with the
 source level debugger.

 Any clues for changing -O3 to -O0?

For debug builds, you will likely want -g3 -ggdb -O0. You should also
define -DDEBUG=1 (and make sure -DNDEBUG=1 is *not* defined).

-g3 provides maximum debugging information. For example, symbolic constants
through #define's will be available.

-ggdb provides gdb extension. I don't believe there are any at the moment,
but I got into the habit of using it (in case they show up in the future).

NDEBUG is Posix C and used for Release builds, so it should be undefined.
Some libraries/implementation sneak in additional code when DEBUG is
defined, so I define it.

Sorry about not answering your original question :(

Jeff


Re: Compiling for debug

2012-08-20 Thread Dr. Stephen Henson
On Mon, Aug 20, 2012, Ken Goldman wrote:

 I'm trying to compile openssl for:
 
 Linux, 32-bit on a 64-bit machine, shared libraries, and debug.
 
 The closest I found was:
 
  ./Configure linux-elf -m32 -shared -g
 
 but this still does -O3, and the optimizer doesn't work well with
 the source level debugger.
 
 Any clues for changing -O3 to -O0?
 
 ~~
 
 Bonus meta-question:
 
 When does one use ./Configure vs. ./config?  The documentation shows
 examples of both, but doesn't explain the difference.
 

The config script mainly auto detects the system type and passes the results to
Configure which actually does the platform specific configuration. The -d
option to config tries to use a debug build and actually prepend debug- to
the platform.

So try debug-linux-elf -m32 shared

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Problem compiling with debug option in OpenSuSE 10.2

2007-05-15 Thread Endhy Aziz

Hi all,
I'm trying to compile OpenSSL-0.9.8c with debug option, but some
errors shown below occurs :
...
...
make[2]: Entering directory `/home/endhy/Documents/openssl-0.9.8d/apps'
( :; LIBDEPS=${LIBDEPS:--L.. -lssl  -L.. -lcrypto -lefence -lefence
-ldl}; LDCMD=${LDCMD:-gcc}; LDFLAGS=${LDFLAGS:--DOPENSSL_THREADS
-D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DBN_DEBUG -DREF_CHECK
-DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall
-DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DSHA1_ASM -DMD5_ASM
-DRMD160_ASM -DAES_ASM}; LIBPATH=`for x in $LIBDEPS; do if echo $x |
grep '^ *-L'  /dev/null 21; then echo $x | sed -e 's/^ *-L//'; fi;
done | uniq`; LIBPATH=`echo $LIBPATH | sed -e 's/ /:/g'`;
LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ${LDCMD} ${LDFLAGS} -o
${APPNAME:=openssl} openssl.o verify.o asn1pars.o req.o dgst.o dh.o
dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o
rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o
gendsa.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o
s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o
pkcs8.o spkac.o smime.o rand.o engine.o ocsp.o prime.o ${LIBDEPS} )
/usr/lib/gcc/i586-suse-linux/4.1.2/../../../../i586-suse-linux/bin/ld:
cannot find -lefence
collect2: ld returned 1 exit status
make[2]: *** [link_app.] Error 1
make[2]: Leaving directory `/home/endhy/Documents/openssl-0.9.8d/apps'
make[1]: *** [openssl] Error 2
make[1]: Leaving directory `/home/endhy/Documents/openssl-0.9.8d/apps'
make: *** [build_apps] Error 1
(Then stop..)

Can anyone tell me how to solve it? (I've tried to compile without
debug option and I didn't find any trouble. OpenSuSE 10.2 use gcc
4.1.2)


Best regards,

--Endhy
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: Problem compiling with debug option in OpenSuSE 10.2

2007-05-15 Thread Goetz Babin-Ebell

--On Mai 15, 2007 13:56:39 +0700 Endhy Aziz [EMAIL PROTECTED] wrote:


Hi all,
I'm trying to compile OpenSSL-0.9.8c with debug option, but some
errors shown below occurs :
...
...

[...]

/usr/lib/gcc/i586-suse-linux/4.1.2/../../../../i586-suse-linux/bin/ld:
cannot find -lefence

 

[...]

Can anyone tell me how to solve it? (I've tried to compile without
debug option and I didn't find any trouble. OpenSuSE 10.2 use gcc
4.1.2)


Try to add -noefence to your configure target...
(or install efence on your system...)

Bye

Goetz

--
DMCA: The greed of the few outweights the freedom of the many


pgpLae4sh9nWk.pgp
Description: PGP signature