build fails when cross compiling because of autoconf and rpl_malloc

Bug #1096207 reported by Steven Willis on 2013-01-04
This bug affects 1 person
Affects Status Importance Assigned to Milestone

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/", line 29, in <module>
    from Crypto.Random import _UserFriendlyRNG
  File "/usr/local/lib/python2.7/site-packages/Crypto/Random/", line 38, in <module>
    from Crypto.Random.Fortuna import FortunaAccumulator
  File "/usr/local/lib/python2.7/site-packages/Crypto/Random/Fortuna/", line 39, in <module>
    import FortunaGenerator
  File "/usr/local/lib/python2.7/site-packages/Crypto/Random/Fortuna/", line 36, in <module>
    from Crypto.Cipher import AES
  File "/usr/local/lib/python2.7/site-packages/Crypto/Cipher/", line 50, in <module>
    from Crypto.Cipher import _AES
ImportError: /usr/local/lib/python2.7/site-packages/Crypto/Cipher/ 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:

And the actual autoconf documentation here:

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).

Adi Roiban (adiroiban) wrote :

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

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers