Opened 9 years ago

Closed 8 years ago

#9426 closed Bug Report (Fixed)

MacOS X symbols missing

Reported by: Nigel Owned by: Stuart Auchterlonie
Priority: minor Milestone: 0.25
Component: Ports - OSX Version: Master Head
Severity: medium Keywords:
Cc: Rob Smith Ticket locked: no

Description

g++ -headerpad_max_install_names -arch i386 -single_module -dynamiclib -L/Volumes/Backups/MythTV/.osx-packager/build/lib -lfreetype -lz -compatibility_version	0.24 -current_version	0.24.0 -install_name	libmythtv-0.24.0.dylib -o libmythtv-0.24.0.24.0.dylib  ...    -L../libmyth -L../../external/FFmpeg/libavutil -L../../external/FFmpeg/libavcodec -L../../external/FFmpeg/libavcore -L../../external/FFmpeg/libavformat -L../../external/FFmpeg/libswscale -L../libmythui -L../libmythupnp -L../libmythdvdnav -L../libmythbluray -L../libmythdb -lmyth-0.24 -lmythswscale -lmythavformat -lmythavcodec -lmythavcore -lmythavutil -lmythui-0.24 -lmythupnp-0.24 -lmythdvdnav-0.24 -lmythbluray-0.24 -lmythdb-0.24 -L../libmythfreemheg -lmythfreemheg-0.24 -L../libmythlivemedia -lmythlivemedia-0.24 -L../libmythhdhomerun -lmythhdhomerun-0.24 -lmp3lame -L/Volumes/Backups/MythTV/.osx-packager/build/lib -lbz2 -lfreetype -L../libmythmpeg2 -lmythmpeg2-0.24 -framework ApplicationServices -framework Carbon -framework Cocoa -framework CoreFoundation -framework CoreVideo -framework QuickTime -framework IOKit -F/Developer/FireWireSDK26/Examples/Framework -framework AVCVideoServices -framework OpenGL -framework AGL -lQtSql -L/Volumes/Backups/MythTV/.osx-packager/build/lib/mysql -F/System/Library/Frameworks -L/usr/lib -lmysqlclient -lz -lm -lQtXml -lQtOpenGL -lQtGui -lQtNetwork -lQtCore  
Undefined symbols:
  "DeleteOSXCocoaPool(void*&)", referenced from:
      PrivateDecoderVDA::VDADecoderCallback(void*, __CFDictionary const*, long, unsigned int, __CVBuffer*)in privatedecoder_vda.o
      PrivateDecoderVDA::VDADecoderCallback(void*, __CFDictionary const*, long, unsigned int, __CVBuffer*)in privatedecoder_vda.o
      PrivateDecoderVDA::GetFrame(AVStream*, AVFrame*, int*, AVPacket*)in privatedecoder_vda.o
  "CreateOSXCocoaPool()", referenced from:
      PrivateDecoderVDA::VDADecoderCallback(void*, __CFDictionary const*, long, unsigned int, __CVBuffer*)in privatedecoder_vda.o
      PrivateDecoderVDA::GetFrame(AVStream*, AVFrame*, int*, AVPacket*)in privatedecoder_vda.o
  "GetNumberXineramaScreens()", referenced from:
      VideoOutWindow::VideoOutWindow()in videooutwindow.o
  "get_float_CF(__CFDictionary const*, __CFString const*)", referenced from:
      VideoOutputQuartz::Init(int, int, float, int, int, int, int, int, MythCodecID, int)in videoout_quartz.o
  "get_int_CF(__CFDictionary const*, __CFString const*)", referenced from:
      VideoOutputQuartz::Init(int, int, float, int, int, int, int, int, MythCodecID, int)in videoout_quartz.o
      VideoOutputQuartz::Init(int, int, float, int, int, int, int, int, MythCodecID, int)in videoout_quartz.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [libmythtv-0.24.0.24.0.dylib] Error 1
make[1]: *** [sub-libmythtv-make_default] Error 2
make: *** [libs] Error 2
[osx-pkg] Failed system call: " /usr/bin/make -j3 " with error code 2
Died at ./osx-packager.pl.latest line 934.

