jdk9/hs/hotspot make native libs for test build failure both on x86 and aarch64

Dmitry Samersoff dmitry.samersoff at oracle.com
Fri Nov 4 18:27:36 UTC 2016


gcc -Wl,--as-needed flag allows the linker to don't link to shared
library if it think that this library is not necessary.

It can cause an error in some cases e.g. libraries (-lXXX) appears in
command line in wrong order[1].

So I think that explicitly disable as-needed when building tests is a
good idea.

g++ -Wl,--no-as-needed -o test -ldl test.cxx

g++ -Wl,--as-needed -o test -ldl test.cxx

/tmp/ccOqlI4O.o: In function `main':
test.cxx:(.text+0xb7): undefined reference to `dlopen'
collect2: error: ld returned 1 exit status


On 2016-11-04 20:24, Andrew Haley wrote:
> On 04/11/16 17:07, White, Derek wrote:
>> The reason is that dl library isn't found. I think the following change could fix that:
> But why isn't it found?  It should be on your system at /lib/aarch64-linux-gnu/libdl.so.2
> or somesuch.  Or your system wouldn't work.
> Andrew.

Dmitry Samersoff
Oracle Java development team, Saint Petersburg, Russia
* I would love to change the world, but they won't give me the sources.

More information about the hotspot-dev mailing list