note: I unmasked gcc 4.9.0 unlike gcc 4.8.3, gcc 4.9.0 does not emerge mythtv-0.27.1_p20140527 and has link issues... main.o: In function `VideoOutput::StartDisplayingFrame()': /var/tmp/portage/media-tv/mythtv-0.27.1_p20140527/work/mythtv-0.27.1/mythtv/programs/mythavtest/../../libs/libmythtv/videooutbase.h:199: undefined reference to `Video Buffers::StartDisplayingFrame()' main.o: In function `VideoOutput::DoneDisplayingFrame(VideoFrame_*)': /var/tmp/portage/media-tv/mythtv-0.27.1_p20140527/work/mythtv-0.27.1/mythtv/programs/mythavtest/../../libs/libmythtv/videooutbase.h:203: undefined reference to `Video Buffers::DoneDisplayingFrame(VideoFrame_*)' Manual build with same configure as emerge does succeed. Perhaps gentoo maintainer can have a look. Thanks FYI here is emerge -upv output These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] media-tv/mythtv-0.27.1_p20140527::gentoo [0.27.1_p20140527::__unknown__] USE="alsa autostart bluray cec dvb dvd egl fftw hls ieee1394 libass lirc perl python theora vaapi vdpau vorbis xml xmltv xvid (-altivec) -crystalhd -debug -jack -lcd -pulseaudio -raop" INPUT_DEVICES="-joystick" 0 kB Total: 1 package (1 reinstall), Size of downloads: 0 kB
1) Please post your `emerge --info' output in a comment. 2) Please attach the entire build log to this bug report.
Created attachment 380444 [details] emerge --info
Created attachment 380446 [details] mythtv-0.27.1_p20140527-build.log.bz2
Comment on attachment 380444 [details] emerge --info not sure why ::<unknown repository> appears perhaps because I mainly use paludis as package manager
Thanks Jeroen for assigning defect.
There is speculation on the mythtv list that it is caused by a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61085 However, using -fno-early-inlining did not work. Using -O1 did fix the error. So, I suspect it is still a gcc bug, but not that one. Either that or it is an error in mythtv exposed by the optimizer. I'll see if I can narrow down the cause...
Thanks Richard I assume you meant: using -fearly-inlining did not work Like you, I also did following: 1) replace -O2 by -O1 in make.conf -->> emerge succeeds 2) apply proposed #61085 patch to gcc (and replace -O1 again by -O2 in make.conf) -->> emerge fails same way as reported here #516692 3) add -fearly-inlining to CFLAGS -->> emerge fails same way as reported here #516692 That seems enough evidence to conclude gcc bug #61085 is not correlated to and not fixing this gentoo bug #516692 As you say: since using -O1 does not show gentoo bug #516692, perhaps it is caused by another gcc bug. PS: I verified proposed gcc patch fixes #61085 indeed. # g++ -O2 -fno-early-inlining testcase.C # ./a.out <<-- no output
Actually, this does work: CFLAGS="-O2 -pipe -fno-devirtualize" CXXFLAGS="${CFLAGS}" emerge -v mythtv So, it appears likely that this is related to the bug. However, the patch doesn't seem to work.
I think -fno-devirtualize was shown to be a workaround for gcc bug #61085. It now shows to also be a workaround for this gentoo mythtv bug #516692. I would not necessarrily say that proposed fix for gcc bug #61085 does not work. It fixes the problem at hand. It does not fix this gentoo mythtv bug #516692, which, agreed, might very well be a (known?) gcc bug. Maybe we should involve gcc team?
maybe it is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659
(In reply to Marc Duponcheel from comment #9) > I would not necessarrily say that proposed fix for gcc bug #61085 does not > work. It fixes the problem at hand. To be clear. The patch in gcc bug 61085 fixes the issue it was intended to fix. It just doesn't fix mythtv. Disabling devirtualization does fix it, so there is probably another issue. I tried the git version of 4.9.1 and that also does not address the issue. So, that would tend to rule out any bug that they've actually committed a solution to.
now that 4.9.1 is released I'll try 4.9.1 ebuild as soon as it appears in portage
current 4.9.1 ebuild (added KEYWORDS="~amd64") still shows same issue.
any news?
Created attachment 384276 [details, diff] gcc patch To analyze the issue you should provide preprocessed sources for commandlineparser.cpp and main.cpp. Just add --save-temps to the gcc invocations of these two files and post the *.ii files here. Alternatively you could try the attached patch for the gcc-4.9 branch. I've been running it locally without any issues and it would be interesting to know if it fixes this issue, too.
CCing toolchain. Apparent GCC bug affects building mythtv with -O2, with an upstream patch available. I'm not sure what the unmasking plans are for 4.9, but you might want to take this into account.
Should be fixed on the gcc-4.9 branch now. GCC 4.9.2, that contains the fix, will be released soon.
Thanks!
Just checked with gcc 4.9.2 on gentoo and problem still there.
(In reply to Marc Duponcheel from comment #19) > Just checked with gcc 4.9.2 on gentoo and problem still there. As I wrote above: »To analyze the issue you should provide preprocessed sources for commandlineparser.cpp and main.cpp. Just add --save-temps to the gcc invocations of these two files and post the *.ii files here.« So: cd /var/tmp/portage/media-tv/mythtv-0.27.1_p20140527/work/mythtv-0.27.1/mythtv/programs/mythlogserver x86_64-pc-linux-gnu-g++ --save-temps -c -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -O2 -fexceptions -DNDEBUG -fomit-frame-pointer -fPIC -pthread -g -Wall -Wpointer-arith -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -fvisibility-inlines-hidden -Wmissing-declarations -Wno-switch -Woverloaded-virtual -funit-at-a-time -D_REENTRANT -DMMX -D_GNU_SOURCE -DQT_SQL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/include -I/usr -I/usr/include/libxml2 -I../../external/qjson/include -I../../external/zeromq/include -I../../external/nzmqt/include/nzmqt -I../.. -I../../libs -I../../libs/libmyth -I../../libs/libmyth/audio -I../../libs/libmythtv -I../../external/FFmpeg -I../../libs/libmythupnp -I../../libs/libmythui -I../../libs/libmythmetadata -I../../libs/libmythlivemedia -I../../libs/libmythbase -I../../libs/libmythdvdnav -I../../external/libmythbluray -I../../external/libsamplerate -I../../libs/libmythtv/mpeg -I../../libs/libmythtv/vbitext -I../../libs/libmythservicecontracts -I../../libs/libmythprotoserver -I/usr/X11R6/include -I. -o commandlineparser.o commandlineparser.cpp And attach commandlineparser.ii here.
As requested here is how I created commandlineparser.ii in mythlogserver directory # pwd /var/tmp/portage/media-tv/mythtv-0.27.4_p20141018/work/mythtv-0.27.4/mythtv/programs/mythlogserver mythlogserver # x86_64-pc-linux-gnu-g++ --save-temps -c -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -O2 -fexceptions -fomit-frame-pointer -fPIC -pthread -g -Wall -Wpointer-arith -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -fvisibility-inlines-hidden -Wmissing-declarations -Wno-switch -Woverloaded-virtual -funit-at-a-time -D_REENTRANT -DMMX -D_GNU_SOURCE -DUSING_X11 -DUSING_XV -DUSING_XRANDR -DUSING_OPENGL -DUSING_OPENGL_VIDEO -DUSING_VDPAU -DUSING_GLVAAPI -DUSING_PULSE -DUSING_ALSA -DUSING_OSS -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtSql -I/usr/include/qt4/QtScript -I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -I/usr/include/qt4/QtDBus -I/usr/include -I/usr -I/usr/include/libxml2 -I../../external/qjson/include -I../../external/zeromq/include -I../../external/nzmqt/include/nzmqt -I../.. -I../../libs -I../../libs/libmyth -I../../libs/libmyth/audio -I../../libs/libmythtv -I../../external/FFmpeg -I../../libs/libmythupnp -I../../libs/libmythui -I../../libs/libmythmetadata -I../../libs/libmythlivemedia -I../../libs/libmythbase -I../../libs/libmythdvdnav -I../../external/libmythbluray -I../../external/libsamplerate -I../../libs/libmythtv/mpeg -I../../libs/libmythtv/vbitext -I../../libs/libmythservicecontracts -I../../libs/libmythprotoserver -I. -I/usr/X11R6/include -o commandlineparser.o commandlineparser.cpp x86_64-pc-linux-gnu-g++: warning: -pipe ignored because -save-temps specified Recall this is a link issue. I repeat the error below. Also notice that if I use -fno-devirtualize then 516692 is not seen # pwd /var/tmp/portage/media-tv/mythtv-0.27.4_p20141018/work/mythtv-0.27.4/mythtv/programs/mythavtest mythavtest # x86_64-pc-linux-gnu-g++ -Wl,-O1 -o mythavtest main.o commandlineparser.o -L../../libs/libmyth -L../../libs/libmythtv -L../../external/FFmpeg/libavutil -L../../external/FFmpeg/libavcodec -L../../external/FFmpeg/libavformat -L../../external/FFmpeg/libswscale -L../../external/FFmpeg/libswresample -L../../libs/libmythbase -L../../libs/libmythui -L../../libs/libmythupnp -L../../libs/libmythmetadata -L../../libs/libmythservicecontracts -L../../libs/libmythprotoserver -lmythswscale -lmythavformat -lmythavcodec -lmythavutil -lmythswresample -lmythtv-0.27 -lmythupnp-0.27 -lmythbase-0.27 -lmythui-0.27 -lmyth-0.27 -lmythmetadata-0.27 -lmythservicecontracts-0.27 -lmythprotoserver-0.27 -L../../libs/libmythfreemheg -lmythfreemheg-0.27 -L../../external/libhdhomerun -lmythhdhomerun-0.27 -lXext -lXinerama -lXxf86vm -lXv -lXrandr -lX11 -lxml2 -lcrypto -lfftw3_threads -lfftw3f -lfftw3 -lmp3lame -lva -lpulse -lasound -lfreetype -lpng16 -lxvidcore -lvorbisenc -lvorbis -ltheoraenc -ltheoradec -logg -lm -ludev -luuid -pthread -lbz2 -lz -ldl -lraw1394 -liec61883 -lavc1394 -lrom1394 -L/usr/X11R6/lib -L/var/tmp/portage/media-tv/mythtv-0.27.4_p20141018/work/mythtv-0.27.4/mythtv/external/zeromq/src/.libs -lmythzmq -L/var/tmp/portage/media-tv/mythtv-0.27.4_p20141018/work/mythtv-0.27.4/mythtv/external/nzmqt/src -lmythnzmqt -L/var/tmp/portage/media-tv/mythtv-0.27.4_p20141018/work/mythtv-0.27.4/mythtv/external/qjson/lib -lmythqjson -L/usr/lib64 -L/usr/lib64/qt4 -lGL -lQtSql -L/usr/lib64/mysql -lQtXml -lQtOpenGL -lQtGui -lEGL -lQtNetwork -lQtCore -lgthread-2.0 -lglib-2.0 -lpthread main.o: In function `VideoOutput::StartDisplayingFrame()': /var/tmp/portage/media-tv/mythtv-0.27.4_p20141018/work/mythtv-0.27.4/mythtv/programs/mythavtest/../../libs/libmythtv/videooutbase.h:199: undefined reference to `VideoBuffers::StartDisplayingFrame()' main.o: In function `VideoOutput::DoneDisplayingFrame(VideoFrame_*)': /var/tmp/portage/media-tv/mythtv-0.27.4_p20141018/work/mythtv-0.27.4/mythtv/programs/mythavtest/../../libs/libmythtv/videooutbase.h:203: undefined reference to `VideoBuffers::DoneDisplayingFrame(VideoFrame_*)' main.o: In function `VideoOutput::StartDisplayingFrame()': /var/tmp/portage/media-tv/mythtv-0.27.4_p20141018/work/mythtv-0.27.4/mythtv/programs/mythavtest/../../libs/libmythtv/videooutbase.h:199: undefined reference to `VideoBuffers::StartDisplayingFrame()' main.o: In function `VideoOutput::DoneDisplayingFrame(VideoFrame_*)': /var/tmp/portage/media-tv/mythtv-0.27.4_p20141018/work/mythtv-0.27.4/mythtv/programs/mythavtest/../../libs/libmythtv/videooutbase.h:203: undefined reference to `VideoBuffers::DoneDisplayingFrame(VideoFrame_*)' collect2: error: ld returned 1 exit status
Created attachment 388430 [details] commandlineparser.ii as requested (but compressed)
(In reply to Marc Duponcheel from comment #22) > Created attachment 388430 [details] > commandlineparser.ii > > as requested (but compressed) Thanks. But unfortunately I need main.ii, too.
main for mythlogserver or mythavtest ?
(In reply to Marc Duponcheel from comment #24) > main for mythlogserver or mythavtest ? mythavtest Thanks.
Created attachment 388546 [details] mythavtest main.ii mythavtest main.ii as requested
(In reply to Marc Duponcheel from comment #26) > Created attachment 388546 [details] > mythavtest main.ii > > mythavtest main.ii as requested Thanks. Reduced: markus@x4 tmp % cat main.ii class A { public: A (int) {}; }; class VideoBuffers { public: void StartDisplayingFrame (); }; class B { public: virtual void StartDisplayingFrame () { vbuffers.StartDisplayingFrame (); } VideoBuffers vbuffers; } ; class VideoPerformanceTest { public: VideoPerformanceTest () : file (0) {} B *Test_vo; void Test () { while (1) Test_vo->StartDisplayingFrame (); } A file; } a; int main () { a.Test (); } markus@x4 tmp % g++ -O2 -Wl,--no-undefined main.ii /tmp/ccHxLPF0.o:main.ii:function B::StartDisplayingFrame(): error: undefined reference to 'VideoBuffers::StartDisplayingFrame()' /tmp/ccHxLPF0.o:main.ii:function main: error: undefined reference to 'VideoBuffers::StartDisplayingFrame()' collect2: error: ld returned 1 exit status markus@x4 tmp % g++ -fno-devirtualize-speculatively -O2 -Wl,--no-undefined main.ii markus@x4 tmp % Looks like a bug in mythtv to me, because there is no reason why devirtualization shouldn't be permitted. main.cpp includes videobuffers.h (that only contains the declaration of VideoBuffers::StartDisplayingFrame()), but doesn't link with videobuffers.o.
I've opened https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63745 for this issue.
(In reply to octoploid from comment #28) > I've opened https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63745 for this > issue. Jan Hubicka, who implemented devirtualization for gcc, also says that the issue is invalid. So it's a bug in mythtv. Someone should report this issue upstream.
By adding mythtv/libs/libmythtv/videobuffers.o mythavtest -does- link. thanks for catching. I did originally raise this defect against mythtv (or, at least, that was the intention). Strange that gcc 4.8.3 does not have a problem and that gcc 4.9.x does not have a problem (without devirtualization). I guess compiler C++ gurus know exactly why (in fact, I think I can understand myself that some devirtualized in videobuffers.o might be needed).
(In reply to Marc Duponcheel from comment #30) > By adding mythtv/libs/libmythtv/videobuffers.o mythavtest -does- link. > > thanks for catching. > > I did originally raise this defect against mythtv (or, at least, that was > the intention). > > Strange that gcc 4.8.3 does not have a problem and that gcc 4.9.x does not > have a problem (without devirtualization). I guess compiler C++ gurus know > exactly why (in fact, I think I can understand myself that some > devirtualized in videobuffers.o might be needed). I've just hit the very same bug using gcc-4.9.2, but against media-tv/mythtv-0.27.4_p20150124. So newer mythtv, newer gcc, but the bug is still there. Note, that from my perspective, this seems to be a plain missing object(s) in the linking command. Apart from mythavtest needs videobuffers.o, - mythtranscode also needs videobuffers.o and - mythtv-setup needs dtvmultiplex.o, dtvconfparser.so and dtvconfparserhelpers.o Cheers: Dw.
If it is a link problem, has anybody then succeeded to adjust the build receipe to avoid the undefined reference?
This was reported upstream at: https://code.mythtv.org/trac/ticket/12408
*** Bug 537636 has been marked as a duplicate of this bug. ***
fixed with gcc 5.1.0
still a build failure w/ media-tv/mythtv-0.27.5_p20150627 - and gcc 5.1 isn't unstable yet - it is hard masked
ACK: 0.27.5_p20150627 + gcc 5.1.0 problem is back
(In reply to Attila Tóth from comment #31) > I've just hit the very same bug using gcc-4.9.2, but against > media-tv/mythtv-0.27.4_p20150124. So newer mythtv, newer gcc, but the bug is > still there. > Note, that from my perspective, this seems to be a plain missing object(s) > in the linking command. > Apart from mythavtest needs videobuffers.o, > - mythtranscode also needs videobuffers.o and > - mythtv-setup needs dtvmultiplex.o, dtvconfparser.so and > dtvconfparserhelpers.o I would say, that the problem is not back, but rather still there. gcc-4.9.2, glibc-2.20-r2, 4.0.6-hardened-r2 x86_64, media-tv/mythtv-0.27.5_p20150627 fails exactly the same way, like before. The solution before works for me here as well. BR: Dw.
Same issue with recent ebuild mythtv-0.27.5_p20150627 and gcc-4.9.3 What exactly is the mentioned solution?
sorry, wrong release mentioned! I mean: mythtv-0.27.5_p20150904-r1 !
it merged successfully with gcc-4.8.5
(In reply to Stefan G. Weichinger from comment #41) > it merged successfully with gcc-4.8.5 It still doesn't merge using gcc-4.9.3, and needs the above mentioned workarounds.
If anyone has a chance to create a patch for the MythTV build system to add the necessary files to be linked I would appreciate it. I'll try to get around to it when I can if no one else does.
Having this same problem, mentioned it to upstream. Patching the makefiles directly to add the object files to the link line works. (I didn't make a patch, but simply tarballed the three files I changed. The tarball is on the upstream bug report.) This, of course, makes no sense because these objects, and the code the linker is claiming is undefined, are in the shared libraries already called out on the link line. You can see it with `nm` and `c++filt`. Anyway, I've got it in a repeatable state on my system. Let me know if you want me to try anything else on it.
Thanks for the report. Fixed in http://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eeb65f13becaaa445a93d2033d2981b4525fb03d