NetBSD Problem Report #52455

From www@NetBSD.org  Wed Aug  2 13:54:13 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 86BC07A172
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  2 Aug 2017 13:54:13 +0000 (UTC)
Message-Id: <20170802135412.81C4D7A26E@mollari.NetBSD.org>
Date: Wed,  2 Aug 2017 13:54:12 +0000 (UTC)
From: william@welliver.org
Reply-To: william@welliver.org
To: gnats-bugs@NetBSD.org
Subject: lang/oracle-jdk8 and lang/oracle-jre8 don't declare buildlink3 library paths
X-Send-Pr-Version: www-1.0

>Number:         52455
>Category:       pkg
>Synopsis:       lang/oracle-jdk8 and lang/oracle-jre8 don't declare buildlink3 library paths
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bsiegert
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 02 13:55:00 +0000 2017
>Closed-Date:    Thu Apr 05 09:15:00 +0000 2018
>Last-Modified:  Thu Apr 05 09:15:00 +0000 2018
>Originator:     William Welliver
>Release:        pkgsrc trunk 20170802
>Organization:
N/A
>Environment:
Linux pkgsrc-pbulk.local 3.10.0 BrandZ virtual linux x86_64 x86_64 x86_64 GNU/Linux
>Description:
Oracle JDK8 and JRE8 provide libraries for linking a JVM in order to provide a C-language interface to the JVM (called JNI). These libraries are in a non-standard location, so the buildlink3.mk file would need to specify them in order for packages to be able to link properly against them. Currently, this isn't included in the buildlink3.mk file, so packages that do detect their location won't be able to actually use them as the compiler wrappers will remove any -L and -rpath args.




>How-To-Repeat:
Attempt to link a program against -ljvm and friends. Even if the proper locations are included, cwrappers will remove the arguments that specify them.
>Fix:
This patch allows the java shared libraries to be linked. A variant of this patch also likely applies to oracle-jdk8/jre8.

[root@pkgsrc-pbulk oracle-jre8]# diff buildlink3.mk.orig buildlink3.mk
21a22,25
> LIBDIR_ARCH=    ${MACHINE_ARCH:S/x86_64/amd64/:S/sparc64/sparcv9/:C/^e?arm.*$/arm/}
> BUILDLINK_LIBDIRS.openjre8+=java/oracle-8/jre/lib/${LIBDIR_ARCH}/server
> BUILDLINK_LIBDIRS.openjre8+=java/oracle-8/jre/lib/${LIBDIR_ARCH}
>

[root@pkgsrc-pbulk oracle-jdk8]# diff buildlink3.mk.orig buildlink3.mk
30a31,34
> LIBDIR_ARCH=    ${MACHINE_ARCH:S/x86_64/amd64/:S/sparc64/sparcv9/:C/^e?arm.*$/arm/}
> BUILDLINK_LIBDIRS.openjdk8+=java/oracle-8/jre/lib/${LIBDIR_ARCH}/server
> BUILDLINK_LIBDIRS.openjdk8+=java/oracle-8/jre/lib/${LIBDIR_ARCH}
> 

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->bsiegert
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Thu, 03 Aug 2017 12:51:56 +0000
Responsible-Changed-Why:
take


State-Changed-From-To: open->feedback
State-Changed-By: bsiegert@NetBSD.org
State-Changed-When: Thu, 03 Aug 2017 12:51:56 +0000
State-Changed-Why:
Please answer the questions I sent.


From: Benny Siegert <bsiegert@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@netbsd.org,
 gnats-admin@netbsd.org,
 pkgsrc-bugs@netbsd.org
Subject: Re: pkg/52455: lang/oracle-jdk8 and lang/oracle-jre8 don't declare
 buildlink3 library paths
Date: Thu, 3 Aug 2017 14:50:50 +0200

 > [root@pkgsrc-pbulk oracle-jre8]# diff buildlink3.mk.orig buildlink3.mk
 > 21a22,25
 >> LIBDIR_ARCH=3D    =
 ${MACHINE_ARCH:S/x86_64/amd64/:S/sparc64/sparcv9/:C/^e?arm.*$/arm/}
 >> =
 BUILDLINK_LIBDIRS.openjre8+=3Djava/oracle-8/jre/lib/${LIBDIR_ARCH}/server
 >> BUILDLINK_LIBDIRS.openjre8+=3Djava/oracle-8/jre/lib/${LIBDIR_ARCH}

 This should be BUILDLINK_LIBDIRS.oracle-jre8, I suppose?
 Also, according to the PLIST, the directory is =
 java/oracle-8/lib/${LIBDIR_ARCH} (no jre). And on macOS, there is no =
 arch directory. I don=E2=80=99t know buildlink well enough to judge if =
 it is OK to give nonexistent directories here.


 > [root@pkgsrc-pbulk oracle-jdk8]# diff buildlink3.mk.orig buildlink3.mk
 > 30a31,34
 >> LIBDIR_ARCH=3D    =
 ${MACHINE_ARCH:S/x86_64/amd64/:S/sparc64/sparcv9/:C/^e?arm.*$/arm/}
 >> =
 BUILDLINK_LIBDIRS.openjdk8+=3Djava/oracle-8/jre/lib/${LIBDIR_ARCH}/server
 >> BUILDLINK_LIBDIRS.openjdk8+=3Djava/oracle-8/jre/lib/${LIBDIR_ARCH}

 According to its PLIST, the lib subdirectory here does not contain =
 libjvm, is this needed at all?

 =E2=80=94Benny.=

From: "H. William Welliver III" <william@welliver.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/52455: lang/oracle-jdk8 and lang/oracle-jre8 don't declare
 buildlink3 library paths
