Compiling a Qt5.2 project on OsX 10.9 with gcc4.2? - c++

I have a QT project that works perfectly under my current configuration ( OsX 10.8.5, QT4.8.5 and compiler i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
The problem is I am switching to a new laptop that has OsX 10.9 installed. As known problem there is only CLang. Using CLang the project gives a lot of compilation errors on some libraries that I cannot change. (errors that are not given under the current configuration ).
Hence I have installed apple-GCC4.2.1 using brew and with gcc --version I get:
i686-apple-darwin11-llvm-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3).
Now I get "no such file or directory" for files <stdarg.h> and <float.h>, under the directory
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
For what I have understood it is like it is including the basic c++ headers from the Xcode compiler and they do not match with the ones that gcc4.2.1 wants.
Can someone help me? thank you in advance.

All of the C++ code (Qt, your application, any C++ libraries that you use) must be compiled with the same C++ compiler.

I have solved.
I have to say that the following procedure worked for my case, but I cannot be sure that this can work for you and/or if this procedure can be dangerous for your system configuration.
For me, worked this procedure.
Install command_line_tools_os_x_mavericks_for_xcode_late_october_2013
( not sure if it is necessary, but i think so )
Install Qt4.8.5 and set it up on QtCreator
install homebrew
install apple-gcc42 and gdb using brew:
brew tap homebrew/dupes
brew install apple-gcc42
brew install gdb
set up the compiler and GDB on QtCreator and then create your kit.
codesign gdb following this guide (scroll until you find
"Generate Certificate for signing".
have fun.
in my case it was necessary to modify the makefile in order to set for
CFLAGS, CXXFLAGS and LFLAGS the value -mmacosx-version-min=10.6.

Related

No Working C Compiler Found

I just downloaded it from here to try it:
http://www.videolan.org/developers/x264.html
I ran ./configure. It complained that I didn't have an assembler and suggested I ran ./configure --disable-asm. Then all seemed to compile OK.
How did you install gcc? From the repositories?
After i check the GCC version by using (gcc --version) command in terminal. The log is
i686-apple-darwin11-llvm-gcc-4.2
(GCC) 4.2.1 (Based on Apple Inc. build 5658)
(LLVM build 2336.11.00)
how can i solve this issue ..? I want to make compile and install.
Check config.log and search for "working C compiler". You will see the error that caused the test to fail.
You really need to supply more information (for example, the output of running configure). "Then all seemed to compile OK." is especially confusing. If "all seemed to compile OK", what is your problem?
it seems that you don't have required yasm,
go through below link & download.
http://www.linuxfromscratch.org/blfs/view/svn/general/yasm.html
Steps to follow :
download from above link
extract files
./configure
make
make install #
yasm --version
if it is 1.3.0 then its OK, otherwise reply me if you are not getting right version details
again try to install your software, you will definitely find right assembler

How to update the clang version to compile a C++11 project? (on Mac)

I'm trying to build a project which is originally written for archlinux. The building process works fine on that archlinux but has a huge amount of errors when I tried to build it on my mac. The project is basically written in C++11 so it's very unstable. I think there has something to do with the compiler because the clang version in mac is 4.2(It actually shows 'Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)' when I type clang --version) and 3.3 for linux. So I want a different version of clang, perhaps 3.3. How Can I specify the version of my compiler when trying to build the project?
Some might argue this belongs on apple.stackexchange.com, but I'm not sure C++11 tags grab a lot of attention there:)
Xcode 5.0 is now available from the App Store. Install it, go to Preferences -> Downloads, and install the Command Line Tools. However...
First, you will need to go to Preferences -> Accounts and add your Apple ID. For some reason, the Command Line Tools download requires an account login. I don't know what the rationale for this is.
> clang -v
Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn)
If you are willing to build from the command line, using make for example (which sounds likely given the project is from Linux), then install Macports and install whatever version of clang you would like:
$sudo port install clang-3.1
$sudo clang_select
Note that this version of clang shouldn't interfere with the Xcode Command Line package if you are will to invoke the Xcode version using xcrun clang instead of plain old clang.

Can I use gcc 4.7 (and C++11) on Mountain Lion without installing XCode?

I've been using command line tools and a text editor to compile class projects, which has worked great. Unfortunately, they've become sticklers about us using 4.7. Xcode (and thus OSX) only has llvm-gcc 4.2, so I was looking to upgrade.
I've got macports installed and have found instructions for installing gcc 4.7, but it says that I need xcode installed. I was hoping to be able to just use command line tools and not have xcode (I don't need any of the iOS or graphics stuff, I just want gcc.
Anyway, if it's not possible, it's no big deal, but I'd be appreciative if anyone could point me in the right direction. Thanks!
To clarify, I have command line tools, but not the version of gcc I'd like. Running macports results in this:
$ sudo port install gcc47
Error:
Error: No Xcode installation was found.
Error: Please install Xcode and/or run xcode-select to specify its location.
Error:
Error: The installed version of Xcode (2.0orlower) is too old to use on the installed OS version.
Version 4.1 or later is recommended on Mac OS X 10.8.

Building z3 on mac os x

