Building Qt with non Apple GCC on OSX Maverick
-
Hello,
Sorry if my English is bad or unclear. Not my first language. On top of that, I am not a professional programmer, so my knowledge my be lacking.
I am trying to compile Qt with a GCC I have installed using Macports (gcc 4.7 to be precise). I was wondering if anybody successfully compiled Qt with this combination before and how.
I have XCode installed with command line tools. Latest version (Version 5.0.2 (5A3005)). I am running OSX Maverick latest version (10.9.1).
I have "Googled" a bit and searched on the forum. I really want a minimal build of Qt. I don't need Webkit or most of the modules. I have tried the following configure command from where I want to build :
@../qt_src/configure -prefix /sw/local/ -release -platform darwin-g++ -arch x86_64 -opensource -confirm-license -c++11 -static -qt-zlib -qt-pcre -qt-xcb -qt-xkbcommon -nomake examples -nomake tests -no-opengl -no-framework -v@
On top of those (but I don't think it's related to my problem), I am adding a lot of skip (webkit for instance) to minimize the build.
At first, it would complain that c and c++ were not found. I symlinked in my path c to gcc and c++ to g++.
Still would not work after that and now complains that it does not recoginze the -fconstant-cfstrings argument.
@c: error: unrecognized command line option '-fconstant-cfstrings'@I then went into the qtbase/configure script and the qtbase/mkspecs/features/qt_module.prf files to remove completely (commenting) the -fconstant-cfstrings. I now get a whole lot of undefined symbols. I am guessing that I should not remove the flag that way.
Can anybody help ? Am I attempting something that simply won't work ? If I understand correctly, it is not supported. My problem is that building with libc++ and clang is not supported by other libraries that I use and using apple gcc4.2 does not support most of the c++11 that I use in my code. Maybe we should drop the GUIs for now until every library we use builds using clang and libc++ or Qt can be built with another compiler.
Thanks in advance for any insight or help. :-)
Ghyslain
P.S. : Here is the beginning of the error messages.
@Performing shadow build...
Preparing build tree...
c++ -c -fvisibility=hidden fvisibility.c
Symbol visibility control enabled.
c++ -o libtest.so -shared -Wl,-Bsymbolic-functions -fPIC bsymbolic_functions.c
ld: unknown option: -Bsymbolic-functions
collect2: error: ld returned 1 exit status
Symbolic function binding disabled.
DEFAULT_INCDIRS="/opt/local/include/gcc47/c++
/opt/local/include/gcc47/c++//x86_64-apple-darwin13
/opt/local/include/gcc47/c++//backward
/opt/local/lib/gcc47/gcc/x86_64-apple-darwin13/4.7.3/include
/opt/local/include
/opt/local/lib/gcc47/gcc/x86_64-apple-darwin13/4.7.3/include-fixed
/usr/include
/System/Library/Frameworks
/Library/Frameworks
"
DEFAULT_LIBDIRS="/opt/local/lib/gcc47/gcc/x86_64-apple-darwin13
/usr/lib
/opt/local/lib/gcc47/gcc/x86_64-apple-darwin13/4.7.3
"
Creating qmake...
QMAKE_MAC_SDK must be set when building on Mac
QMAKE_MAC_SDK must be set when building on Mac
QMAKE_MAC_SDK must be set when building on Mac
QMAKE_MAC_SDK must be set when building on Mac
QMAKE_MAC_SDK must be set when building on Mac@ -
I really would like to get an answer to that as well.
I have GCC4.7 installed and working on my mac (Mavericks) but I don't manage to build Qt with it. Qt's build system always use clang instead.
-
Not sure it is relevant, but as a follow-up, I have given up trying to build on OSX with GCC. The libraries that I am using can now be built using Clang.
-
Not sure it is relevant, but as a follow-up, I have given up trying to build on OSX with GCC. The libraries that I am using can now be built using Clang.
-
Even if you could build with a non-Apple gcc, the gnu standard library that Apple ship with OS X (libstdc++.dylib) does not support c++11. You would not be able to deploy unless 1) you ship your own, newer libstdc++ and 2) all your other components are built with this new lib.
-
Even if you could build with a non-Apple gcc, the gnu standard library that Apple ship with OS X (libstdc++.dylib) does not support c++11. You would not be able to deploy unless 1) you ship your own, newer libstdc++ and 2) all your other components are built with this new lib.