Date: Thu, 3 Aug 2017 09:46:40 -0400

 Hi,

 >> [root@pkgsrc-pbulk oracle-jre8]# diff buildlink3.mk.orig =
 buildlink3.mk
 >> 21a22,25
 >>> LIBDIR_ARCH=3D3D    =3D
 > ${MACHINE_ARCH:S/x86_64/amd64/:S/sparc64/sparcv9/:C/^e?arm.*$/arm/}
 >>> =3D
 > =
 BUILDLINK_LIBDIRS.openjre8+=3D3Djava/oracle-8/jre/lib/${LIBDIR_ARCH}/serve=
 r
 >>> BUILDLINK_LIBDIRS.openjre8+=3D3Djava/oracle-8/jre/lib/${LIBDIR_ARCH}
 >=20
 > This should be BUILDLINK_LIBDIRS.oracle-jre8, I suppose?

 Yes, that=E2=80=99s clearly incorrect. I=E2=80=99m not sure how I even =
 managed that. Sorry for the confusion; I can=E2=80=99t even find that =
 sequence in my local copy.

 > Also, according to the PLIST, the directory is =3D
 > java/oracle-8/lib/${LIBDIR_ARCH} (no jre). And on macOS, there is no =3D=

 > arch directory. I don=3DE2=3D80=3D99t know buildlink well enough to =
 judge if =3D
 > it is OK to give nonexistent directories here.

 When I built the oracle-jdk8 package, it required the oracle-jre8 =
 package to be installed first, and the Makefiles seemed to imply that =
 they were common files, though after looking at the installed data, jre =
 is just a symbolic link to the oracle-8 directory. That makes sense, I =
 suppose, since software that embeds the jvm typically looks for these =
 files under jre/. I assume the symlink is why the directory structure =
 isn=E2=80=99t reflected in the PLIST.

 I have been using the system JavaVM framework for java access on macOS, =
 so I can=E2=80=99t comment from personal experience (I specifically =
 exclude mk/java-vm.mk on Darwin for this reason). It=E2=80=99s unclear =
 that the oracle-jdk8 package can even be built on macOS, as Oracle only =
 seems to distributes the JDK as a DMG file, and the Makefile requires a =
 .tar.gz file. If I get some free time I may look into this a bit =
 further.

 In the process of arriving at this solution, I had a series of incorrect =
 paths specified as part of BUILDLINK_LIBDIRS and no harm seemed to come =
 from it.  It would obviously be better to not include paths that don=E2=80=
 =99t exist, but based on my read of the buildlink3 code, it probably =
 doesn=E2=80=99t hurt to have them. I think the macOS portion of the port =
 will likely need some closer attention, so perhaps this could be an =
 acceptable intermediate step?

 >=20
 >> [root@pkgsrc-pbulk oracle-jdk8]# diff buildlink3.mk.orig =
 buildlink3.mk
 >> 30a31,34
 >>> LIBDIR_ARCH=3D3D    =3D
 > ${MACHINE_ARCH:S/x86_64/amd64/:S/sparc64/sparcv9/:C/^e?arm.*$/arm/}
 >>> =3D
 > =
 BUILDLINK_LIBDIRS.openjdk8+=3D3Djava/oracle-8/jre/lib/${LIBDIR_ARCH}/serve=
 r
 >>> BUILDLINK_LIBDIRS.openjdk8+=3D3Djava/oracle-8/jre/lib/${LIBDIR_ARCH}
 >=20
 > According to its PLIST, the lib subdirectory here does not contain =3D
 > libjvm, is this needed at all?

 Yes, it=E2=80=99s needed because there are dependent libs that are =
 required (libjvm -> libverify + libzip + libjava, etc).



 > =3DE2=3D80=3D94Benny.=3D
 >=20

From: "H. William Welliver III" <william@welliver.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/52455: lang/oracle-jdk8 and lang/oracle-jre8 don't declare
 buildlink3 library paths
Date: Thu, 3 Aug 2017 19:22:23 -0400

 I spent some time digging further into the situation and it seems that =
 there=E2=80=99s no support for macOS in oracle-jdk8, and it probably =
 wouldn=E2=80=99t make sense. The idk for macOS is only supplied as a DMG =
 file, with a macOS installer package inside. The contents of JAVA_HOME =
 can be extracted from that package, but honestly it doesn=E2=80=99t seem =
 like the right approach=E2=80=A6 installing the macOS package natively =
 makes it available for everyone and there _is_ support in builtin.mk for =
 detecting the native install (thought it needs a little work).

 At this point, I think the best solution (if it=E2=80=99s feasible) =
 would be to close this PR; I can clean up my changes and submit a new =
 one that solves this problem in a more all-encompassing manner.

 Bill=

From: Benny Siegert <bsiegert@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: Benny Siegert <bsiegert@NetBSD.org>,
 gnats-admin@netbsd.org,
 pkgsrc-bugs@netbsd.org,
 william@welliver.org
Subject: Re: pkg/52455: lang/oracle-jdk8 and lang/oracle-jre8 don't declare
 buildlink3 library paths
Date: Fri, 4 Aug 2017 11:00:55 +0200

 > At this point, I think the best solution (if it=E2=80=99s feasible) =
 > would be to close this PR; I can clean up my changes and submit a new =
 > one that solves this problem in a more all-encompassing manner.

 No need to; just send new patches as a follow-up to this PR.

State-Changed-From-To: feedback->closed
State-Changed-By: bsiegert@NetBSD.org
State-Changed-When: Thu, 05 Apr 2018 09:15:00 +0000
State-Changed-Why:
Feedback timeout; submitter wanted this closed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.