build fails when cross compiling because of autoconf and rpl_malloc

Bug #1096207 reported by Steven Willis
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Python-Crypto
New
Undecided
Unassigned

Bug Description

If pycrypto was cross compiled it can result in the following error:

>>> from Crypto import Random
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    from Crypto import Random
  File "/usr/local/lib/python2.7/site-packages/Crypto/Random/__init__.py", line 29, in <module>
    from Crypto.Random import _UserFriendlyRNG
  File "/usr/local/lib/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 38, in <module>
    from Crypto.Random.Fortuna import FortunaAccumulator
  File "/usr/local/lib/python2.7/site-packages/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in <module>
    import FortunaGenerator
  File "/usr/local/lib/python2.7/site-packages/Crypto/Random/Fortuna/FortunaGenerator.py", line 36, in <module>
    from Crypto.Cipher import AES
  File "/usr/local/lib/python2.7/site-packages/Crypto/Cipher/AES.py", line 50, in <module>
    from Crypto.Cipher import _AES
ImportError: /usr/local/lib/python2.7/site-packages/Crypto/Cipher/_AES.so: undefined symbol: rpl_malloc

This is because autoconf assumes the target architecture during a cross compile won't have a gnu compatible malloc replaces malloc() calls with rpl_malloc() calls. The client code needs define rpl_malloc() as a wrapper around malloc() as explained here:

http://wiki.buici.com/xwiki/bin/view/Programing+C+and+C%2B%2B/Autoconf+and+RPL_MALLOC

And the actual autoconf documentation here:

http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Particular-Functions.html#index-AC_005fFUNC_005fMALLOC-453

A work-around is to set the environment variable "ac_cv_func_malloc_0_nonnull" to "yes" during the ./configure step (although if the target system really doesn't have a gnu compliant malloc then I think you could have a problem).

Revision history for this message
Adi Roiban (adiroiban) wrote :

This also affects the AIX build with xlc and standard AIX libc.

Revision history for this message
Richard Mitchell (mitchellrj) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.