From 5430b4c5b6d5c4f0bac8008ed6a961fa2781e4b3 Mon Sep 17 00:00:00 2001 From: Byungjun Lee <40881444+OneTop4458@users.noreply.github.com> Date: Tue, 24 Jan 2023 15:55:17 +0900 Subject: [PATCH] Fix Aix Build (#3860) * Fix : Aix System NumberFormatter Build Error * Fix : Aix System OpenSSL 3.0 Build Support - https://github.com/openssl/openssl/blob/openssl-3.0.0/NOTES-UNIX.md?plain=1#L110 * Add : Aix System Gcc Build Support * Revert "Add : Aix System Gcc Build Support" This reverts commit b9a4b90e39ed0a6514a1fe24ae5564560553876b. * Add : Aix System Gcc Build Support --- Crypto/Makefile | 4 + Crypto/samples/genrsakey/Makefile | 4 + Crypto/testsuite/Makefile | 4 + Foundation/include/Poco/Types.h | 2 +- NetSSL_OpenSSL/Makefile | 5 +- .../samples/HTTPSTimeServer/Makefile | 4 + NetSSL_OpenSSL/samples/Mail/Makefile | 4 + NetSSL_OpenSSL/samples/SetSourceIP/Makefile | 4 + NetSSL_OpenSSL/samples/TwitterClient/Makefile | 4 + NetSSL_OpenSSL/samples/download/Makefile | 4 + NetSSL_OpenSSL/testsuite/Makefile | 4 + build/config/AIX-GCC | 82 +++++++++++++++++++ 12 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 build/config/AIX-GCC diff --git a/Crypto/Makefile b/Crypto/Makefile index 732eb031c..6542b5b7b 100644 --- a/Crypto/Makefile +++ b/Crypto/Makefile @@ -8,7 +8,11 @@ include $(POCO_BASE)/build/rules/global # see https://github.com/pocoproject/poco/issues/3073 GLOBAL_SYSLIBS := $(SYSLIBS) +ifeq ($(findstring AIX, $(POCO_CONFIG)), AIX) +SYSLIBS = -lssl_a -lcrypto_a +else SYSLIBS = -lssl -lcrypto +endif SYSLIBS += $(GLOBAL_SYSLIBS) objects = Cipher CipherFactory CipherImpl CipherKey CipherKeyImpl \ diff --git a/Crypto/samples/genrsakey/Makefile b/Crypto/samples/genrsakey/Makefile index b891a960f..0f8be4c6b 100644 --- a/Crypto/samples/genrsakey/Makefile +++ b/Crypto/samples/genrsakey/Makefile @@ -13,9 +13,13 @@ else ifeq ($(POCO_CONFIG),QNX) SYSLIBS += -lssl -lcrypto -lz else +ifeq ($(findstring AIX, $(POCO_CONFIG)), AIX) +SYSLIBS += -lssl_a -lcrypto_a -lz -ldl +else SYSLIBS += -lssl -lcrypto -lz -ldl endif endif +endif objects = genrsakey target = genrsakey diff --git a/Crypto/testsuite/Makefile b/Crypto/testsuite/Makefile index 034d999e5..8ec1c2707 100644 --- a/Crypto/testsuite/Makefile +++ b/Crypto/testsuite/Makefile @@ -13,9 +13,13 @@ else ifeq ($(POCO_CONFIG),QNX) SYSLIBS += -lssl -lcrypto -lz else +ifeq ($(findstring AIX, $(POCO_CONFIG)), AIX) +SYSLIBS += -lssl_a -lcrypto_a -lz -ldl +else SYSLIBS += -lssl -lcrypto -lz -ldl endif endif +endif objects = CryptoTestSuite Driver \ CryptoTest DigestEngineTest ECTest \ diff --git a/Foundation/include/Poco/Types.h b/Foundation/include/Poco/Types.h index 6489a6f9c..1b39fb699 100644 --- a/Foundation/include/Poco/Types.h +++ b/Foundation/include/Poco/Types.h @@ -49,7 +49,7 @@ using UIntPtr = std::uintptr_t; #if defined(__LP64__) #define POCO_PTR_IS_64_BIT 1 #define POCO_LONG_IS_64_BIT 1 - #if POCO_OS == POCO_OS_LINUX || POCO_OS == POCO_OS_FREE_BSD || POCO_OS == POCO_OS_ANDROID + #if POCO_OS == POCO_OS_LINUX || POCO_OS == POCO_OS_FREE_BSD || POCO_OS == POCO_OS_ANDROID || POCO_OS == POCO_OS_AIX #define POCO_INT64_IS_LONG 1 #endif #endif diff --git a/NetSSL_OpenSSL/Makefile b/NetSSL_OpenSSL/Makefile index 8fd4537ba..af173f613 100644 --- a/NetSSL_OpenSSL/Makefile +++ b/NetSSL_OpenSSL/Makefile @@ -5,8 +5,11 @@ # include $(POCO_BASE)/build/rules/global - +ifeq ($(findstring AIX, $(POCO_CONFIG)), AIX) +SYSLIBS += -lssl_a -lcrypto_a +else SYSLIBS += -lssl -lcrypto +endif objects = AcceptCertificateHandler RejectCertificateHandler ConsoleCertificateHandler \ CertificateHandlerFactory CertificateHandlerFactoryMgr \ diff --git a/NetSSL_OpenSSL/samples/HTTPSTimeServer/Makefile b/NetSSL_OpenSSL/samples/HTTPSTimeServer/Makefile index 41db06f54..b2b413fa7 100644 --- a/NetSSL_OpenSSL/samples/HTTPSTimeServer/Makefile +++ b/NetSSL_OpenSSL/samples/HTTPSTimeServer/Makefile @@ -13,9 +13,13 @@ else ifeq ($(POCO_CONFIG),QNX) SYSLIBS += -lssl -lcrypto -lz else +ifeq ($(findstring AIX, $(POCO_CONFIG)), AIX) +SYSLIBS += -lssl_a -lcrypto_a -lz -ldl +else SYSLIBS += -lssl -lcrypto -lz -ldl endif endif +endif objects = HTTPSTimeServer diff --git a/NetSSL_OpenSSL/samples/Mail/Makefile b/NetSSL_OpenSSL/samples/Mail/Makefile index d1201f434..a001a0660 100644 --- a/NetSSL_OpenSSL/samples/Mail/Makefile +++ b/NetSSL_OpenSSL/samples/Mail/Makefile @@ -13,9 +13,13 @@ else ifeq ($(POCO_CONFIG),QNX) SYSLIBS += -lssl -lcrypto -lz else +ifeq ($(findstring AIX, $(POCO_CONFIG)), AIX) +SYSLIBS += -lssl_a -lcrypto_a -lz -ldl +else SYSLIBS += -lssl -lcrypto -lz -ldl endif endif +endif objects = Mail diff --git a/NetSSL_OpenSSL/samples/SetSourceIP/Makefile b/NetSSL_OpenSSL/samples/SetSourceIP/Makefile index e37076444..540713f70 100644 --- a/NetSSL_OpenSSL/samples/SetSourceIP/Makefile +++ b/NetSSL_OpenSSL/samples/SetSourceIP/Makefile @@ -10,8 +10,12 @@ include $(POCO_BASE)/build/rules/global ifeq ($(POCO_CONFIG),FreeBSD) SYSLIBS += -lssl -lcrypto -lz else +ifeq ($(findstring AIX, $(POCO_CONFIG)), AIX) +SYSLIBS += -lssl_a -lcrypto_a -lz -ldl +else SYSLIBS += -lssl -lcrypto -lz -ldl endif +endif objects = SetSourceIP diff --git a/NetSSL_OpenSSL/samples/TwitterClient/Makefile b/NetSSL_OpenSSL/samples/TwitterClient/Makefile index 86523cfd2..c1a0e5599 100644 --- a/NetSSL_OpenSSL/samples/TwitterClient/Makefile +++ b/NetSSL_OpenSSL/samples/TwitterClient/Makefile @@ -13,9 +13,13 @@ else ifeq ($(POCO_CONFIG),QNX) SYSLIBS += -lssl -lcrypto -lz else +ifeq ($(findstring AIX, $(POCO_CONFIG)), AIX) +SYSLIBS += -lssl_a -lcrypto_a -lz -ldl +else SYSLIBS += -lssl -lcrypto -lz -ldl endif endif +endif objects = Twitter TweetApp diff --git a/NetSSL_OpenSSL/samples/download/Makefile b/NetSSL_OpenSSL/samples/download/Makefile index c4631aad0..1fd0a4400 100644 --- a/NetSSL_OpenSSL/samples/download/Makefile +++ b/NetSSL_OpenSSL/samples/download/Makefile @@ -13,9 +13,13 @@ else ifeq ($(POCO_CONFIG),QNX) SYSLIBS += -lssl -lcrypto -lz else +ifeq ($(findstring AIX, $(POCO_CONFIG)), AIX) +SYSLIBS += -lssl_a -lcrypto_a -lz -ldl +else SYSLIBS += -lssl -lcrypto -lz -ldl endif endif +endif objects = download diff --git a/NetSSL_OpenSSL/testsuite/Makefile b/NetSSL_OpenSSL/testsuite/Makefile index a109b3c7f..6987638d7 100644 --- a/NetSSL_OpenSSL/testsuite/Makefile +++ b/NetSSL_OpenSSL/testsuite/Makefile @@ -13,9 +13,13 @@ else ifeq ($(POCO_CONFIG),QNX) SYSLIBS += -lssl -lcrypto -lz else +ifeq ($(findstring AIX, $(POCO_CONFIG)), AIX) +SYSLIBS += -lssl_a -lcrypto_a -lz -ldl +else SYSLIBS += -lssl -lcrypto -lz -ldl endif endif +endif objects = NetSSLTestSuite Driver \ HTTPSClientSessionTest HTTPSClientTestSuite HTTPSServerTest HTTPSServerTestSuite \ diff --git a/build/config/AIX-GCC b/build/config/AIX-GCC new file mode 100644 index 000000000..d039e8ac8 --- /dev/null +++ b/build/config/AIX-GCC @@ -0,0 +1,82 @@ +# +# AIX-GCC +# +# Make settings for AIX6.x/gcc 5.5 +# +# + +# +# General Settings +# +LINKMODE ?= SHARED + +SANITIZEFLAGS ?= + +# +# Define Tools +# +CC = ${CROSS_COMPILE}gcc +CXX = ${CROSS_COMPILE}g++ +LINK = $(CXX) +LIB = $(CROSS_COMPILE)ar -cr -X32_64 +RANLIB = $(CROSS_COMPILE)ranlib +## Please note: AIX does NOT have library versioning per se (there is no 'SONAME' capability). +SHLIB = $(CXX) $(LDFLAGS) -shared -Wl,-bexpfull -o $@ +SHLIBLN = $(POCO_BASE)/build/script/shlibln +STRIP = $(CROSS_COMPILE)strip -X32_64 +DEP = $(POCO_BASE)/build/script/makedepend.gcc +SHELL = sh +RM = rm -rf +CP = cp +MKDIR = mkdir -p +LDFLAGS += -Wl,-bbigtoc + +## http://www.ibm.com/developerworks/aix/library/au-gnu.html: +## > "/Using -brtl, the AIX linker will look for libraries with both the .a and +## > .so extensions, such as libfoo.a and libfoo.so. +## > Without -brtl, the AIX linker looks only for libfoo.a +# +# Extension for Shared Libraries +# +SHAREDLIBEXT = .so.$(target_version) +SHAREDLIBLINKEXT = .a + +# +# Compiler and Linker Flags +# +CFLAGS = $(SANITIZEFLAGS) -std=c11 +CFLAGS32 = -maix32 +CFLAGS64 = -maix64 +CXXFLAGS = $(SANITIZEFLAGS) -std=c++14 -Wno-sign-compare +CXXFLAGS32 = -maix32 +CXXFLAGS64 = -maix64 +SHLIBFLAGS = -Wl,-bh:5 -Wl,-bnoipath -Wl,-blibpath:/usr/lib:/lib -Wl,-blibsuff:so -Wl,-bautoexp -Wl,-bnoentry -Wl,-bM:SRE +SHLIBFLAGS32 = -maix32 +SHLIBFLAGS64 = -maix64 +LINKFLAGS = $(SANITIZEFLAGS) -Wl,-bh:5 -Wl,-bnoipath -Wl,-blibpath:/usr/lib:/lib -Wl,-blibsuff:so -Wl,-brtl +LINKFLAGS32 = -maix32 +LINKFLAGS64 = -maix64 +STATICOPT_CC = +STATICOPT_CXX = +STATICOPT_LINK = +SHAREDOPT_CC = -fPIC +SHAREDOPT_CXX = -fPIC +SHAREDOPT_LINK = +DEBUGOPT_CC = -g -D_DEBUG +DEBUGOPT_CXX = -g -D_DEBUG +DEBUGOPT_LINK = -g +RELEASEOPT_CC = -O2 -DNDEBUG +RELEASEOPT_CXX = -O2 -DNDEBUG +RELEASEOPT_LINK = -O2 + +# +# System Specific Flags +# +# Please note: add -v flag : print out how gcc performs compilation on the screen. +# see https://github.com/pocoproject/poco/issues/3795 +SYSFLAGS = -D_REENTRANT -D_THREAD_SAFE -D__STDC_FORMAT_MACROS +# +# System Specific Libraries +# +# -pthread is just that it should always be passed for a program using threads on AIX. -lpthread is not enough most of the time +SYSLIBS = -pthread -latomic -ldl