Change History (19)

comment:1 Changed 9 years ago by Nigel

Status: newaccepted

A rebuild reduced that list to:

Undefined symbols:
  "GetNumberXineramaScreens()", referenced from:
      VideoOutWindow::VideoOutWindow()in videooutwindow.o
  "get_float_CF(__CFDictionary const*, __CFString const*)", referenced from:
      VideoOutputQuartz::Init(int, int, float, int, int, int, int, int, MythCodecID, int)in videoout_quartz.o
  "get_int_CF(__CFDictionary const*, __CFString const*)", referenced from:
      VideoOutputQuartz::Init(int, int, float, int, int, int, int, int, MythCodecID, int)in videoout_quartz.o
      VideoOutputQuartz::Init(int, int, float, int, int, int, int, int, MythCodecID, int)in videoout_quartz.o
ld: symbol(s) not found

so, weird library ordering issue?

comment:2 Changed 9 years ago by Nigel

Resolution: Invalid
Status: acceptedclosed

A distclean eliminated the error, so it looks like it was operator stupidity caused by swapping too many times between master and fixes.

comment:3 Changed 9 years ago by Stuart Auchterlonie

Resolution: Invalid
Status: closednew
Version: 0.24-fixesTrunk Head

I think the distclean may have been a fluke. I've been trying to build from a complete clean checkout (including building all the deps) and it's still failing with the above error.

comment:4 Changed 9 years ago by Rob Smith

Cc: Rob Smith added

comment:5 Changed 9 years ago by Rob Smith

I get the same on a entirely clean checkout of master.

comment:6 Changed 9 years ago by Rob Smith

Actually, mine is slightly different

