On Thu, 21 May 2026 09:12:39 GMT, SendaoYan <[email protected]> wrote:

>> Yasumasa Suenaga has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Fix comments
>
> make/devkit/Tools.gmk line 268:
> 
>> 266: ifeq ($(ARCH),x86_64)
>> 267:   # Enable mixed mode.
>> 268:   RPM_ARCHS += i386 i686
> 
> Does this needed after the 32bit x86 has been removed.

Following error happened in GCC build log when I removed them:


/usr/src/jdk/build/devkit/result/x86_64-linux-gnu-to-x86_64-linux-gnu/x86_64-linux-gnu/bin/ld:
 error: cannot find libc.so.6
/usr/src/jdk/build/devkit/result/x86_64-linux-gnu-to-x86_64-linux-gnu/x86_64-linux-gnu/bin/ld:
 error: cannot find ld-linux-x86-64.so.2
collect2: error: ld returned 1 exit status
make[5]: *** [Makefile:1005: libgcc_s.so] Error 1


In Tools.gmk, rewrite to relative path in linker script of libc and libpthread 
to ensure to use libs in sysroot. I'm not sure, but it might attempts to load 
`/usr/lib` rather than `/usr/lib64`. I think it is incorrect because 
`--with-sysroot` would be passed when configure scripts for GCC is run. Thus it 
is not necessary.
We should apply following patch if we want to remove them. It works on my PC 
and JDK binaries which were built with devkit seem to be linked glibc in 
sysroot correctly. I think it implies this patch is correct. However I wonder I 
can merge it to this PR because it does not seem to be another problem.


diff --git a/make/devkit/Tools.gmk b/make/devkit/Tools.gmk
index 1eb0a702747..ffed8ffcb99 100644
--- a/make/devkit/Tools.gmk
+++ b/make/devkit/Tools.gmk
@@ -202,9 +202,6 @@ SRCDIR := $(OUTPUT_ROOT)/src
 # Marker file for unpacking rpms
 RPMS := $(SYSROOT)/rpms_unpacked

-# Need to patch libs that are linker scripts to use non-absolute paths
-LIBS := $(SYSROOT)/libs_patched
-
 
################################################################################
 # Download RPMs
 download-rpms:
@@ -263,12 +260,7 @@ $(foreach dep,$(DEPENDENCIES),$(eval $(call 
DownloadVerify,$(dep))))
 # Unpack RPMS

 RPM_ARCHS := $(ARCH) noarch
-ifeq ($(ARCH),x86_64)
-  # Enable mixed mode.
-  RPM_ARCHS += i386 i686
-else ifeq ($(ARCH),i686)
-  RPM_ARCHS += i386
-else ifeq ($(ARCH), armhfp)
+ifeq ($(ARCH), armhfp)
   RPM_ARCHS += armv7hl
 endif

@@ -298,26 +290,6 @@ endef

 $(foreach p,$(RPM_FILE_LIST),$(eval $(call unrpm,$(p))))

-################################################################################
-
-# Note: MUST create a <sysroot>/usr/lib even if not really needed.
-# gcc will use a path relative to it to resolve lib64. (x86_64).
-# we're creating multi-lib compiler with 32bit libc as well, so we should
-# have it anyway, but just to make sure...
-# Patch libc.so and libpthread.so to force linking against libraries in sysroot
-# and not the ones installed on the build machine.
-$(LIBS) : $(RPMS)
-       @echo Patching libc and pthreads
-       @(for f in `find $(SYSROOT) -name libc.so -o -name libpthread.so`; do \
-         (cat $$f | sed -e 's|/usr/lib64/||g' \
-             -e 's|/usr/lib/||g' \
-             -e 's|/lib64/||g' \
-             -e 's|/lib/||g' ) > $$f.tmp ; \
-         mv $$f.tmp $$f ; \
-       done)
-       @mkdir -p $(SYSROOT)/usr/lib
-       @touch $@
-
 
################################################################################
 # Create links for ffi header files so that they become visible by default 
when using the
 # devkit.
@@ -702,8 +673,7 @@ MISSING_LINKS += $(PREFIX)/lib/bfd-plugins/liblto_plugin.so
 bfdlib : $(BFDLIB)
 binutils : $(BINUTILS)
 rpms : $(RPMS)
-libs : $(LIBS)
-sysroot : rpms libs
+sysroot : rpms
 gcc : sysroot $(GCC) $(GCC_PATCHED)
 gdb : $(GDB)
 all : binutils gcc bfdlib $(PREFIX)/devkit.info $(MISSING_LINKS) 
$(SYSROOT_LINKS) \
@@ -712,4 +682,4 @@ all : binutils gcc bfdlib $(PREFIX)/devkit.info 
$(MISSING_LINKS) $(SYSROOT_LINKS
 # this is only built for host. so separate.
 ccache : $(CCACHE)

-.PHONY : gcc all binutils bfdlib link_libs rpms libs sysroot
+.PHONY : gcc all binutils bfdlib link_libs rpms sysroot

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/31227#discussion_r3286415426

Reply via email to