Cocoa app on old OSX 10.5.6 - configuration for maximum compatibility - c++

I am very new to C ++ programming for OSX.
What is the configuration that I need to set in Xcode on the old OSX 10.5.6 to create a simple Cocoa application but that also works on new operating systems.
What compiler do I need to set, the architecture etc ???
I hope the questions are not very silly...

To run on the latest versions of macOS, you must build a 64-bit app. In the Architectures build setting, make sure 64-bit Intel (x86_64) is one of the architectures you're building for.

Related

How to make Qt Creator use Rosetta and x86 compiler on Mac M1?

I am using Qt 5.15.2 on my Mac mini with M1 chip. This works fine (due to Rosetta). Below is the list of compilers Qt Creator found on this computer, and among them is the C++, x86 64bit that I use. No problem.
I would like to use the same settings on a (somewhat newer) Mac Book Pro (also with M1 chip). Below is the list of compilers Qt Creator finds on this computer, the x86 is now missing!
I do not know if I have a x86 compiler on the new M1-computer. I have installed Xcode and the command line tools for XCode 13.2.
Can I somewhere tell Qt Creator that the deployment target is x86?
Does /usr/bin/clang++ only compile for the ARM/M1-chip, or can it also produce and link to x86 code?
if not, how can I find out if there is an x86 compiler on my new M1-computer?
If the compiler is missing, how to install it?
Any help would be most appreciated!
A few tips that can help, I just setup a project using Qt 5.15.2 on a 2021 M1 Mac.
Note this will likely be different for Qt >= 6.
Can I somewhere tell Qt Creator that the deployment target is x86?
Yes, you can do this using specific argument in the build settings of your kit.
Add the QMAKE_APPLE_DEVICE_ARCHS="x86_64" additional argument to qmake.
Also, add an additional CMake option: -DCMAKE_OSX_ARCHITECTURES:STRING="x86_64"
ℹ️ Click Manage Kits.. in the projects view to open the preferences editor where you can update your CMake configuration.
Does /usr/bin/clang++ only compile for the ARM/M1-chip, or can it also produce and link to x86 code?
With rosetta installed (/usr/sbin/softwareupdate –install-rosetta –agree-to-license), and the configuration above, yes you can compile and link x86 binaries.

What compiler to choose for Qt MinGW or MSVC in what case?

I am starting with QT, using windows 64 bits I have MinGW already installed and I don't have VS.
What version of QT should I pick (MSVS or MinGW) and for what purpose?
Is there some cases where I must choose one over the another?
I saw that the only Qt version for MinGW is 32 bits, however MinGW supports 64 bits too, why?
Let say I want to develop a windows app and an android app, should I have to install both Qt's versions MSVC2015 and Qt for android?
You'd better install both of them. MinGW version for development and
MSVC version for release.
Because guys from Digia, who build Qt
releases, desided that there's no need in x64 MinGW release. But you
may get the sources and build it yourself.
Yes, you need both.

/usr/bin/ld: cannot find lGL when building Qt5 app in Qt Creator on Linux Mint

I'm porting my application from Qt4 to Qt5. I installed Qt5.2.1 from the online installer on Linux Mint 16 64-bit, in a vm on my MacBook Pro. When I run qmake and build in Qt Creator, I get:
/usr/bin/ld: cannot find -lGL
Do I need openGL? I'm not using it when I build on Windows or OSX. I'm very new to Linux, and far from expert in C++ or Qt. I found a post that included a hack to remove -lGL from mkspecs/common/linux.conf. That worked.
My question is, assuming I don't need -lGL, what is the normal way to keep the linker from attempting to link it? I imagine I do something in the .pro file, but what?
Qt5 makes heavy use of OpenGL internally. On Windows OpenGL support is a bit flaky (you must install the original vendor drivers, because Microsoft strips OpenGL from the automatically installed drivers) and hence makes use of a built in OpenGL emulation layer library.
On Linux however OpenGL support is much better. You'll find at least the Mesa softpipe backend, if the GPU is not supported by the standard drivers. If the GPU is supported, then out-of-the-box OpenGL support in Linux has become pretty good over the past years.
On MacOS X OpenGL is actually the foundation of all the higher level graphics operations and hence part of the inner workings of the operating system; sounds great in theory, but is also a major obstacle for quick version turnaround, as every major OpenGL version bump mandates an operating system update.
Now, unless your installation of Linux is seriously outdated you actually should have a OpenGL library installed. If not (and your linker error tells you this), just install the Mesa development package.
Linux Mint is a derivative of Ubuntu which in turn is a Debian derivative. The command to install the Mesa development package for OpenGL is
sudo apt-get install libgl1-mesa-dev

Compile for OS X 10.6?

Normally for my OS X builds I have been compiling my applications on an old Mac Book Pro that runs 10.6. This assures that I support this version of OS X.
However for various reasons, the MBP is no longer a long term option so I have been compiling on a more recent device which runs 10.8. However when I do this, my application does not work on 10.6 even with the -mmacosx-version-min=10.6 flag set. The error that happens when I set the flag is "Symbol not found: _wcsdup" in libSystem.B.dynlib
I looked up this error and the only recommendations I can find is to directly link against the 10.6 SDK. However when I tried copying the 10.6 SDK from my MPB to the new machine (because 10.6 SDK is not installed on 10.8), it fails to compile with errors like "error: bits/c++config.h: No such file or directory" I assume this is because of the way I "installed" the SDK, although others have had success with this.
Does anyone have a solution?
Run 10.6 in a VM, like VMWare or VirtualBox.
I am able to reinstall older SDKs and compilers with this procedure: How can we restore ppc/ppc64 as well as full 10.4/10.5 SDK support to Xcode 4?
You need to change the path of xcode installs in the script.
Also you probably won't be able to use -std=c++11 when targeting 10.6 since you will mostly also need -stdlib=libc++ which is only available when targeting 10.7 or above.
Apple only distributes libc++ binaries since 10.7. You could build your own libc++ and deploy it with your app to 10.6 machines. But Apple hard coded the compiler to disallow -stdlib=libc++ when targeting anything lower than 10.7.

Compile vowpal-wabbit in ubuntu for use in windows 7

I have a Windows 7 laptop with an Ubuntu 12.04 installation on the same machine.
I am trying to compile a program from source (VowPal Wabbit). I tried using Cygwin but had no luck getting it to work. I ended up installing Ubuntu 12.04 to get access to get a functioning compiler.
It worked on the Ubuntu side but I am curious if there is a way to bring the compiled files over to Windows as that's where I actually do most of my work. More specifically, will programs compiled in Ubuntu function on a Windows machine?
Any suggestions?
You should check out MinGW:
MinGW, a contraction of "Minimalist GNU for Windows", is a minimalist
development environment for native Microsoft Windows applications.
I realize it is almost a year later. Credit Chris Quirk, Nick Nussbaum and others, current versions of vowpal wabbit (7.x) should build and work fine on Windows.
This reference should provide all the necessary details.
Edit: 2017-07-10:
I should also note: the library and basic train and test from files functionality has been working on Windows for a while. However, not all the functionality supported in a native Linux environment is available on Windows. In particular, the --daemon option, network related features like spanning-tree (under the cluster directory), and some of the utilities under the util directory have not been fully ported and/or tested on Windows. vw developers welcome pull-requests from Windows users.