g++ -headerpad_max_install_names -arch i386 -single_module -dynamiclib -L/Users/kormoc/Projects/MythTV/Packaging/OSX/build/.osx-packager/build/lib -lfreetype -lz -compatibility_version	0.24 -current_version	0.24.0 -install_name	libmythtv-0.24.0.dylib -o libmythtv-0.24.0.24.0.dylib minilzo.o RTjpegN.o recordinginfo.o dbcheck.o tvremoteutil.o tv.o jobqueue.o filtermanager.o recordingprofile.o remoteencoder.o videosource.o cardutil.o sourceutil.o videometadatautil.o cc608decoder.o cc608reader.o cc708decoder.o cc708reader.o cc708window.o subtitlereader.o scheduledrecording.o signalmonitorvalue.o livetvchain.o playgroup.o channelsettings.o previewgenerator.o previewgeneratorqueue.o transporteditor.o channelgroup.o channelgroupsettings.o myth_imgconvert.o recordingrule.o programdetail.o mythsystemevent.o avfringbuffer.o ThreadedFileWriter.o ringbuffer.o fileringBuffer.o dvdringbuffer.o bdringbuffer.o streamingringbuffer.o diseqc.o diseqcsettings.o datadirect.o teletextdecoder.o teletextreader.o vbilut.o tspacket.o pespacket.o mpegtables.o atsctables.o dvbtables.o premieretables.o mpegstreamdata.o atscstreamdata.o dvbstreamdata.o scanstreamdata.o mpegdescriptors.o atscdescriptors.o dvbdescriptors.o dishdescriptors.o premieredescriptors.o atsc_huffman.o freesat_huffman.o iso6937tables.o H264Parser.o frequencies.o frequencytables.o channelutil.o dbchannelinfo.o dtvmultiplex.o dtvconfparser.o dtvconfparserhelpers.o scaninfo.o channelimporter.o profilegroup.o tv_play.o mythplayer.o mythdvdplayer.o audioplayer.o playercontext.o tv_play_win.o deletemap.o mythcommflagplayer.o commbreakmap.o mythbdplayer.o mythiowrapper.o tvbrowsehelper.o textsubtitleparser.o xine_demux_sputext.o decoderbase.o nuppeldecoder.o avformatdecoder.o privatedecoder.o privatedecoder_vda.o osd.o teletextscreen.o subtitlescreen.o interactivescreen.o videooutbase.o videoout_null.o videobuffers.o vsync.o jitterometer.o yuv2rgb.o videodisplayprofile.o mythcodecid.o videooutwindow.o util-osd.o videocolourspace.o videoout_quartz.o util-opengl.o openglvideo.o videoout_opengl.o DetectLetterbox.o dsmcc.o dsmcccache.o dsmccbiop.o dsmccobjcarousel.o interactivetv.o mhi.o blend.o channelbase.o dtvchannel.o signalmonitor.o dtvsignalmonitor.o inputinfo.o inputgroupmap.o scanwizard.o channelscan_sm.o channelscanner.o channelscanner_gui.o channelscanner_gui_scan_pane.o channelscanner_cli.o frequencytablesetting.o inputselectorsetting.o loglist.o multiplexsetting.o paneanalog.o scanmonitor.o scanwizardconfig.o eithelper.o eitscanner.o eitfixup.o eitcache.o programdata.o tv_rec.o recorderbase.o DeviceReadBuffer.o dtvrecorder.o importrecorder.o NuppelVideoRecorder.o fifowriter.o audioinput.o channelchangemonitor.o firewirechannel.o firewirerecorder.o firewiresignalmonitor.o firewiredevice.o avcinfo.o darwinfirewiredevice.o darwinavcinfo.o iptvchannel.o iptvrecorder.o iptvsignalmonitor.o iptvchannelfetcher.o iptvmediasink.o iptvfeeder.o iptvfeederwrapper.o iptvfeederrtsp.o iptvfeederudp.o iptvfeederfile.o iptvfeederlive.o iptvfeederrtp.o timeoutedtaskscheduler.o hdhrsignalmonitor.o hdhrchannel.o hdhrrecorder.o hdhrstreamhandler.o moc_jobqueue.o moc_recordingprofile.o moc_videosource.o moc_playgroup.o moc_channelsettings.o moc_previewgenerator.o moc_previewgeneratorqueue.o moc_transporteditor.o moc_channelgroupsettings.o moc_mythsystemevent.o moc_diseqcsettings.o moc_profilegroup.o moc_tv_play.o moc_mythplayer.o moc_playercontext.o moc_tv_play_win.o moc_osd.o moc_scanwizard.o moc_channelscanner_gui.o moc_channelscanner_gui_scan_pane.o moc_inputselectorsetting.o moc_multiplexsetting.o moc_paneatsc.o moc_panedvbutilsimport.o moc_scanmonitor.o moc_scanwizardconfig.o    -L../libmyth -L../../external/FFmpeg/libavutil -L../../external/FFmpeg/libavcodec -L../../external/FFmpeg/libavcore -L../../external/FFmpeg/libavformat -L../../external/FFmpeg/libswscale -L../libmythui -L../libmythupnp -L../libmythdvdnav -L../libmythbluray -L../libmythdb -lmyth-0.24 -lmythswscale -lmythavformat -lmythavcodec -lmythavcore -lmythavutil -lmythui-0.24 -lmythupnp-0.24 -lmythdvdnav-0.24 -lmythbluray-0.24 -lmythdb-0.24 -L../libmythfreemheg -lmythfreemheg-0.24 -L../libmythlivemedia -lmythlivemedia-0.24 -L../libmythhdhomerun -lmythhdhomerun-0.24 -lxml2 -lmp3lame -L/Users/kormoc/Projects/MythTV/Packaging/OSX/build/.osx-packager/build/lib -lbz2 -lfreetype -framework ApplicationServices -framework Carbon -framework Cocoa -framework CoreFoundation -framework CoreVideo -framework QuickTime -framework IOKit -F/Developer/FireWireSDK26/Examples/Framework -framework AVCVideoServices -framework OpenGL -framework AGL -lQtSql -L/Users/kormoc/Projects/MythTV/Packaging/OSX/build/.osx-packager/build/lib/mysql -F/System/Library/Frameworks -L/usr/lib -m32 -lmysqlclient -lz -lm -lQtXml -lQtOpenGL -lQtGui -lQtNetwork -lQtCore  
Undefined symbols:
  "get_int_CF(__CFDictionary const*, __CFString const*)", referenced from:
      VideoOutputQuartz::Init(int, int, float, int, int, int, int, int, MythCodecID, int)in videoout_quartz.o
      VideoOutputQuartz::Init(int, int, float, int, int, int, int, int, MythCodecID, int)in videoout_quartz.o
  "CreateOSXCocoaPool()", referenced from:
      PrivateDecoderVDA::VDADecoderCallback(void*, __CFDictionary const*, long, unsigned int, __CVBuffer*)in privatedecoder_vda.o
      PrivateDecoderVDA::GetFrame(AVStream*, AVFrame*, int*, AVPacket*)in privatedecoder_vda.o
  "get_float_CF(__CFDictionary const*, __CFString const*)", referenced from:
      VideoOutputQuartz::Init(int, int, float, int, int, int, int, int, MythCodecID, int)in videoout_quartz.o
  "DeleteOSXCocoaPool(void*&)", referenced from:
      PrivateDecoderVDA::VDADecoderCallback(void*, __CFDictionary const*, long, unsigned int, __CVBuffer*)in privatedecoder_vda.o
      PrivateDecoderVDA::VDADecoderCallback(void*, __CFDictionary const*, long, unsigned int, __CVBuffer*)in privatedecoder_vda.o
      PrivateDecoderVDA::GetFrame(AVStream*, AVFrame*, int*, AVPacket*)in privatedecoder_vda.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [libmythtv-0.24.0.24.0.dylib] Error 1
