What is the minimum reasonably supported GCC version? [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have been developing a C++11 application against a modern compiler on my mac/linux, which works fine but then I tried to deploy it to a very old linux box (g++ 4.1.2: Feb 2007) and of course that's too old and the executable won't work.
This isn't surprising but now I'm wondering if there is a standard amount of time you are expected to support a compiler/standard?
I had a look around but there is no mention of this.. Should the support for a compiler version drop when the developers themselves deem it end of life and will not patch bugs?

You're the one running gcc (or g++). It's a compiler, used by developers. End-user systems may not have any version of gcc. It's glibc and libstdc++ you need to worry about. But in general, Linux does not aim for binary compatibility. Do not expect any binary executable to run properly on any other distribution/major version.
Conversely, glibc and libstdc++ are careful to work with old kernel versions, so you should be able to install (configure+make+install) the latest runtime support libraries on your Linux box, and then build your application for that.
The easiest way to do that is probably to install the same distribution and version that your target has, into a virtual machine. Then install the C++11 developer tools, and build your application.

Related

Using C++17 to build ios apps? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
The latest XCode clang has support for c++17 but I'm not sure if older iOS devices (e.g., iPhone5, iPhone6) would have the libc++ library to support that. Is there a way to find out if I can use C++17 to build ios apps that supports all supported iOS versions?
Reference:
iPhone5, with iOS12 is still supported
https://support.apple.com/guide/iphone/supported-models-iphe3fa5df43/12.0/ios/12.0
The answer is yes, to some extent. If you're back-deploying to older OSes, there are things from C++17 you'll be able to use, and others you won't be able to use. Just try using it and you'll get a compiler error if it's not available on your deployment target. This requires telling the compiler your deployment target, which is usually done with -mios-version-min=<version> (or similar for other platforms).
Specifically, a feature X that is implemented in the system library (libc++.dylib) won't be supported on OSes older than the first version that shipped a libc++.dylib with support for X. Anything that does not require any sort of library support, i.e. that is all implemented in the headers, will work.
We maintain availability markup in the libc++ headers to flag when you're using something that would break on your deployment target. This is done by using attributes like __attribute__((availability(ios,strict,introduced=<VERSION>))) on declarations that depend on something in the shared library. The compiler does the rest of the job -- if you try to use a declaration that hasn't been "introduced" in the deployment target that you specify, it will let you know.
Edit: I'm using iOS as an example above, but this works for macOS, watchOS and all other Apple platforms.

How to get a C++17 environment on macOS High Sierra? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
macOS High Sierra and Xcode 9 come with an old version of LLVM. It's not obvious which version of LLVM it is because of version number mangling. However, it's apparent it's old as the latest version of LLVM supports C++17 but features like std::optional are not available.
I'd like to write some C++17 code using a Mac. What toolchains are available and what has the fewest complications to get working? My thoughts so far:
LLVM via Homebrew -- interference with/by Xcode?
GCC via Homebrew
Above compiled from source
Any preferred method?
This 'answer' is not an answer to your question. These are the handy bookmarks I use.
I'd use Homebrew to install clang++ (see link below). But if you really want Xcode to interop with it, I'd suggest the "bad news" of wait for Apple, or try out their latest beta. And keep in mind that Apple's "Objective-C++" (*.mm) probably requires Apple's secret sauce, if you have some sort of C++ / Cocoa project.
C++17 implementation status:
https://clang.llvm.org/cxx_status.html
Xcode -to- CLang version:
https://gist.github.com/yamaya/2924292
Homebrew to get CLang (clang++):
https://apple.stackexchange.com/questions/227026/how-to-install-recent-clang-with-homebrew

C++ compiler for Linux on Windows? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm fully aware of this question asking for the same thing. That question is closed and rather old. Accepted answer suggests rather complicated way of making your own cross-compiler and it requires cygwin.
Maybe now there are some other, simpler ways of doing this?
Actually, there is.
If you want cross-compile for linux on ARM, you can use linaro toolchain, which is available for windows. It doesn't require cygwin.
If you want cross-compile for linux on x86, that's a bit of a problem. The only ready-to-use toolchain (apart pre-built solution in that answer) that I'm aware of is "cross-compile tools" for Intel Edison (here). There are some drawbacks to it:
It will compile 32-bit linux binary
Version for windows 64-bit requires cygwin
Version for Windows 32-bit doesn't require cygwin but contains case-sensitive filenames (i.e. there are some files with names that differ only in case and windows will consider them the same file). You may have to make your Windows case-sensitive.
Windows binaries will be at "sysroots\x86_64-pokysdk-mingw32\usr\bin\i586-poky-linux"
To use edison toolchain you have to provide it with sysroot option for compilation and linking, something like this:
"i586-poky-linux-g++.exe" --sysroot=../../../../core2-32-poky-linux
ELLCC is available as a binary download for Windows, Linux, and Macs. It doesn't require cygwin, and can build Linux programs for several targets, including ARM. It is based on the clang/LLVM compiler.

Deploying on multiple platforms and architectures? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am the lead developer in a small business which is just starting. We are developing a cross platform C library which is intended to run on as wide an array of architectures and operating systems as possible. We have extensive unit tests, so if these tests pass on a new platform then we can say with a fair amount of certainty that the library works reliably on that platform.
Up until now, I have been using Windows 32 bit (which is my development machine), as well as a Linode VPS to make sure the library works under Linux with GCC. Now, I am looking to deploy for other platforms as well (namely more Linux distribution flavors, Mac OS X, and preferably some of the smartphones if at all possible). I want to avoid virtualizing all of these platforms if I can. Are there any services that will allow me to deploy the library on many operating systems and architectures? For all of the platforms I mentioned above, I would like to make both 32 and 64 bit builds available and also for different processors as needed. I would like to be able to build the library for all of these platforms, and run the unit tests. The unit tests are written using Boost.test.
Does anyone have any recommendations? The best way would be if there was some sort of convenient cross compiler for the various platforms that I could install on my Linode VPS (Ubuntu 13.04), but a third party solution to which I should upload the code would also work.
The only cross platform compile (which has a tradition, is free and has the support of a large community) is gcc. Of course, there is Intel Compiler and many others (and even the newer, free clang which seems to be used by llvm, but it is still young). You can find a good list here (for C++, but you can scroll on the page and find for any other language):
http://en.wikipedia.org/wiki/List_of_compilers#C.2B.2B_compilers
If you want to build for Mac from Linux please check this:
http://www.bpiwowar.net/2012/06/cross-compiling-for-os-x-with-distcc-on-linux/
And for windows from Linux:
Manual for cross-compiling a C++ application from Linux to Windows?
Regarding the mobile platforms:
for Android, there is native support for Linux/Windows/Mac so you can use any of these platforms to build apps for it
for Windows Phone: Not so, maybe you manage to run Visual Studio using wine and then you're set, but otherwise there is no way that I know of. You can try CodeWeaver which is the "Wine for money" which seems to support Visual Studio 2008:
http://www.codeweavers.com/compatibility/browse/company/?letter=m;company_sort%5Bcompany_name%5D=ASC;company_curPos=200;company_id=1;sort%5Bapp_name%5D=ASC;curPos=400
Furthermore, you can try this application to develop programs in .NET:
http://monodevelop.com/
for Iphone: well, it is not straightforward but you can try this link:
http://www.saurik.com/id/4
I'm a Linux user myself, so the links above are "concentrated" on Linux as the primary dev system. Hope this helps! Good luck with your business!

How to get GCC/++4.6 or newer on Debian [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
--version shows up 4.4 on Debian Squeeze. Today I left Ubuntu because its simply not stable (about 50++ errors a day) and slow. And I dont like Unity. Debian is great. Reliable, fast and Gnome 2 is okay. I worked on a large c++ project and made heavy use of c++0x features.
My question is: how do I get at least gcc 4.6 on Debian?
Running a mixed system is no option. I mean changing sources.list and upgrade. And full upgrade is no option because of Gnome 3. I will have to wait for Debian MATE. But somehow this has to be accomplished...
You could build the GCC 4.7 (from its FSF source tar ball). This might be painful (it really depends upon your skills), and may take several hours of CPU. Before compiling it, install all the required dependencies (perhaps by compiling them from their source code), and read carefully the GCC install documentation several times.
I am not sure that you are right in avoiding mixing Debian/testing with Debian/stable. I am happily using Debian/unstable on all my desktops and laptops, so I get the latest released GCC.
When you build GCC 4.7.2 from the FSF source tarball, don't forget to build outside of the source tree. Read carefully about the configure options (you probably want --program-suffix=-4.7 for instance). Don't forget to enable plugins (with --enable-plugin at ..../configure time) in your GCC. You could perhaps be interested by MELT, a domain specific language to extend GCC, implemented as a [meta-] plugin.
If you dislike Gnome3 -which I do understand- you might try another Debian based distribution like Linux Mint, or simply use XFCE as your desktop.
You can install certain packages from testing while the others remain stable. See APT Preferences from the debian wiki.