JDK-8222760 : Build fails on - "error: ignoring return value of ���write���
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 11.0.2
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86_64
  • Submitted: 2019-04-17
  • Updated: 2019-04-30
  • Resolved: 2019-04-30
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
System: Generic
OS: Linux (Ubuntu 18.04 LTS)
Java Runtime Information: OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)

A DESCRIPTION OF THE PROBLEM :
Steps to reproduce 
1. clone the OpenJDK 11
2. Configure with following switches:
./configure --with-jvm-variants=minimal --with-debug-level=release  --with-native-debug-symbols=zipped \
--with-native-debug-symbols=zipped --enable-unlimited-crypto --with-stdc++lib=dynamic
3. make

OUTPUT:

sudo make
Building target 'default (exploded-image)' in configuration 'linux-x86_64-normal-minimal-release'
Updating support/modules_libs/java.base/minimal/libjvm.so due to makefile changes
Updating hotspot/variant-minimal/libjvm/gtest/libjvm.so due to makefile changes
Updating hotspot/variant-minimal/libjvm/gtest/gtestLauncher due to makefile changes
Updating support/modules_libs/java.base/libverify.so due to makefile changes
Updating support/modules_libs/java.base/libjava.so due to makefile changes
Updating support/native/java.base/libfdlibm.a due to makefile changes
Updating support/modules_libs/java.base/libzip.so due to makefile changes
Updating support/modules_libs/java.base/libjimage.so due to makefile changes
Updating support/modules_libs/java.base/jli/libjli.so due to makefile changes
Updating support/modules_libs/java.base/libnet.so due to makefile changes
Updating support/modules_libs/java.base/libnio.so due to makefile changes
Updating support/modules_libs/java.base/libjsig.so due to makefile changes
Updating support/modules_libs/java.prefs/libprefs.so due to makefile changes
Updating support/modules_libs/java.rmi/librmi.so due to makefile changes
Updating support/modules_cmds/java.rmi/rmid due to makefile changes
Updating support/modules_cmds/java.rmi/rmiregistry due to makefile changes
Updating support/modules_libs/java.management/libmanagement.so due to makefile changes
Updating support/modules_libs/java.instrument/libinstrument.so due to makefile changes
Creating support/modules_cmds/java.scripting/jrunscript from 1 file(s)
Creating support/native/java.base/java_objs/java from 0 file(s)
Creating support/modules_cmds/java.base/keytool from 0 file(s)
Creating support/modules_libs/java.base/jexec from 0 file(s)
Creating support/modules_libs/java.base/jspawnhelper from 0 file(s)
Creating support/modules_libs/java.security.jgss/libj2gss.so from 3 file(s)
Creating support/modules_libs/java.smartcardio/libj2pcsc.so from 2 file(s)
Updating support/modules_libs/java.desktop/libmlib_image.so due to makefile changes
Updating support/modules_libs/java.desktop/libawt.so due to makefile changes
Updating support/modules_libs/java.desktop/libawt_xawt.so due to makefile changes
Updating support/modules_libs/java.desktop/liblcms.so due to makefile changes
*******jdk11u-dev/src/java.base/unix/native/jspawnhelper/jspawnhelper.c: In function ������error������:
*******jdk11u-dev/src/java.base/unix/native/jspawnhelper/jspawnhelper.c:52:5: error: ignoring return value of ������write������, declared with attribute warn_unused_result [-Werror=unused-result]
     write (fd, &err, sizeof(err));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Updating support/modules_libs/java.desktop/libjavajpeg.so due to makefile changes
Updating support/modules_libs/java.desktop/libawt_headless.so due to makefile changes
Updating support/modules_libs/java.desktop/libfontmanager.so due to makefile changes
cc1: all warnings being treated as errors
Updating support/modules_libs/java.desktop/libjawt.so due to makefile changes
Updating support/modules_libs/java.desktop/libsplashscreen.so due to makefile changes
Launcher-java.base.gmk:94: recipe for target '*******/jdk11u-dev/build/linux-x86_64-normal-minimal-release/support/native/java.base/jspawnhelper/jspawnhelper.o' failed
make[3]: *** [******/jdk11u-dev/build/linux-x86_64-normal-minimal-release/support/native/java.base/jspawnhelper/jspawnhelper.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [java.base-launchers] Error 2
make[2]: *** Waiting for unfinished jobs....
make/Main.gmk:226: recipe for target 'java.base-launchers' failed
Updating support/modules_libs/java.desktop/libjsound.so due to makefile changes

ERROR: Build failed for target 'default (exploded-image)' in configuration 'linux-x86_64-normal-minimal-release' (exit code 2) 

=== Output from failing command(s) repeated here ===
* For target support_native_java.base_jspawnhelper_jspawnhelper.o:
******/jdk11u-dev/src/java.base/unix/native/jspawnhelper/jspawnhelper.c: In function ������error������:
******/jdk11u-dev/src/java.base/unix/native/jspawnhelper/jspawnhelper.c:52:5: error: ignoring return value of ������write������, declared with attribute warn_unused_result [-Werror=unused-result]
     write (fd, &err, sizeof(err));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

* All command lines available in ******/jdk11u-dev/build/linux-x86_64-normal-minimal-release/make-support/failure-logs.
=== End of repeated output ===

=== Make failed targets repeated here ===
Launcher-java.base.gmk:94: recipe for target '******/jdk11u-dev/build/linux-x86_64-normal-minimal-release/support/native/java.base/jspawnhelper/jspawnhelper.o' failed
make/Main.gmk:226: recipe for target 'java.base-launchers' failed
=== End of repeated output ===

Hint: Try searching the build log for the name of the first failed target.
Hint: See doc/building.html#troubleshooting for assistance.

******/jdk11u-dev/make/Init.gmk:300: recipe for target 'main' failed
make[1]: *** [main] Error 2
******/jdk11u-dev/make/Init.gmk:186: recipe for target 'default' failed
make: *** [default] Error 2




Comments
The issue has been resolved in JDK 12. See 8213017
30-04-2019

jspawnhelper relates to java.lang.System.exec functionality. I suspect this is simply an issue with the compiler version being used. What was the compiler version?
19-04-2019

Error code on Launcher-java.base.gmk:94 == ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx solaris aix), ) 94 $(eval $(call SetupJdkExecutable, BUILD_JSPAWNHELPER, \ <== error here 95 NAME := jspawnhelper, \ We can also see *******jdk11u-dev/src/java.base/unix/native/jspawnhelper/jspawnhelper.c: In function �������error��������: *******jdk11u-dev/src/java.base/unix/native/jspawnhelper/jspawnhelper.c:52:5: error: ignoring return value of �������write��������, declared with attribute warn_unused_result [-Werror=unused-result] write (fd, &err, sizeof(err)); This is resulted due to "cc1: all warnings being treated as errors." error: ignoring return value of �������write��������, declared with attribute warn_unused_result [-Werror=unused-result] write (fd, &err, sizeof(err));
19-04-2019