Thread: Build Postgres On AIX
Hi All,
First time poster so I hope this is the appropriate group in which to ask this question. Please redirect me as needed.
I’m building Postgres 14.2 on AIX. Apparently the arc4random function is not available in the AIX system libraries. The build
fails when it tries to build postgresql-14.2/contrib/uuid-ossp/uuid-ossp.c because of the use of arc4random in that source
file.
I can build the uuid source from www.ossp.org and then link against those libraries and the build succeeds but is there any other
way to get uuid-ossp.c to compile and link without using a 3rd party lib?
Thanks, Mark
Mark Hill <Mark.Hill@sas.com> writes: > I'm building Postgres 14.2 on AIX. Apparently the arc4random function is not available in the AIX system libraries. The build > fails when it tries to build postgresql-14.2/contrib/uuid-ossp/uuid-ossp.c because of the use of arc4random in that source > file. AFAICS arc4random is only referenced in the "BSD" code paths, so you must have tried to specify --with-uuid=bsd. It's not too surprising that that didn't work. As per the docs, your other alternatives are to use the OSSP library or the e2fsprogs library. Or you could just not build uuid-ossp; it's fairly vestigial these days, now that we offer gen_random_uuid() in core. regards, tom lane
Postgres will not build on AIX with either of the following options to the configure script: --with-uuid=e2fs --with-uuid=ossp so I was using --with-uuid=bsd which does work except for the arc4random undefined symbol error I was getting. I removed the --with-uuid=bsd option to the configure script and everything builds including the contrib subdir except the uuid-ossp subdir like we want. Heres the configure command: ./configure \ --prefix="$BUILD_DIR/pgsql-$POSTGRES_VERSION" \ --without-readline \ --without-zlib \ --with-openssl \ --with-includes="$BUILD_DIR"/openssl/include/openssl/ \ --with-libraries="$BUILD_DIR"/openssl/lib/ \ "$ADDITIONAL_FLAGS" However, when I try to create a database I'm getting an out of memory error (see below.) Any suggestions? Thanks, Mark ------------------------------------------------------------------------------------------------------------------------------- Command: ${postgresDir}/bin/initdb -D ./data -U dbmsowner -W <msgs> <enter pwd> <msgs> TopMemoryContext: 75328 total in 5 blocks; 33264 free (32 chunks); 42064 used TopTransactionContext: 524288 total in 7 blocks; 106872 free (26 chunks); 417416 used TableSpace cache: 8192 total in 1 blocks; 5064 free (0 chunks); 3128 used <.....> Relcache by OID: 8192 total in 1 blocks; 1760 free (0 chunks); 6432 used CacheMemoryContext: 2097152 total in 9 blocks; 808960 free (10 chunks); 1288192 used index info: 2048 total in 2 blocks; 808 free (0 chunks); 1240 used: pg_description_o_c_o_index relation rules: 16384 total in 5 blocks; 4840 free (0 chunks); 11544 used: pg_replication_slots relation rules: 16384 total in 5 blocks; 4544 free (1 chunks); 11840 used: pg_statio_all_sequences relation rules: 49152 total in 9 blocks; 7160 free (3 chunks); 41992 used: pg_statio_all_indexes <...etc...> Grand total: 3779872 bytes in 241 blocks; 1220984 free (137 chunks); 2558888 used 2022-06-13 23:20:12.911 EDT [15270042] FATAL: out of memory 2022-06-13 23:20:12.911 EDT [15270042] DETAIL: Failed on request of size 8192 in memory context "ExprContext". 2022-06-13 23:20:12.911 EDT [15270042] STATEMENT: SELECT pg_import_system_collations('pg_catalog'); -----Original Message----- From: Tom Lane <tgl@sss.pgh.pa.us> Sent: Tuesday, May 31, 2022 11:20 AM To: Mark Hill <Mark.Hill@sas.com> Cc: pgsql-general@lists.postgresql.org Subject: Re: Build Postgres On AIX [You don't often get email from tgl@sss.pgh.pa.us. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification] EXTERNAL Mark Hill <Mark.Hill@sas.com> writes: > I'm building Postgres 14.2 on AIX. Apparently the arc4random function is not available in the AIX system libraries. The build > fails when it tries to build > postgresql-14.2/contrib/uuid-ossp/uuid-ossp.c because of the use of arc4random in that source file. AFAICS arc4random is only referenced in the "BSD" code paths, so you must have tried to specify --with-uuid=bsd. It's nottoo surprising that that didn't work. As per the docs, your other alternatives are to use the OSSP library or the e2fsprogslibrary. Or you could just not build uuid-ossp; it's fairly vestigial these days, now that we offer gen_random_uuid()in core. regards, tom lane