JDK-8252060 : gstreamer fails to build with gcc 10
  • Type: Bug
  • Component: javafx
  • Sub-Component: media
  • Affected Version: 8u261,openjfx16
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-08-19
  • Updated: 2020-11-24
  • Resolved: 2020-08-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 Other
8u281Fixed openjfx11.0.10Fixed
Related Reports
Blocks :  
Description
Building JavaFX with gcc 10 fails with the following error at link time:

ld: error: rt/modules/javafx.media/build/native/linux/Release/obj/gstreamer-lite/gstreamer/gst/gstallocator.o: multiple definition of 'GST_CAT_CONTEXT'
ld: rt/modules/javafx.media/build/native/linux/Release/obj/gstreamer-lite/gstreamer/gst/gst.o: previous definition here
ld: error: rt/modules/javafx.media/build/native/linux/Release/obj/gstreamer-lite/gstreamer/gst/gstallocator.o: multiple definition of 'GST_CAT_LOCKING'
ld: rt/modules/javafx.media/build/native/linux/Release/obj/gstreamer-lite/gstreamer/gst/gst.o: previous definition here
...

There are, in fact, duplicate definitions of this symbol, and gcc 10 seems to care. I traced it down to the following:

modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gstreamer/gst/gstconfig.h
   162  #ifdef GSTREAMER_LITE
   163    // We using def file to limit export, so not need to export all APIs
   164    #ifndef GST_API
--->   165      #define GST_API
   166    #endif
   167  #else // GSTREAMER_LITE
   168    #ifndef GST_API
   169      #define GST_API GST_EXPORT
   170    #endif
   171  #endif // GSTREAMER_LITE

I did a local build with GST_API defined to GST_EXPORT and it caused was able to compile and link successfully, but I don't know whether that is the right fix (presumably there is some reason we aren't using "extern").

Comments
Changeset: 7a4bd9b2 Author: Alexander Matveev <almatvee@openjdk.org> Date: 2020-08-25 22:02:10 +0000 URL: https://git.openjdk.java.net/jfx/commit/7a4bd9b2
25-08-2020

https://github.com/openjdk/jfx/pull/287
25-08-2020

Defining GST_API to GST_EXPORT fails on Windows (but works on Linux and Mac). Probably a better fix, if it turns out that this is the solution is to only define it to GST_EXPORT when using gcc. Perhaps something like this: --- a/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gstreamer/gst/gstconfig.h +++ b/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gstreamer/gst/gstconfig.h @@ -162,7 +162,11 @@ #ifdef GSTREAMER_LITE // We using def file to limit export, so not need to export all APIs #ifndef GST_API - #define GST_API + #if defined(__GNUC__) + #define GST_API GST_EXPORT + #else + #define GST_API + #endif #endif #else // GSTREAMER_LITE #ifndef GST_API
22-08-2020