ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

You are 100% correct about the shared libraries. I have converted (or in the process of) the Pycrypto module
to be Python3.X compatible. I am able to run my own small scripts using the likes of AES, Blowfish encryptions,
but i am receiving this segfault when I am trying to run the built in tests that came with it.

To make it simple I am happy to look at just one of the libraries and when pointed in the right direction
will tackle the others myself. To this end I have been trying to find a way to debug AES.so which was created as
part of the install. Are you able to help me understand the best way to debug this shared library?

I have added the -g option to the compilation and if I do a simple - gdb AES.so it tells me that it loads
all necessary symbols, but of course when I then run and backtrace I am not lead to any intelligible errors.

When searching on google it says that the best way to debug a shared library is to compile it into
another program, but the issue I have here is I would not know what sort of program to write to
illicit the correct outcome

Please let me know what sort of information I can provide to further this effort?

It's been awhile since I've debugged shared libraries - it can be tricky. Often times the problem isn't with the main library you are working with, but rather the problem is an compatibility with a library that is being depended on. So to see what libraries AES.so needs, use the 'ldd' command.

* ldd AES.so # should show you the libraries AES.so depends on.
* ldd -r AES.so # forces the loader to resolve all of the symbols - which will sniff out symbols that can't be found in any libraries.

By the way - make sure the libraries being found are the ones it should be finding. A common problem is that the loader grabs a version of a library out of /usr/lib instead of from your test area. You can use the LD_LIBRARY_PATH or SHLIB_PATH environment variables to give a list of paths to prefer over the default system paths, which are defined in /etc/ld.so.conf (usually).

This means the problem is a bit (actually, a lot) more subtle. Are you able to do very limited tests with the python script to see if it's possible to invoke the script without provoking the segfault? If so, try to map python code to functionality in the library you're porting. That will help get you "in the right neighborhood". Sorry I can't offer better advice than that... without the ability to poke and prod at this myself I can only offer some high-level advice.

Thanks for the input. Yes I am able to utilise the python code without invoking the segfault.
i was happily doing so until I tried to run the built in tests, which I am guessing are doing
things I haven't tried as yet
I will try as you have suggested and see how I go.