diff options
author | Fred Hornsey <hornseyf@objectcomputing.com> | 2020-12-02 21:31:55 -0600 |
---|---|---|
committer | Fred Hornsey <hornseyf@objectcomputing.com> | 2020-12-02 21:45:04 -0600 |
commit | 1c2a17feff1f9cbac974a56f743b73225e3c7b54 (patch) | |
tree | bffb8c3130713d050c71c615e641246912672a0d | |
parent | c62ecd5955c1350fa25f95deb9bce2c81bc70f1c (diff) | |
download | ATCD-1c2a17feff1f9cbac974a56f743b73225e3c7b54.tar.gz |
Fix Issue on Android Where SONAME is Needed
When trying to use CMake imported ACE libraries in a Android Studio
native project, the path the Android loader was trying to use on the
device was the path on the host computer. The solution from online was
to set SONAME on the library files. SONAME (versioned_so) is disabled
for Android currently, because Android Studio doesn't accept so files
with versions after the file extension. Because of this I changed how
SONAME is set to make that possible to forego adding the version. This
shouldn't hurt use cases where this isn't an issue, so I made it so
gnuace always builds like that for Android.
-rw-r--r-- | ACE/include/makeinclude/platform_android.GNU | 12 | ||||
-rw-r--r-- | ACE/include/makeinclude/platform_clang_common.GNU | 2 | ||||
-rw-r--r-- | ACE/include/makeinclude/rules.lib.GNU | 20 | ||||
-rw-r--r-- | ACE/include/makeinclude/wrapper_macros.GNU | 2 |
4 files changed, 21 insertions, 15 deletions
diff --git a/ACE/include/makeinclude/platform_android.GNU b/ACE/include/makeinclude/platform_android.GNU index fd3525162b2..9a2306a6c17 100644 --- a/ACE/include/makeinclude/platform_android.GNU +++ b/ACE/include/makeinclude/platform_android.GNU @@ -19,8 +19,12 @@ PIE ?= -pie #No rwho on Android rwho = 0 -# Android Studio does not seem to recognize so files with versions -versioned_so ?= 0 +# Android Studio does not seem to recognize so files with versions, but if +# trying to add gnuace-built libraries as imported libraries in CMake in a +# Android Studio project, at runtime apparently the Android loader needs the +# SONAME be set to the filename or else it was fail trying to load the so file +# path from the host computer. +versioned_so = 3 # Only try to use clang, unless this is set to 0, then try to use g++ android_force_clang ?= 1 @@ -29,7 +33,7 @@ android_force_clang ?= 1 # As of writing information on ABIs can be found at https://developer.android.com/ndk/guides/abis ifndef ANDROID_ABI - ifdef ANDROID_ARCH # Handle Possiblity of ANDROID_ARCH being passed + ifdef ANDROID_ARCH # Handle possibility of ANDROID_ARCH being passed ifeq ($(ANDROID_ARCH),arm) ANDROID_ABI := armeabi-v7a else @@ -182,7 +186,7 @@ LIBS += -llog ifeq ($(OS), Windows_NT) SHOBJS_FILE = $(VSHDIR)$(MAKEFILE)_object_list.tmp CLEANUP_OBJS += $(SHOBJS_FILE) - define SHLIBBUILD + define SHLIBBUILD $(file >$(SHOBJS_FILE), $^) $(SHR_FILTER) $(SOLINK.cc) $(SO_OUTPUT_FLAG) $@ @$(SHOBJS_FILE) $(LDFLAGS) $(ACE_SHLIBS) $(LIBS) endef diff --git a/ACE/include/makeinclude/platform_clang_common.GNU b/ACE/include/makeinclude/platform_clang_common.GNU index b89b32297cf..efcc8121413 100644 --- a/ACE/include/makeinclude/platform_clang_common.GNU +++ b/ACE/include/makeinclude/platform_clang_common.GNU @@ -50,7 +50,7 @@ templates ?= automatic # If the platform file didn't already set versioned_so, default to 1. versioned_so ?= 1 with_ld ?= -ifeq ($(versioned_so),1) +ifneq ($(versioned_so),0) ifeq ($(with_ld),hpux) SOFLAGS += -Wl,+h -Wl,$(SONAME) else diff --git a/ACE/include/makeinclude/rules.lib.GNU b/ACE/include/makeinclude/rules.lib.GNU index 94868ff0d87..1a84f3d92cd 100644 --- a/ACE/include/makeinclude/rules.lib.GNU +++ b/ACE/include/makeinclude/rules.lib.GNU @@ -1,6 +1,6 @@ # -*- Makefile -*- #---------------------------------------------------------------------------- -# +# # # Build libraries (i.e., contain no binary executables) # GNU version @@ -22,12 +22,12 @@ ifneq ($(versioned_so),0) ifeq ($(SOVERSION),) ifeq ($(versioned_so),1) SOVERSION = .$(GNUACE_PROJECT_VERSION) + else ifeq ($(versioned_so),2) + SOVERSION = -$(GNUACE_PROJECT_VERSION) + else ifeq ($(versioned_so),3) + # Nothing else - ifeq ($(versioned_so),2) - SOVERSION = -$(GNUACE_PROJECT_VERSION) - else - $(error unknown value for versioned_so: $(versioned_so)) - endif + $(error unknown value for versioned_so: $(versioned_so)) endif endif # SOVERSION @@ -36,10 +36,10 @@ ifneq ($(versioned_so),0) ifeq ($(SONAME),) ifeq ($(versioned_so),1) SONAME = $(SHLIB)$(SOVERSION) - else - ifeq ($(versioned_so),2) - SONAME = $(patsubst %.$(SOEXT),%,$(SHLIB))$(SOVERSION).$(SOEXT) - endif + else ifeq ($(versioned_so),2) + SONAME = $(patsubst %.$(SOEXT),%,$(SHLIB))$(SOVERSION).$(SOEXT) + else ifeq ($(versioned_so),3) + SONAME = $(SHLIB) endif endif # SONAME endif # versioned_so diff --git a/ACE/include/makeinclude/wrapper_macros.GNU b/ACE/include/makeinclude/wrapper_macros.GNU index 0966a023d0e..fc5535535dc 100644 --- a/ACE/include/makeinclude/wrapper_macros.GNU +++ b/ACE/include/makeinclude/wrapper_macros.GNU @@ -82,6 +82,8 @@ # the version will be appended to the name but *before* the # $(SOEXT) - it should have a lead '-' - else it defaults to # -ACE_MAJOR.ACE_MINOR.ACE_MICRO. +# If versioned_so is 3, then set the SONAME, but without a +# version. # wfmo Build with wfmo support (Win32 only) # winregistry Build with windows registry support (Win32 only) # winnt Build WinNT-specific projects (Win32 only) |