5

I was using the QT Creator with an old GCC, now i updated to the 4.8 version. But the QT Creator adds a -Xarch_x86_64 option, the GCC 4.8 tells me

g++: error: unrecognized command line option '-Xarch_x86_64'

Is there a way to remove this options? I tried to use

CONFIG -= x86_64 ppc64 x86 ppc 64 arch_x86_64 -arch -Xarch_x86_64
QMAKE_CXXFLAGS += -std=c++11 -v
QMAKE_CXXFLAGS += -std=c++0x
QMAKE_CXXFLAGS -= x86_64 ppc64 x86 ppc 64 arch_x86_64 -arch -Xarch_x86_64
QMAKE_CXXFLAGS += -mmacosx-version-min=10.7
QMAKE_LFLAGS += -mmacosx-version-min=10.7
QMAKE_LFLAGS -= x86_64 ppc64 x86 ppc 64 arch_x86_64 -arch -Xarch_x86_64

But so far nothing happens.

Note: i'm using the last QT Creator version, with a GCC downloaded using Port and i changed the compiler on the kit.

Regards

Lefsler
  • 1,738
  • 6
  • 26
  • 46

3 Answers3

3

Another way to resolve this problem is to edit the file for the compiler configuration for the specific qt version and the specific target build.

See this post.

In my case this conf file is:

/usr/local/Qt4.8/mkspecs/common/g++-macx.conf

And the changes are:

QMAKE_CFLAGS_X86_64 += -Xarch_x86_64 -mmacosx-version-min=10.5
QMAKE_CFLAGS_PPC_64 += -Xarch_ppc64 -mmacosx-version-min=10.5

to

QMAKE_CFLAGS_X86_64 += -Xarch_x86_64 -mmacosx-version-min=10.7
QMAKE_CFLAGS_PPC_64 += -Xarch_ppc64 -mmacosx-version-min=10.7

Please see the linked post from natoferreira in the Q&A of opencv website. Also this post mention this file.

Please add a comment if you know other information about this configuration file for Qt and GCC.

Community
  • 1
  • 1
nkint
  • 11,513
  • 31
  • 103
  • 174
2

I removed all the references using.

QMAKE_CFLAGS_PPC_64     -= -arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5
QMAKE_OBJECTIVE_CFLAGS_PPC_64  -= -arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5
QMAKE_CFLAGS_X86_64     -= -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5
QMAKE_OBJECTIVE_CFLAGS_X86_64  -= -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5
QMAKE_CXXFLAGS_PPC_64   -= -arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5
QMAKE_CXXFLAGS_X86_64   -= -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5
QMAKE_LFLAGS_PPC_64     -= -arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5
QMAKE_LFLAGS_X86_64     -= -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5

It solved my problem

Lefsler
  • 1,738
  • 6
  • 26
  • 46
  • 1
    Worked for me! Consider accepting this answer, it might help others find the post. – Matt Phillips May 30 '13 at 20:33
  • which compiler are you using? – nkint Jun 07 '13 at 12:35
  • g++-mp-4.8. Use port to download it. If you need to compile the libstdcxx dont forget to update your XCode – Lefsler Jun 07 '13 at 13:01
  • I have installed gcc48 with brew but if I print `gcc` or `g++` in the terminal it does not find the binary.. i have to manually make a softlink.. but it is giving me the error `error trying to exec 'cc1plus': execvp: No such file or directory` – nkint Jun 07 '13 at 13:06
  • You can force to use it using QMAKE_CXX = /path/to/g++-mp-4.8 – Lefsler Jun 07 '13 at 13:09
  • if you do a g++ -v it returns the correct version? I don't know a lot about brew. But do not do a softlink, instead put your new g++ location in your path. It can't find because your OS don't know where the other commands are. – Lefsler Jun 07 '13 at 13:11
0

I had the same problem using GCC installed via MacPorts (tested several versions up to gcc5). The solution for me was using g++ supplied with the XCode command line tools. I uninstalled all MacPorts GCC versions. Below version details of the g++ command that worked.

$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
jfn
  • 2,486
  • 1
  • 13
  • 14