RE: AIX support - Mailing list pgsql-hackers

From Aditya Kamath
Subject RE: AIX support
Date
Msg-id LV8PR15MB64884DC880C129D79990AE36D661A@LV8PR15MB6488.namprd15.prod.outlook.com
Whole thread
In response to Re: AIX support  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: AIX support
List pgsql-hackers

Hi Tom,

Thank you for trying to compile Postgres using meson in AIX. Feel free to ask any questions or packages you need in this node and we will install the same.

>> Please find attached the patch (See: v4-0001-Add-AIX-support-for-Postgresql-using-meson-build-.patch)

>This doesn't work for me. "meson setup" gets through all its
>configuration probes and then dies while trying to make the
>ninja recipe:
>$ meson setup build
>
>Found ninja-1.12.1 at /opt/freeware/bin/ninja
>ERROR: Multiple producers for Ninja target "src/interfaces/libpq/libpq.a". Please rename your targets.
>This is on p9-aix1-postgres1.  There was no meson installed on the GCC
>compile farm machine, so I can't say whether earlier iterations of
>the patch worked any better.
>I'm still wondering why you didn't simply reverse the effects of
>0b16bb877 on the meson files.  Do we really need to do anything
>different from what was working before?

Kindly use meson setup build -Ddefault_library=shared to configure using meson. Patch v4-0001-Add-AIX-support-for-Postgresql-using-meson-build-.patch and v5-0001-Add-AIX-support-for-Postgresql-using-meson-build-.patch have this option  -Ddefault_library=shared that we need to use to configure in AIX as the commit message says.

I can tell you why we are doing that. AIX supports the meson build system in the community. 
In AIX, we archive both shared and static libraries. All build tools like meson and cmake do the same in AIX.

 When we try to build both static and shared library in AIX, then meson creates two targets with the same name i.e. libpq.a for shared and libpq.a in static which is not allowed.

That is why it is complaining about that we have multiple targets with the same name.
>ERROR: Multiple producers for Ninja target "src/interfaces/libpq/libpq.a". Please rename your targets.

Other targets will not see this issue since they do not archive shared libraries so they build both. 

In discussion https://www.postgresql.org/message-id/e8aa97db-872b-4087-b073-f296baae948d@eisentraut.org we were proposing an approach where other targets can build both and AIX using this option can build only shared. 

Once we apply this patch, we build using the below steps to build and run the tests.

export OBJECT_MODE=64
meson setup build -Ddefault_library=shared
meson compile -C build
meson test -C build

===================
354/357 postgresql:test_json_parser / test_json_parser/002_inline                                OK               15.03s   3712 subtests passed
355/357 postgresql:subscription / subscription/100_bugs                                          OK               25.65s   17 subtests passed
356/357 postgresql:recovery / recovery/027_stream_regress                                        OK              125.22s   11 subtests passed
357/357 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade                                        OK              137.10s   19 subtests passed

Ok:                 327 
Expected Fail:      0   
Fail:               0   
Unexpected Pass:    0   
Skipped:            30  
Timeout:            0   
==========================

The need to export OBJECT_MODE=64 has also been fixed in meson recently here and the future versions of the same will not even need that export.

Also attaching v5 version of this patch. (See: v5-0001-Add-AIX-support-for-Postgresql-using-meson-build-.patch). There was one minor change which is a missing tab in the src/Makefiles/Makefile.aix which is fixed in this version.

Let me know your thoughts and if you were able to build.

Have a great day ahead.

Thanks and regards,
Aditya.

Attachment

pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: Generate images for docs by using meson build system
Next
From: lakshmi
Date:
Subject: Re: Add a greedy join search algorithm to handle large join problems