United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7110396 Sound code fails to build with gcc 4.6 on multiarch Linux systems
JDK-7110396 : Sound code fails to build with gcc 4.6 on multiarch Linux systems

Details
Type:
Bug
Submit Date:
2011-11-10
Status:
Resolved
Updated Date:
2014-02-05
Project Name:
JDK
Resolved Date:
2012-01-23
Component:
infrastructure
OS:
linux_ubuntu,generic
Sub-Component:
build
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Duplicate:

Sub Tasks

Description
The JDK 8 build fails on Ubuntu 11.10 with gcc 4.6 when linking the
Java sound native library against libasound2, the ALSA shared library.

It appears that in this instance gcc only tries to resolve undefined
symbols against a library if the library is named on the command line
after the object files containing those symbols.  This behavior is in
accordance with the GNU ld specification [1].  On earlier versions of
Ubuntu, however, this link step worked even though the asound library
was named on the gcc command line ahead of the object files that refer
to it.

The fix is simply to move -lasound to the end of the gcc invocation.

This may or may not be related to the conversion of libasound2 to the
multiarch format in Ubuntu 11.10 [2].

[1] http://stackoverflow.com/questions/45135/linker-order-gcc/409402#409402
[2] http://wiki.debian.org/Multiarch

                                    

Comments
SUGGESTED FIX

--- a/make/javax/sound/jsoundalsa/Makefile
+++ b/make/javax/sound/jsoundalsa/Makefile
@@ -65,7 +65,7 @@
        $(MIDIFILES_export) \
        $(PORTFILES_export)
 
-LDFLAGS += -lasound
+OTHER_LDLIBS += -lasound
 
 CPPFLAGS += \
        -DUSE_DAUDIO=TRUE \
                                     
2011-11-10
EVALUATION

Indeed.
                                     
2011-11-10



Hardware and Software, Engineered to Work Together