Python

 View Only
  • 1.  Problems with setup and assembler files

    Posted 07/01/22 05:06 AM
    I have a "setup" to compile a C and some assembler modules for an external function.
    ...
    ext_modules = [Extension('console.zconsole',['console.c','cpwto.s','qedit.s'],
    extra_compile_args=["-Wc,ASM,LIST(/u/tmp/py/c.lst),SOURCE,WARN64,XREF","-Wa,LIST,RENT"],
    ...

    The assembler fails to compile cleanly because

    No Overriding ASMAOPT Parameters
    Overriding Parameters- NODECK,OBJECT,TERM,NOLIST,NOESD,NORLD,NOXREF,FLAG(4),ASA,GOFF,XPLINK,LIST,RENT
    No Process Statements
    ** ASMA400W Error in invocation parameter - XPLINK
    ...

    Return Code 004

    The compile statement is

    /bin/xlc -fno-strict-aliasing -DNDEBUG -O3 -qarch=10
    -qlanglvl=extc99 -q64 -Wc,DLL -D_XOPEN_SOURCE_EXTENDED
    -D_UNIX03_THREADS -D_POSIX_THREADS -D_OPEN_SYS_FILE_EXT
    -qexportall -qascii -qstrict -qnocsect -Wa,asa,goff
    -Wa,xplink -qgonumber -qenum=int -I//'COLIN.MQ930.SCSQC370'
    -I. -I/u/tmp/zpymqi/env/include
    -I/usr/lpp/IBM/cyp/v3r8/pyz/include/python3.8 -c console.c
    -o build/temp.os390-27.00-1090-3.8/console.o
    -Wc,ASM,LIST(/u/tmp/py/c.lst),SOURCE,WARN64,XREF
    -Wa,LIST,RENT

    and I get

    FSUM3212 xlc: Command option -fno-strict-aliasing is incorrect for z/OS platform - ignored.

    Is there a configuration file I can change to remove these options?


    Colin

    ------------------------------
    Colin Paice
    ------------------------------


  • 2.  RE: Problems with setup and assembler files

    Posted 07/06/22 04:34 PM
    Hey Colin, one way you can remove these options if desired is to subclass build_ext. Here's an example for setuptools:

    from setuptools.command.build_ext import build_ext
    from setuptools import setup
    
    class BuildExt(build_ext):
        def build_extensions(self):
            print(self.compiler.compiler_so)
            if '-fno-strict-aliasing' in self.compiler.compiler_so:
                self.compiler.compiler_so.remove('-fno-strict-aliasing')
            if '-Wa,xplink' in self.compiler.compiler_so:
                self.compiler.compiler_so.remove('-Wa,xplink')
            super().build_extensions()
    
    setup(...
          cmdclass = {'build_ext': BuildExt},
          ext_modules=[Extension(...)]
          ...)​

    Thanks,

    Steven

    ------------------------------
    Steven Pitman
    ------------------------------



  • 3.  RE: Problems with setup and assembler files

    Posted 07/07/22 11:46 AM
    Brilliant - it worked a treat.

    I'll blog on this - and give you credit for it

    Thank you

    Colin