Build failure: 4.8.5 on Mac with phonon
-
Leaving aside the question as to why someone would want to build a 32-bit version of anything for a Mac...
I'm trying to build a 32-bit 4.8.5 (actually, latest 4.8.x from git) on Mavericks:
@./configure -release -arch x86 -no-webkit@But eventually I get to this compilation failure:
g++ -headerpad_max_install_names -arch i386 -single_module -dynamiclib -Xarch_i386 -mmacosx-version-min=10.4 -o libphonon_qt7.dylib .obj/release-shared/quicktimevideoplayer.o .obj/release-shared/backendheader.o .obj/release-shared/medianodevideopart.o .obj/release-shared/medianodeevent.o .obj/release-shared/audiooutput.o .obj/release-shared/backendinfo.o .obj/release-shared/audiosplitter.o .obj/release-shared/audioeffects.o .obj/release-shared/quicktimestreamreader.o .obj/release-shared/medianode.o .obj/release-shared/backend.o .obj/release-shared/mediaobject.o .obj/release-shared/mediaobjectaudionode.o .obj/release-shared/audiomixer.o .obj/release-shared/quicktimeaudioplayer.o .obj/release-shared/videoframe.o .obj/release-shared/quicktimemetadata.o .obj/release-shared/audiodevice.o .obj/release-shared/audioconnection.o .obj/release-shared/audiograph.o .obj/release-shared/audionode.o .obj/release-shared/videowidget.o -F/Users/pjs/Applications/qt/lib -L/Users/pjs/Applications/qt/lib -framework AppKit -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuartzCore -framework QTKit -framework phonon -L/Users/pjs/Applications/qt/lib -F/Users/pjs/Applications/qt/lib -framework QtGui -framework QtCore -framework QtOpenGL -framework OpenGL -framework AGL -Xarch_i386 -framework -Xarch_i386 QuickTime -Xarch_ppc -framework -Xarch_ppc QuickTime
clang: error: invalid Xarch argument: '-Xarch_i386 -framework', options requiring arguments are unsupported
clang: error: invalid Xarch argument: '-Xarch_i386 QuickTime', cannot change driver behavior inside Xarch argument
make[4]: *** [../../../../plugins/phonon_backend/libphonon_qt7.dylib] Error 1
make[3]: *** [release] Error 2
make[2]: *** [sub-qt7-make_default] Error 2
make[1]: *** [sub-phonon-make_default] Error 2
make: *** [sub-plugins-make_default-ordered] Error 2I'm not quite sure what's going on here...the error messages don't mean much to me...perhaps a malformed .pro file?
The 64-bit build fails a bit differently:
Undefined symbols for architecture x86_64:
"Phonon::ObjectDescriptionModel<(Phonon::ObjectDescriptionType)0>::qt_metacast(char const*)", referenced from:
vtable for Phonon::ObjectDescriptionModel<(Phonon::ObjectDescriptionType)0> in window.o
"Phonon::ObjectDescriptionModel<(Phonon::ObjectDescriptionType)0>::metaObject() const", referenced from:
vtable for Phonon::ObjectDescriptionModel<(Phonon::ObjectDescriptionType)0> in window.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [capabilities.app/Contents/MacOS/capabilities] Error 1
make[2]: *** [sub-capabilities-make_default-ordered] Error 2
make[1]: *** [sub-phonon-make_default] Error 2
make: *** [sub-examples-make_default-ordered] Error 2Should I submit a bug report?
-
Hi,
IIRC 10.6 is the minimal os-x version for Qt
Did you do a cleanup before switching between 32 and 64 bit ?
I would recommend out of source builds so you don't have to worry about configuration leftovers
-
Which version of Xcode are you using ?
-
By the way, I just did a clean install of the source, configured with:
./configure -release -no-webkit -arch x86_64
and built with "make". I get the same error I reported earlier... I can re-do this experiment, but with 32-bit, but I'm going to guess I'll just replicate that error, too...
BTW, I build without webkit due to a build failure, which is currently under code review...
-
Does it also fail if you configure without setting the architecture ?
-
I tracked down the file in which the "missing" symbol is defined:
src/3rdparty/phonon/phonon/objectdescriptionmodel.h
As this class is defined, the "Undefined symbols" error suggests that the vtable isn't being exported properly.
This templated class is defined with:
@/* Required to ensure template class vtables are exported on both symbian
and existing builds. */
#if (defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT)) || defined(Q_CC_CLANG)
// RVCT compiler (2.2.686) requires the export declaration to be on the class to export vtables
// MWC compiler works both ways
// GCCE compiler is unknown (it can't compile QtCore yet)
// Clang also requires the export declaration to be on the class to export vtables
#define PHONON_TEMPLATE_CLASS_EXPORT PHONON_EXPORT
#define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT
#else
// Windows builds (at least) do not support export declaration on templated class
// But if you export a member function, the vtable is implicitly exported
#define PHONON_TEMPLATE_CLASS_EXPORT
#define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT PHONON_EXPORT
#endif
...comments deleted...
template<ObjectDescriptionType type>
class PHONON_TEMPLATE_CLASS_EXPORT ObjectDescriptionModel : public QAbstractListModel
{
public:
... etc ...
@Guessing that the export rules for the current clang/llvm scheme used in Mavericks and Xcode5.2 may not match the existing code, I tried changing the export macro for the case "Q_CC_CLANG" to instead work like it does for Windows; i.e. to this:
@#if (defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT)) || defined(Q_CC_CLANG)
// RVCT compiler (2.2.686) requires the export declaration to be on the class to export vtables
// MWC compiler works both ways
// GCCE compiler is unknown (it can't compile QtCore yet)
// Clang also requires the export declaration to be on the class to export vtables
#define PHONON_TEMPLATE_CLASS_EXPORT
#define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT PHONON_EXPORT
@With this change in place, phonon compiles and links, and the compilation of Qt succeeds (sans, of course, webkit).
At this point, I suspect that the export semantics have changed in the latest compiler on Maverics/Xcode5.2, or perhaps some command-line argument needs to be changed, or some other such configuration for the compiler...
The "fix" I made is clearly not correct, as it would apply to more than just the Q_CC_CLANG case. Additionally, I've not actually tested whether any of this actually works. But usually compiling and linking is a good first step.
It would be good if this info were passed on to someone who actually knows something about phonon, exporting vtables, etc., so a proper fix can be put into the source tree, and then Mac folks can successfully compile Qt 4.8.5 (6?) again...
Hope this helps.
-
Do you mean Xcode 5.0.2 ?
Just tried to build it in 64bit and all went fine, the main difference is that by default it has 10.5 as minimum version.
How did you get rid of the Xarch error ?
-
Yes...Xcode 5.0.2...typo...
I got rid of the link error by changing the #defines for PHONON_TEMPLATE_CLASS_MEMBER_EXPORT and PHONON_TEMPLATE_CLASS_EXPORT, as described in my previous post.
It's rather odd that you can compile successfully, and I cannot. Looking at the command line, I see that 10.5 is the minimum version for me, as well.
Are you using Mavericks?
-
Yes, I do.
So you successfully compile the 32bit version with this correction but not the 64bit ?
I'll try again to build both.
So just to be sure we are working on the same thing, can you:
- post the complete command line you are using (even if it's the same as your original post
- Just verify that you have modified anything else in the sources and build dir to make things go ahead
-
Can you also check what mkspec you are getting for both builds ?
-
I have not yet tried to build a 32-bit version with my "fix" in it. I'll send one off, and let you know when it completes (or fails). With my fix in, the 64-bit build successfully completes.
Do you want to see the command line that's used to compile the phonon lib(s), or link it? Or do you mean what I'm using to run configure?
-
Well… All might be useful
-
OK, so I tried building just the 32-bit version:
./configure -arch x86 -no-webkit
The compilation fails, whether or not my "fix" to src/3rdparty/phonon/phonon/objectdescriptionmodel.h is in place. This is what I expected, as the error in the 32-bit case seems due to a malformed project or makefile (see the original post for the command line).
The mkspecs used is ./mkspecs/mac-g++
For 64-bit builds, I use:
./configure -no-webkit
The compilation command for objectdescriptionmodel.cpp is this:
g++ -c -pipe -Xarch_x86_64 -mmacosx-version-min=10.5 -fconstant-cfstrings -g -arch x86_64 -Xarch_x86
_64 -mmacosx-version-min=10.5 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -fPIC -DQT_SH
ARED -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DQT_USE_QSTRINGBU
ILDER -DMAKE_PHONON_LIB -DQT_NO_DBUS -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_H
AVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_HAVE_SSE3 -DQT_HAVE_SSSE3 -DQT_HAVE_SSE4_1 -DQT_HAVE_SS
E4_2 -DQT_HAVE_AVX -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/macx-g++ -I. -I../../in
clude/QtCore -I../../include/QtGui -I../../include -I../../include/phonon -I.rcc/debug-shared -I.moc
/debug-shared -F/Users/pjs/Applications/qt/lib -o .obj/debug-shared/objectdescriptionmodel.o ../3rdp
arty/phonon/phonon/objectdescriptionmodel.cppAnd the (failing) link line is this:
g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Xarch_x86_64
-mmacosx-version-min=10.5 -o capabilities.app/Contents/MacOS/capabilities .obj/debug-shared/window.o
.obj/debug-shared/main.o .obj/debug-shared/moc_window.o -F/Users/pjs/Applications/qt/lib -L/Users
/pjs/Applications/qt/lib -framework phonon -L/Users/pjs/Applications/qt/lib -F/Users/pjs/Application
s/qt/lib -framework QtGui -framework QtCoreOne potentially relevant detail, if I didn't already mention: the qt source is from git, and is fresh as of this morning (so its really 4.8.6...)
-
It's a known bug and it's being worked on "here":https://bugreports.qt-project.org/browse/QTBUG-32832
In short, so you can get going:
Reverse your header modifications
edit src/plugins/phonon/qt7/qt7.pro
Change the line containing the Xarch to -framework QuickTime
It will build
WARNING: this is only a workaround -
Thanks!
OK - your recommended modification allows the 32-bit build to get past the 32-bit build-specific error I was seeing earlier:
clang: error: invalid Xarch argument: ‘-Xarch_i386 -framework’, options requiring arguments are unsupported
clang: error: invalid Xarch argument: ‘-Xarch_i386 QuickTime’, cannot change driver behavior inside Xarch argumentThis allows the build to proceed to the phonon link step, where it fails in exactly the same fashion as the 64-bit build (problem with exporting symbols for templated class). Fortunately my previously posted "fix" gets around this problem. I'll investigate a bit more, but it still puzzles me why you can get a clean build without experiencing this same link error...hmm...
-
Really strange… What does g++ --version print ?
-
Heh...I was going to ask you the same thing...
which g++
/usr/bin/g++g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posixI'm wondering if this is related to which version of the Command Line Tools is installed. The /usr/bin/g++ appears to the be same version as found in /Applications/Xcode.app/Contents/Developer/usr/bin/g++ (gives the exact same version info). But there still could be issues with what's in /usr/include, /usr/bin, etc...