Open Source Development

 View Only

 Z3 Theorem Prover for Cobol under AIX

Ron Wellnitz's profile image
Ron Wellnitz posted Tue December 09, 2025 05:10 AM
Hello everyone,
 
is there any chance that you (IBM Open Source Team) could compile the tool https://github.com/Z3Prover/z3 for AIX and make it available in the AIX Open Source Toolbox? 
 
We would like to use the tool to test our Cobol programs on our AIX platform, but we lack the expertise to compile it ourselves. Or could you give us a few recommendations on how we could best approach this issue? 
 
Best regards,
 
Ron
Sumitra Dawn's profile image
Sumitra Dawn

For which version of AIX, you require this tool?

Ron Wellnitz's profile image
Ron Wellnitz

We currently running AIX 7.3 TL2 with DNF (AIX Toolbox) set up. 

Ayappan P's profile image
Ayappan P

There are some code changes and compile settings required to compile z3 in AIX. Below are the steps. A patch (z3-aix.patch) containing the changes is attached in this thread., 

# Clone z3 4.15.4 (latest version) and apply the patch.
git clone https://github.com/Z3Prover/z3 --branch z3-4.15.4 --single-branch
cd z3
# get the patch here and apply it. 
patch -p1 < z3-aix.patch

# Set compile parameters
export CXX="g++"
export CXXFLAGS="-pthread -maix64”
export CPPFLAGS="-D_H_VAR"
export LDFLAGS="-pthread -maix64”
export OBJECT_MODE=64

# Compile 
python3 scripts/mk_make.py --prefix=/z3_install_dir
cd build
gmake -j8

# Compile and run the tests
gmake test
./test-z3 /a

#Install the files to /z3_install_dir
gmake install

# The shared library has .so extension. In AIX , better we archive it so that application can link to it using -lz3
cd /z3_install_dir/lib
ar -x64 -q libz3.a libz3.so

Attachment  View in library
Ron Wellnitz's profile image
Ron Wellnitz

Thank you very much for your detailed response and the patch, Ayappan.

We will test it as soon as possible and get back to you with feedback. 

Best regards,

Ron

Ron Wellnitz's profile image
Ron Wellnitz
Hello Ayappan,
 
your patch und guide works like a charm. 
Our tests was successfull too. 
 
Note: There was a little typo: "ar -x64 ..." -> "ar -X64 ...". 
 
Thank you very much!
 
As initialy asked, is there a chance, that this Tool could be deployed as RPM into the AIX Toolbox? 
 
Kindly Regards,
 
Ron

Ayappan P's profile image
Ayappan P

Yes, we can make it available in AIX Toolbox as a rpm. 

Ayappan P's profile image
Ayappan P

z3 (z3 and z3-devel rpms) is now published in AIX Toolbox.
https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc-7.2/z3/
https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc-7.3/z3/

Simon Sobisch's profile image
Simon Sobisch

Just out of interest - how do you (plan to) use that together with COBOL?

Side note: the upstreaming was missing, so added that as https://github.com/Z3Prover/z3/pull/8113

Ron Wellnitz's profile image
Ron Wellnitz
Happy New Year.
 
Unfortunately, I can't explain it in detail, as I am “only” an administrator and not a developer. 
 
Technically, the Z3 JAVA API (in a build pipeline) is used and is intended to extend the functionality of SonarQube.
Instructions from the Cobol (or JAVA) programs are converted into equations, and these equations are passed to the Z3 Prover. 
Best regards,
Ron