make[1]: *** [sub-libmythtv-make_default] Error 2
make: *** [libs] Error 2
[osx-pkg] Failed system call: " /usr/bin/make -j9 " with error code 2
Died at ./osx-packager.pl line 947.

comment:7 in reply to:  6 Changed 9 years ago by Dave Morrison <dave@…>

I tried to comment anonymously, but it's not clear I succeeded. I see the same problem, and I think the cause is that the symbols in question are not being made global - they're just local to libmythui. I modified the definition of get_float_CF (and the others) to look like this:

attribute((visibility("default"))) float get_float_CF(CFDictionaryRef dict, CFStringRef key)

That is, I added "attribute((visibility("default")))". The symbols are then global and can satisfy the dependency appearing in code outside of libmythui.

comment:8 Changed 9 years ago by Stuart Auchterlonie

Milestone: unknown0.25

comment:9 Changed 9 years ago by Stuart Auchterlonie

Owner: changed from Nigel to Stuart Auchterlonie
Status: newaccepted

comment:10 Changed 9 years ago by Stuart Auchterlonie

Resolution: Fixed
Status: acceptedclosed

0.24 doesn't need the symbol visibility changes as we don't have symbol visibility on by default in 0.24. That change was only made in master. This explains why a distclean fixed it for nigel.

Closing as fixed.

Stuart

comment:11 Changed 9 years ago by dave@…

This might have been closed a little prematurely. A bit later in the build this same problem pops up again. Classes or structs contained in other classes are in a nested scope and need to have their symbols declared global too. I hope the diff below is the right way to fix this. Works for me.

