[pycrypto] issue with redefine of malloc to rpl_malloc on AIX, also hint re: _LARGE_FILES as a CFLAG define

Michael Felt michael at felt.demon.nl
Sat Oct 15 09:48:48 UTC 2016


Hi - A couple things.
Show stopper was this message: ld: 0711-317 ERROR: Undefined symbol: 
.rpl_malloc
The fist thing I find via google:"ld: 0711-317 ERROR: Undefined symbol: 
.rpl_malloc AIX" is: https://bugs.launchpad.net/pycrypto/+bug/1321757
and the second starts here: 
https://lists.gnu.org/archive/html/bug-coreutils/2012-11/msg00078.html

* The key message for coreutils being: 
https://lists.gnu.org/archive/html/bug-coreutils/2012-11/msg00089.html 
where he suggests to add an #undef malloc

* Back to the first find - more in your domain: the poster suggests 
effectively the same - except I expect src/config.h is generated so it 
will never stay.

* re: the command below: -std=c99 is a GCC thing (and every compile has 
a warning about an incorrect argument for -t being ignored)

xlc_r -D_LARGE_FILES -std=c99 -O3 -fomit-frame-pointer -Isrc/ 
-I/opt/include/python2.7 -c src/AES.c -o build/temp.aix-5.3-2.7/src/AES.o
  Adding the -bloadmap:xxx.map gives these key lines in the .map output

ld: 0711-318 ERROR: Undefined symbols were found.
         The following symbols are in error:
  Symbol                    Inpndx  TY CL Source-File(Object-File) OR 
Import-File{Shared-object}
                               RLD: Address  Section  Rld-type 
Referencing Symbol
  ----------------------------------------------------------------------------------------------
  .rpl_malloc               [114]   ER PR 
src/AES.c(build/temp.aix-5.3-2.7/src/AES.o)
                                    00001d88 .text    R_RBR [18]    
<.ALG_Encrypt>
                                    00002ae0 .text    R_RBR [20]    
<.ALG_Decrypt>

Once the #undefine is set one way or another, it builds (outside of pip).

FYI: There are several other errors that occur when _LARGE_FILES is not 
defined. (export CFLAGS="-D_LARGE_FILES" takes care of that).
While someone building on AIX should know this and 'fix' it on the 
command-line, having it added to the config for AIX would be great.

Info:
_LARGE_FLAGS is the 'constuct' or 'define' that IBM established for 
ensuring support for LARGE_FILES regardless of the
kernel/application ABI size and predates anything GNU came up with by 
several years. As your module is sensitive for this
I recommend you have a way to add it to the flags - because to work - 
this should be defined before any other system include files are
read (i.e., they all need to know from the start). Behavior is undefined 
when this advice aka rule is not followed.

Also note: extract from ./configure output:
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... no
checking for memmove... yes
checking for memset... yes
configure: creating ./config.status
config.status: creating src/config.h

root at x064:[/data/prj/aixtools/saltstack/pycrypto-2.6.1]grep malloc 
src/config.h
/* Define to 1 if your system has a GNU libc compatible `malloc' 
function, and
/* Define to rpl_malloc if the replacement function should be used. */
#define malloc rpl_malloc

So, it seems the logic for "GNU compatible" is followed (nothing is defined)
but the define malloc rpl_malloc occurs regardless.





More information about the pycrypto mailing list