Author Michael.Felt
Recipients Michael.Felt
Date 2016-02-25.15:10:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1456413023.18.0.874865601403.issue26439@psf.upfronthosting.co.za>
In-reply-to
Content
I have successful enough with python 2.7.10 (for building cloud-init), including it finding openssl libraries during the installation od setuptools (before installing pip).

I have also been able to assemble saltstack - BUT - salt-master and salt-minion fail to start because ctypes.util.find_library() always returns 'None'.
======== EXCERPT ====
  File "/opt/lib/python2.7/site-packages/salt/crypt.py", line 37, in <module>
    import salt.utils.rsax931
  File "/opt/lib/python2.7/site-packages/salt/utils/rsax931.py", line 69, in <module>
    libcrypto = _init_libcrypto()
  File "/opt/lib/python2.7/site-packages/salt/utils/rsax931.py", line 47, in _init_libcrypto
    libcrypto = _load_libcrypto()
  File "/opt/lib/python2.7/site-packages/salt/utils/rsax931.py", line 40, in _load_libcrypto
    raise OSError('Cannot locate OpenSSL libcrypto')
OSError: Cannot locate OpenSSL libcrypto
=======
I built python using the IBM compiler, and my images do not have /sbin/ldconfig installed so the assumption that /sbin/ldconfig is always installed is "a bug".

in the util.py file the code reached is:

  +219      else:
  +220
  +221          def _findSoname_ldconfig(name):
  +222              import struct
  +223              if struct.calcsize('l') == 4:
  +224                  machine = os.uname()[4] + '-32'
  +225              else:
  +226                  machine = os.uname()[4] + '-64'
  +227              mach_map = {
  +228                  'x86_64-64': 'libc6,x86-64',
  +229                  'ppc64-64': 'libc6,64bit',
  +230                  'sparc64-64': 'libc6,64bit',
  +231                  's390x-64': 'libc6,64bit',
  +232                  'ia64-64': 'libc6,IA-64',
  +233                  }
  +234              abi_type = mach_map.get(machine, 'libc6')
  +235
  +236              # XXX assuming GLIBC's ldconfig (with option -p)
  +237              expr = r'\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type)
  +238              f = os.popen('/sbin/ldconfig -p 2>/dev/null')
  +239              try:
  +240                  data = f.read()
  +241              finally:
  +242                  f.close()
  +243              res = re.search(expr, data)
  +244              if not res:
  +245                  return None
  +246              return res.group(1)
  +247
  +248          def find_library(name):
  +249              return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name))
  +250

(I have not researched _get_soname or _findLib_gcc but neither of these "feel right" as AIX, by default, does not end library (archives) with .so (archives end with .a and archive members frequently end with .so)

That this is/has not been reported more frequently may be because python programmers are avoiding ctypes - when portability is essential.

I hope that, just as for Solaris - where an alternate program is used - that AIX can have a block:
 # if os.name == "posix" and sys.platform.startswith("aix"):

so that if ldconfig is not available the command /usr/bin/dump could be used instead, and/or search LIBPATH and/or (when not empty) and/or ldd (for programs). Ideally, /sbin/ldconfig would not be need at all!

dump output:

root@x064:[/data/prj/gnu/bashRC1-4.4]dump -Xany -H /opt/bin/python

/opt/bin/python:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x000005ac       0x000035e3       0x0000006e       

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000005       0x00030ee4       0x00006772       0x00030f52       


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      /usr/vac/lib:/usr/lib:/lib                                            
1                                    libc.a              shr.o               
2                                    libpthreads.a       shr_xpg5.o          
3                                    libpthreads.a       shr_comm.o          
4                                    libdl.a             shr.o        

root@x064:[/usr/bin]dump -Xany -H /usr/lib/libcrypto.a

/usr/lib/libcrypto.a[libcrypto.so]:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000ff9       0x0000498a       0x00000038       

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000003       0x0004f1f0       0x00014636       0x0004f228       


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      /usr/lib:/lib                                                         
1                                    libc.a              shr.o               
2                                    libpthreads.a       shr_xpg5.o          

/usr/lib/libcrypto.a[libcrypto.so.0.9.8]:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000c4e       0x00004312       0x00000038       

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000003       0x00044c48       0x0000f236       0x00044c80       


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      /usr/lib:/lib                                                         
1                                    libc.a              shr.o               
2                                    libpthreads.a       shr_xpg5.o          

/usr/lib/libcrypto.a[libcrypto.so.1.0.0]:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000ff9       0x0000498a       0x00000038       

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000003       0x0004f1f0       0x00014636       0x0004f228       


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      /usr/lib:/lib                                                         
1                                    libc.a              shr.o               
2                                    libpthreads.a       shr_xpg5.o          

/usr/lib/libcrypto.a[libcrypto64.so]:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000ff2       0x00004987       0x0000003e       

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000003       0x00061758       0x00014e03       0x00061796       


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      /usr/lib:/lib                                                         
1                                    libc.a              shr_64.o            
2                                    libpthreads.a       shr_xpg5_64.o       

/usr/lib/libcrypto.a[libcrypto64.so.0.9.8]:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000c47       0x0000430d       0x0000003e       

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000003       0x000557b0       0x0000f9e7       0x000557ee       


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      /usr/lib:/lib                                                         
1                                    libc.a              shr_64.o            
2                                    libpthreads.a       shr_xpg5_64.o       

/usr/lib/libcrypto.a[libcrypto64.so.1.0.0]:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000ff2       0x00004987       0x0000003e       

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000003       0x00061758       0x00014e03       0x00061796       


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      /usr/lib:/lib                                                         
1                                    libc.a              shr_64.o            
2                                    libpthreads.a       shr_xpg5_64.o       
root@x064:[/usr/bin]
root@x064:[/usr/bin]echo $?                           
0


ldd outpath:
root@x064:[/usr/bin]ldd /opt/bin/python
/opt/bin/python needs:
         /usr/lib/libc.a(shr.o)
         /usr/lib/libpthreads.a(shr_xpg5.o)
         /usr/lib/libpthreads.a(shr_comm.o)
         /usr/lib/libdl.a(shr.o)
         /unix
         /usr/lib/libcrypt.a(shr.o)

root@x064:[/usr/bin]ldd /usr/lib/libcrypto.a
ldd: /usr/lib/libcrypto.a: File is an archive.
root@x064:[/usr/bin]echo $?                 
2
History
Date User Action Args
2016-02-25 15:10:23Michael.Feltsetrecipients: + Michael.Felt
2016-02-25 15:10:23Michael.Feltsetmessageid: <1456413023.18.0.874865601403.issue26439@psf.upfronthosting.co.za>
2016-02-25 15:10:23Michael.Feltlinkissue26439 messages
2016-02-25 15:10:21Michael.Feltcreate