Review request (XS): 7110396: Sound code fails to build on multiarch Linux systems
Robert Ottenhag
robert.ottenhag at oracle.com
Thu Nov 10 13:16:20 UTC 2011
On 11/10/2011 01:49 PM, Robert Ottenhag wrote:
> On 11/10/2011 06:24 AM, mark.reinhold at oracle.com wrote:
>> Some Linux distros have started to adopt a "multiarch" filesystem
>> layout for
>> shared libraries in order to support the installation of packages for
>> multiple
>> hardware architectures on a single system. For more information see,
>> e.g.,
>> http://wiki.debian.org/Multiarch.
>>
>> In Ubuntu 11.10 the ALSA shared library, libasound2, was converted to
>> the
>> multiarch format and so its files moved from their old location,
>> /usr/lib,
>> to /usr/lib/${ARCH_TRIPLET}. This caused the JDK build to fail when
>> linking
>> the Java sound library. The root cause appears to be that gcc only
>> tries to
>> resolve undefined symbols against a multiarch library if the library
>> is named
>> on the command line after the object files containing those symbols.
>>
>> The fix is simply to move -lasound to the end of the gcc invocation.
>>
>> I'll push this into JDK 8. It would trivially backport to 7.
>>
>> Patch:
>>
>> --- a/make/javax/sound/jsoundalsa/Makefile
>> +++ b/make/javax/sound/jsoundalsa/Makefile
>> @@ -65,7 +65,7 @@
>> $(MIDIFILES_export) \
>> $(PORTFILES_export)
>>
>> -LDFLAGS += -lasound
>> +EXTRA_LIBS += -lasound
>>
>> CPPFLAGS += \
>> -DUSE_DAUDIO=TRUE \
>>
>> Thanks,
>> - Mark
>
> Mark,
>
> The patch is correct, but in order to follow the convention in most
> other makefiles, I advice to use OTHER_LDLIBS instead of EXTRA_LIBS. I
> have tested this patch locally on Ubuntu 11.10-x64 for most branches
> for OpenJDK 6, 7 and 8 and meant to commit it earlier but... please go
> ahead.
>
> Thank
>
> /Robert
>
I am also not entirely convinced that the new multiarch support is the
reason for these failures, although it may trigger it. The specification
for GNU ld is that dependencies on the link line should always be
written left to right, i.e. object files before library files. See also
http://stackoverflow.com/questions/45135/linker-order-gcc/409402#409402.
With that it mind, I would not be surprised if we get similar failures
in the future and that is why I suggest that every linker line without
circular dependencies should be ordered left to right. However, this
will probably be satisfied in the near future as part of the new
build-infra project that is converting each and every native library
Makefile.
/Robert
--
Oracle
Robert Ottenhag | Senior Member of Technical Staff
Phone: +46850630961 | Fax: +46850630911 | Mobile: +46707106161
Oracle Java HotSpot Virtual Machine
ORACLE Sweden | Folkungagatan 122 | SE-116 30 Stockholm
Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no. 556254-6746
Green Oracle
Oracle is committed to developing practices and products that help protect the environment
--
More information about the build-dev
mailing list