From 7510860a8051cf2570e24581e9438f1762518e44 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Tue, 5 Nov 2024 12:28:37 +0000 Subject: [PATCH] Patches for building on AIX --- CMakeLists.txt | 7 +++++++ cmake/opentelemetry-proto.cmake | 3 ++- cmake/tools.cmake | 4 ++++ .../sdk/resource/semantic_conventions.h | 13 +++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0710834bf..ec46f759b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,13 @@ else() elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) set(ARCH x86) endif() + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc") + # AIX will report the processor as 'powerpc' even if building in 64-bit mode + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(ARCH ppc64) + else() + set(ARCH ppc32) + endif() elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)") set(ARCH arm64) diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake index fa6e185c13..30da0aee16 100644 --- a/cmake/opentelemetry-proto.cmake +++ b/cmake/opentelemetry-proto.cmake @@ -348,7 +348,8 @@ if(WITH_OTLP_GRPC) target_link_libraries(opentelemetry_proto_grpc PUBLIC opentelemetry_proto) get_target_property(grpc_lib_type gRPC::grpc++ TYPE) - if(grpc_lib_type STREQUAL "SHARED_LIBRARY") + get_target_property(opentelemetry_proto_grpc_lib_type opentelemetry_proto_grpc TYPE) + if ((grpc_lib_type STREQUAL "SHARED_LIBRARY") OR (opentelemetry_proto_grpc_lib_type STREQUAL "SHARED_LIBRARY")) target_link_libraries(opentelemetry_proto_grpc PUBLIC gRPC::grpc++) endif() set_target_properties(opentelemetry_proto_grpc PROPERTIES EXPORT_NAME diff --git a/cmake/tools.cmake b/cmake/tools.cmake index 43c1a7b43f..d01257d386 100644 --- a/cmake/tools.cmake +++ b/cmake/tools.cmake @@ -160,6 +160,10 @@ function(project_build_tools_patch_default_imported_config) if(IS_ALIAS_TARGET) continue() endif() + get_target_property(IS_ALIASED_TARGET ${TARGET_NAME} ALIASED_TARGET) + if (IS_ALIASED_TARGET) + continue() + endif() if(CMAKE_VERSION VERSION_LESS "3.19.0") get_target_property(TARGET_TYPE_NAME ${TARGET_NAME} TYPE) diff --git a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h index 9ff985be4d..fd67abc560 100644 --- a/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h +++ b/sdk/include/opentelemetry/sdk/resource/semantic_conventions.h @@ -13,6 +13,19 @@ #include "opentelemetry/common/macros.h" #include "opentelemetry/version.h" +/* + * Special considerations for HostArchValues + * + * The sys/systemcfg.h header on AIX is known to define an IA64 macro, + * which collides with HostArchValues::IA64. + */ +#ifdef _AIX +# ifdef IA64 +# pragma message "Removing define on IA64" +# undef IA64 +# endif +#endif + OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk {