Skip to content

Commit 84e07bb

Browse files
committed
Fix[buildjdk,patches]: properly add static stdc++ compilation
1 parent 56e53e3 commit 84e07bb

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

buildjdk.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ bash ./configure \
126126
--with-freetype-lib=$FREETYPE_DIR/lib \
127127
--with-toolchain-type=clang \
128128
--with-sysroot=$TOOLCHAIN/sysroot \
129+
--with-stdc++lib=static \
129130
--with-freetype-include=$FREETYPE_DIR/include/freetype2 \
130131
$AUTOCONF_x11arg $AUTOCONF_EXTRA_ARGS \
131132
--x-libraries=/usr/lib \

patches/jdk8u_android.diff

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@ index 0e29abe8f8..856d8c7d06 100644
14071407
+# statically link libc++.so, work with gcc but ignored by g++
14081408
+# STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
14091409
+
1410-
+STATIC_STDCXX = -Wl,-Bstatic -lsupc++ -Wl,-Bdynamic
1410+
+STATIC_STDCXX = -Wl,-Bstatic -static-libstdc++ -Wl,-Bdynamic
14111411
# While the VM needs the above line, adlc needs a separate setting:
14121412
ADLC_STATIC_STDCXX = -static-libstdc++
14131413

@@ -61060,3 +61060,29 @@ index fbfdedfd..98f4f7f2 100644
6106061060
Java_sun_tools_attach_LinuxVirtualMachine_sendQuitTo;
6106161061
Java_sun_tools_attach_LinuxVirtualMachine_sendQuitToChildrenOf;
6106261062
Java_sun_tools_attach_LinuxVirtualMachine_socket;
61063+
diff --git a/common/autoconf/libraries.m4 b/common/autoconf/libraries.m4
61064+
index 6efae578..aad2302a 100644
61065+
--- a/common/autoconf/libraries.m4
61066+
+++ b/common/autoconf/libraries.m4
61067+
@@ -945,7 +945,7 @@ AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIBSTDCPP],
61068+
61069+
# Test if stdc++ can be linked statically.
61070+
AC_MSG_CHECKING([if static link of stdc++ is possible])
61071+
- STATIC_STDCXX_FLAGS="-Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic"
61072+
+ STATIC_STDCXX_FLAGS="-Wl,-Bstatic -static-libstdc++ -Wl,-Bdynamic"
61073+
AC_LANG_PUSH(C++)
61074+
OLD_LIBS="$LIBS"
61075+
OLD_CXX="$CXX"
61076+
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
61077+
index ad3f7f23..30be20f4 100644
61078+
--- a/common/autoconf/generated-configure.sh
61079+
+++ b/common/autoconf/generated-configure.sh
61080+
@@ -50143,7 +50153,7 @@ $as_echo "$has_dynamic_libstdcxx" >&6; }
61081+
# Test if stdc++ can be linked statically.
61082+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if static link of stdc++ is possible" >&5
61083+
$as_echo_n "checking if static link of stdc++ is possible... " >&6; }
61084+
- STATIC_STDCXX_FLAGS="-Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic"
61085+
+ STATIC_STDCXX_FLAGS="-Wl,-Bstatic -static-libstdc++ -Wl,-Bdynamic"
61086+
ac_ext=cpp
61087+
ac_cpp='$CXXCPP $CPPFLAGS'
61088+
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'

0 commit comments

Comments
 (0)