diff --git a/mythtv/libs/libmythmetadata/dbaccess.h b/mythtv/libs/libmythmetadata/dbaccess.h
index f653b9e..d738d8a 100644
--- a/mythtv/libs/libmythmetadata/dbaccess.h
+++ b/mythtv/libs/libmythmetadata/dbaccess.h
@@ -135,7 +135,7 @@ class MPUBLIC VideoCastMap : public MultiValue
 class MPUBLIC FileAssociations
 {
   public:
-    struct file_association
+    struct MPUBLIC file_association
     {
         unsigned int id;
         QString extension;
diff --git a/mythtv/libs/libmythmetadata/videometadata.h b/mythtv/libs/libmythmetadata/videometadata.h
index 72f2ce2..8e44315 100644
--- a/mythtv/libs/libmythmetadata/videometadata.h
+++ b/mythtv/libs/libmythmetadata/videometadata.h
@@ -31,7 +31,7 @@ class MPUBLIC VideoMetadata
     typedef std::vector<cast_entry> cast_list;
 
   public:
-    class SortKey
+    class MPUBLIC SortKey
     {
       public:
         SortKey();

comment:12 Changed 9 years ago by Stuart Auchterlonie

I'm not seeing this on Snow Leopard with the current XCode toolset. What is it you are running on?

comment:13 in reply to:  12 Changed 9 years ago by Dave Morrison <dave@…>

Replying to stuarta:

I'm not seeing this on Snow Leopard with the current XCode toolset. What is it you are running on?

10.5.8 with gcc 4.0.1. I see the following in the development notes for gcc 4.2:

C++ visibility handling has been overhauled.

Restricted visiblity is propagated from classes to members, from functions to local statics, and from templates and template arguments to instantiations, unless the latter has explicitly declared visibility.

So if I whip up a little test case, "visible.cpp":

#define MPUBLIC __attribute__((visibility("default")))

struct MPUBLIC outer
{
  outer() {}
  struct inner
  {
    inner() {}
  } in;
};


float g()
{
  outer o;
}

and do this:

$ /usr/bin/g++-4.0 -dynamiclib -o visible.so -fvisibility=hidden visible.cpp && nm visible.so | c++filt | grep inner
00000f80 t outer::inner::inner()

you see that the nested class isn't globally visible. If I do this:

$ /usr/bin/g++-4.2 -dynamiclib -o visible.so -fvisibility=hidden visible.cpp && nm visible.so | c++filt | grep inner
00000f80 T outer::inner::inner()

you can see that the nested class *is* globally visible.

So, FWIW, I think it's due to differences in visibility handling between gcc 4.0 and 4.2.

Unless I'm completely wrong, that is.

comment:14 Changed 9 years ago by Stuart Auchterlonie

Resolution: Fixed
Status: closednew

comment:15 Changed 9 years ago by dgatwood@…

I'm seeing the same problem on the OSX-fixes branch, so it's definitely not just a trunk issue.

Sadly, the build scripts don't respect the CC or CXX environment variables, so the usual fix for these sorts of problems:

export CC=/usr/bin/gcc-4.0
export CXX=/usr/bin/g++-4.0

does nothing.

The patches above, however (the two MPUBLIC additions plus the attribute((visibility("default"))) changes) seem to have gotten past that problem... after I realized that the bug tracking system clobbered it, and that it should be:

__attribute__((visibility("default")))

Still getting this build failure, though:

ld: file not found: /Users/dg/mythtv/.osx-packager/build/lib/libmythswscale.dylib

Grr. After hand-adding links in the right place in the middle of the build process, I now have:

ld: file not found: /Users/dg/mythtv/.osx-packager/build/lib/libmythavformat.dylib

then eventually:

ld: file not found: libmythfreemheg-0.24.0.dylib

and so on. There's something really seriously broken in the Makefiles. All the libraries are getting built, but the lib directory isn't getting populated correctly.

comment:16 Changed 9 years ago by sphery

In 83143c04f8109f4819782393ab3e11d37a371ac2 :

Don't use symbol visibility on ancient GCC.

Only use symbol visibility on GCC 4.2+. GCC 4.0 and 4.1 had symbol-visibility-related bugs when compiling x86_64 code. This will affect very few users, but should allow Mac OS X users whose systems still use old GCC to compile MythTV.

Refs ticket:9426#comment:13

comment:17 Changed 9 years ago by Stuart Auchterlonie

Refs #9426. Symbol visibility fixes for OSX.

Adds MPUBLIC to various functions that are required to be exported from the library.

Thanks to Dave Morrison for the analysis.

Changeset: e5ceb0f17a4f65ff694d7b26ef51a52ad63b171a

comment:18 Changed 9 years ago by Michael T. Dean

Don't use symbol visibility on ancient GCC.

Only use symbol visibility on GCC 4.2+. GCC 4.0 and 4.1 had symbol-visibility-related bugs when compiling x86_64 code. This will affect very few users, but should allow Mac OS X users whose systems still use old GCC to compile MythTV.

Refs #9426:comment:13

Changeset: 83143c04f8109f4819782393ab3e11d37a371ac2

comment:19 Changed 8 years ago by Raymond Wagner

Resolution: Fixed
Status: newclosed

Closing this one, as it appears to be fixed, and there are no comments to the otherwise in four months.

Note: See TracTickets for help on using tickets.