I'm trying to build Z3 on mac os x.
Following README file, I just executed
autoconf
./configure
make
to get an error "omp.h" file not found.
I copied the omp.h file from /usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include to lib directory to solve this issue.
Then, I got lib/buffer.h:243:13: error: use of undeclared identifier 'push_back' error in building the code.
What could be the solution? I have gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) on Mac OS X 10.7.5.
The next release (Z3 v4.3.2) will have better support for OSX, clang, and older versions of gcc.
You should be able to compile the release candidate using the following instructions. rc is the branch that contains the current release candidate.
git clone https://git01.codeplex.com/z3 -b rc
cd z3
python scripts/mk_make.py
cd build
make
BTW, the link http://z3.codeplex.com/releases/view/95640 does not contain the latest release (Z3 v4.3.1). We don't create zip files with source code anymore because codeplex automatically generates them for any version. See this link for additional details.
EDIT
on February 2013, we started to provide nightly builds for all major platforms (including OSX). Here are instruction on how to download these pre-compiled binaries.
END EDIT
Alternatively, you can use Homebrew:
> brew install z3

How to update GCC in MinGW on Windows?

I'm used to manually install GCC from source before on Ubuntu and it was a painful process. So I really don't want to do repeat this process. Currently, I have MinGW and GCC (4.6.2) installed on my machine. So is there an easy way to update GCC without building it entirely from source? Has anyone done it before can share me some tips?
Update using terminal:
Run the command prompt/terminal (cmd or sh).
Update the package list:
mingw-get update
After updating the package list, run:
mingw-get upgrade
When the command finishes running, all of your packages will be upgraded.
Update using the GUI version:
If you aren't used to the terminal, there is also a GUI version of MinGW called "MinGW Installation Manager", which is normally located at:
C:\MinGW\libexec\mingw-get\guimain.exe
When the GUI is open, tap Installation -> Update Catalogue. This will update the package list.
After that, tap Installation -> Mark All Upgrades. This will select all of the packages which can be upgraded.
Finally, tap Installation -> Apply Changes to apply the upgrades.
Snapshots and release builds of the MinGW http://code.google.com/p/mingw-builds/downloads/list
UPDATE: As of Nov-5-2012, MinGW includes 4.7.2 of the GCC compiler, which is the most current version. I personally will use the MinGW package, since it includes MSYS and other tools, and since it is the defacto standard, I hope that it is better supported. The only drawback is the included GDB does not include Python scripting, but I think that can be updated separately.
I don't know if you can update the GCC in MinGW, but there are alternative projects to MinGW with newer versions of GCC.
The MinGW-builds project provides a package similar to MinGW but with an updated GCC (4.7.2). I extracted the files to c:\MinGW (so I could use the same path) after moving my existing MinGW to another folder. Only MinGW has MSYS, so if you need that (I did) copy the msys folder from the original MinGW.
After installing MinGW-builds, the result of g++ --version:
g++ (Built by MinGW-builds project) 4.7.2
The latest GCC that comes with standard MinGW is currently 4.7.0. I compiled a few simple projects in Code::Blocks, and the latest wxWidgets source, and everything seems to work.
It's worth noting that MinGW-builds includes a Python script enabled version of GDB, in case you want STL pretty printer support, or other GDB Python features.
Another good choice is TDM-GCC, which is a project that hosts an impressive installer that includes an updated GCC compiler (4.7.1) and support tools. It is a standalone package. As far as I can tell, Python scripting is not supported in the GDB that comes with this package.
Finally there is the MinGW-w64 project, which is a fork of MinGW. Rubenvb, who posted an answer to this question, has good standalone packages (in the personal builds folder) based on this project which include an updated GCC (4.7.2). The included GDB seems to be Python script enabled.
if you use MSYS2
just open mingw64-console and type in:
# Update the package database and core system packages with:
pacman -Syu
# If needed, close MSYS2, run it again from Start menu. Update the rest with:
pacman -Su
I have built a more up to date GCC 4.7 (it's built within code freeze, so it should be equivalent with the release). Also, this build contains <thread> support.
32-bit
64-bit
The -gcc_linux package is what you want if you want to use it on Linux. Just extract somewhere and add the mingw??/bin directory to PATH.
PS: There's a native Windows compiler and a Windows Clang build. I suggest using Clang only with one of my GCC 4.6 builds, as it has trouble with GCC 4.7's libstd++. Extract the Clang package in the same directory as the GCC package and it will work out of the box.
The MinGW-w64 build from http://winlibs.com/ has the latest GCC version and requires no installation, just unzip the download. To upgrade you can just replace the mingw32 or mingw64 folder with the new version.
To get latest MinGW64 in Windows: https://sourceforge.net/projects/mingw-w64/?source=typ_redirect
For all platforms: https://mingw-w64.org/doku.php/download
You just need to update your g++ compiler if its not.
First problem can be solved through this:
Update using the GUI version:
If you aren't used to the terminal, there is also a GUI version of MinGW called "MinGW Installation Manager", which is normally located at:
C:\MinGW\libexec\mingw-get\guimain.exe
When the GUI is open, tap
Installation -> Update Catalogue
. This will update the package list.
After that, tap
Installation -> Mark All Upgrades
. This will select all of the packages which can be upgraded.
Finally, tap
Installation -> Apply Changes
to apply the upgrades.
2nd Problem could be that if you didn't updated the path of mingw in environment variables.