Skip to content
This repository was archived by the owner on May 29, 2024. It is now read-only.

Conversation

@johanvos
Copy link

@johanvos johanvos commented Oct 8, 2019

With these changes, the static libs for the core classes can be built for iOS
make java.base-libs java.prefs-libs jdk.crypto.cryptoki-libs jdk.crypto.ec-libs works

$(MNM) $$($1_TARGET) | $(GREP) "__TEXT" | \
$(EGREP) -v "non-external|private extern|__TEXT,__eh_frame" | \
$(SED) -e 's/.* //' > $$(@D)/$$(basename $$(@F)).symbols; \
$(SED) -e 's/.* //' > $$(@D)/$$(basename $$(@F)).symbols || true; \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need || true here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This keeps the build from failing if a specific file does not have any symbols.

@dougxc dougxc assigned olpaw and unassigned olpaw Oct 8, 2019
@dougxc
Copy link
Member

dougxc commented Oct 8, 2019

@bobvandette it would be great if you can review this PR as well.

@bobvandette
Copy link
Contributor

I previously reviewed this patch in the Mobile projects repository and was ok with it there.
These changes do not just add static library support. Most of the changes are adding OpenJDK support of iOS and Android.

The biggest problem with integrating these changes here is that the static changes now conflict with the current set of patches in the labsjdk. There are now two different Makefile variables controlling static building. STATIC_LIB_BUILD and STATIC_BUILD. We are only interested in building the libs and don't want to produce a completely static JDK set of binaries. This patch needs to be updated with this in mind. The functionality that is not related to building libraries needs to be changed from #ifdef STATIC_BUILD to #ifdef FULL_STATIC_BUILD. There are examples of this in the code.

CFLAGS_JDKLIB_EXTRA="$CFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
CXXFLAGS_JDKLIB_EXTRA="$CXXFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
STATIC_LIB_BUILD=true
if test "x$OPENJDK_TARGET_OS" = "xios"; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these three lines.

fi
fi
if test "x$STATIC_BUILD" = xtrue; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these 4 lines.

CFLAGS_JDKLIB_EXTRA="$CFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
CXXFLAGS_JDKLIB_EXTRA="$CXXFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
STATIC_LIB_BUILD=true
if test "x$OPENJDK_TARGET_OS" = "xios"; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these 3 lines

# Check if cups is needed
if test "x$OPENJDK_TARGET_OS" = xwindows; then
if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$STATIC_BUILD" = xtrue; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STATIC_LIB_BUILD instead of STATIC_BUILD

else
AC_MSG_ERROR([--enable-gtest must be either yes or no])
fi
if test "x$OPENJDK_TARGET_OS" = "xios" || test "x$OPENJDK_TARGET_OS" = "xandroid" || test "x$STATIC_BUILD" = "xtrue"; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STATIC_LIB_BUILD instead of STATIC_BUILD

$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)java.symbols \
$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)net.symbols \
$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)nio.symbols \
$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/$(LIBRARY_PREFIX)verify.symbols \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the above ifeq be STATIC_LIB_BUILD && iOS? We don't need .symbols files on any platform other than iOS.

@vjovanov
Copy link
Member

vjovanov commented Oct 8, 2019

@bobvandette what would be necessary for this change to be upstreamed? Our goal would be that all the changes done in this repo can be upstreamed.

@bobvandette
Copy link
Contributor

@bobvandette what would be necessary for this change to be upstreamed? Our goal would be that all the changes done in this repo can be upstreamed.

We are looking at implementing some form of the static library changes upstream. These static changes will most likely be a bit different than what you have today. The current implementation requires two builds of the JDK. We want to do this in a single build. (ie. Build shared and static libraries during a single build).

Adding new supported platforms (iOS and Android) is a bit more complex. I've had discussions with Johan and put him in touch with the folks that handle porting and new platforms for OpenJDK.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement. oca-signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants