📜 ⬆️ ⬇️

Tell everything about a Linux C ++ programmer.

Some time ago I was working with Red Hat Linux. And after a long break I need to return to the penguin world again, but so much water has flowed under the bridge! Can we put it all together here is a kind of FAQ for a C ++ programmer, but a teapot in Linux?

Go?

General issues.
')
1. What is the difference between the main popular Linux distributions?

> The main difference is the package system. (deb, rpm, etc.) Also under what architectures is the distribution kit released. (sl_bug)

> Main differences: Package Manager, software suite, default settings. (Evgeny_Shiryaev)

> (in addition to Evgeny_Shiryaev) still sometimes differ in the way of configuration of services started at boot time. An example is /etc/conf.d/net in Gentoo and / etc / network / interfaces in Ubuntu. Also, each distribution has its own way of specifying the list of services that are started at boot time. Sometimes they differ in the way they organize the configuration files themselves (one file or a handful of files and a macro that collects them). (xtreme)

> In the package system, in the installer, in system scripts. In software versions and software set by default. (Arceny)

2. Why should BSD be preferred over Linux?

> Who told you that? Need to choose according to needs. (sl_bug)

> Personally, I don’t see significant advantages of BSD systems over Linux systems. (Evgeny_Shiryaev)

> Holivarny question. The choice of system depends on the task. However, in BSD, the network stack is more thoughtful and there are such useful shnyazhki as accf_http and accf_data. In Linux, I have not yet seen a replacement other than TCP_DEFER, which works a little differently. (xtreme)

3. Are there completely free Linux distributions?

> Yes (sl_bug)

> Yes, and most of them. (Evgeny_Shiryaev)

> I would say that free-available distributions are the absolute majority. (xtreme)

> Yes, most. Debian or Ubuntu. Or Fedora. Or Gentoo. (Arceny)

4. Why is the Linux distribution generally paid, because it is based on open-source software and a free Linux kernel?

> Usually, support is paid and not distribution (sl_bug)

> The fee is not for the distribution itself, but for supporting it (updates, technical support, etc.). (Evgeny_Shiryaev)

> A very important point for the developer:
In the paid SUSE SLES distribution kit, the source packages are also not available without a subscription (src.rpm = mainstream source + distributive updates, patches, specs, configs).

You can rebuild the package only from the original (mainstream) tar.gz (at best, from the src.rpm opensuse, with redrawing dependencies and other niceties).
In this case, of course, the whole system of updates collapses.
And perhaps compatibility with the rest of the system’s packages,
including the package itself, made of binaries.

Most likely, a similar situation with RedHat and other paid distrib. (qmax)

> (again, in addition to Evgeny_Shiryaev) Here we must remember that "open source" and "free" are still different concepts. Usually, OpenSource licenses do not prohibit the sale of products released under them or with their use. (xtreme)

> Technical support, box, printing ... Or included proprietary components, removing which we get a fully licensed version. (Arceny)

> You have the opportunity to pay for support. If you want RHEL without support, use CentOS. The rest - there is Ubuntu (which is free, but the opportunity to support it), OpenSUSE, Fedora (there is generally only a free version)). (kost_bebix)

5. If I need to install many machines with Linux, is there a license that will allow me to buy a distribution once and install it on as many machines as I want? Or, again, is there completely free Linux?

> GNU / GPL (sl_bug)

> Yes. (Evgeny_Shiryaev)

> You can not even buy, and free to download and put on any number of machines. But if you are interested in support, then, indeed, it is better to buy. (xtreme)

> Under the terms of the Debian and Ubuntu licenses, you can install them on an unlimited number of PCs. But in Russia you have to buy a boxed version. In theory, one box per company is enough. (inkvizitor68sl)

> Yes, all of them (from popular ones): Fedora, Ubuntu, Linux Mint, OpenSUSE, Mandriva, CentOS, Debian, Slackware, Arch, Gentoo are free. (kost_bebix)

6. Are there any decent distributions "from domestic producers"?

> ALT Linux is possible (sl_bug)

> This question can not be answered objectively. Personally, in my opinion not. However, if you look at “our” distributions, look at ALT Linux. (Evgeny_Shiryaev)

> there is. InfraLinux for example. But in most cases they are paid. (just worthy) (inkvizitor68sl)

7. Are Linux distributions compatible with binary executables? Can I take a file from Ubuntu and run it on Fedora, on FreeBSD?

> can be from Ubuntu 32bit to Fedora 32bit (sl_bug)

> Linux distributions yes. On FreeBSD, you can run Linux binaries, but not directly. (Evgeny_Shiryaev)

> Usually-yes. Difficulties arise when the binary uses some of the plug-in libraries, and the source system (from which the binary) and the target (where the binary is run) have different versions of these libraries, in which different functions may, for example, be called differently or absent altogether. But, statically collected binaries are quite portable. Examples - Opera, Adobe-Flash-plugin for browsers, Skype, etc.
In FreeBSD, compatibility with Linux binaries is achieved by emulating the Linux environment for them, for which, as I remember, the usual Linux libraries from Fedora are used, plus a special module in the kernel that allows this. (xtreme)

> Linux - yes, if there are necessary shared-libraries. Linux binary compatibility >> BSD exists. But stupidly take the package and run in most cases will not work, I do not know the details. (Arceny)

> Most binaries will run in any distribution. Some programs are distributed in this form (for example, firefox from the site). Or basket. (inkvizitor68sl)

> Rarely. Watching what file. There is an Alien utility that makes .rpm from .deb packages, but this is a crutch. If you write in C ++, read about the “Opensuse Build Service” - this is the type of place where you will conveniently assemble your project for all the systems you need at once. (kost_bebix)

8. How to ensure maximum compatibility between Linux distributions at the source code level when writing C ++ programs? What libraries should I use?

> Widespread, for example Qt. Open source Included in the main repositories. (Arceny)

> Qt (GooRoo)

> Virtually any, but I personally have a warm attitude to Qt, which is also in Windows and MacOS. And so - Google will always find something abstract from the distribution for each specific task. (kost_bebix)

> Oh, yes. And, in fact, the main thing - the difference in writing under Windows. It's simple - under Windows you wrote a program that used some libraries - you shoved these libraries right into the program build and collected one large piece. In Linux, however, it is taken differently - you write a program, and then you create .deb / .rpm, which describes the libraries and their versions.

Profit:
- in Linux, if I already have this library installed - no need to download anything
- if libraries have vulnerabilities - they are updated and all those who use them are protected

Problems:
- if the distribution kit decides to use the new version (branch) of the library - everything can break. Therefore, it is necessary to cut (if you need maximum cross-distributivity) (kost_bebix)

9. Suppose you need some kind of non-standard solution, for example, some kind of special kernel call. How can you find out if this system supports this call?

> Experimentally or by asking on mailing lists, forums, developers, _ reading the documentation_. (Arceny)

> If there is a core, then there is a function. Next you need to look at the specifics. (kost_bebix)

10. Are there any good alternatives to gcc for a C ++ developer? Is gcc always part of the distribution?

> 10. icc, always (sl_bug)

> No, not always. Free alternatives do not know. (Arceny)

11. What IDEs and under which window managers (or what is it called?) Do you use for programming in C ++? What debugger?

> vim, gdb (sl_bug)

> IDE - Eclipse seems to be popular (according to a programmer friend in C ++ and Java, does not pretend to be the ultimate truth); debugger - gdb. (xtreme)

> gdb - debugger. to him are many different wrappers.
For example, for programming using Qt's GUI toolkit, I use QtCreator.
In general, there are many different IDEs. Google. (Arceny)

> If a person asks a separate question about the debugger to the IDE question, he is unlikely to get anything other than vim + gdb. IDEs usually mean an environment in which traces using hotkeys, viewing debug information, etc. are already configured. In this case, I would recommend Qt Creator, KDevelop, Code :: Blocks, Eclipse or NetBeans. (Lockal)

> In Eclipse, debugging is not very convenient, and it slows down. NetBeans is slow. KDevelop - garbage. Qt Creator is more or less (you can use it).
There is no worthy Linux alternative to VS :( Especially with regard to debugging convenience. (GooRoo)

> KDE4.3.1 + QtCreator is a good solution. I use Emacs, I write rarely in C ++. (kost_bebix)

12. What other tools for C ++ are used. I heard about valgrind as a good memory-leak detector.

> IDE - KDevelop, Eclipse, there is a gdb debugger. Then you also need to specifically look at what you need. (kost_bebix)

13. What Russian coding is used in Linux systems by default? Does the kernel support UNICODE Linux? At what level?

> utf-8 (sl_bug)

> UTF-8 today is silent. It is practically easy to make any encoding possible, even though CP866. (xtreme)

14. What is the most affordable solution to run Linux on a Windows machine? What about portable Ubuntu? Does anyone use it, is it possible to conduct a full development?

> vmware? (sl_bug)

> The best solution is to run Linux inside a virtual machine. I recommend using VirtualBox for this.

> You have already been advised by VMWare and VirtualBox. Last free (xtreme)

> LiveCD) but in general - virtualbox. Wubi \ portable Ubuntu portable is not the best option. (inkvizitor68sl)

> What does it mean to run Linux? The easiest solution is to remove Windows and install Ubuntu (kost_bebix)

:-)

Questions for C ++ programmer users.

a1. Which distribution kit do you personally use and why did you choose it?

> Debian, habit. I started using it very long ago and I don’t want to change it. Tried gentoo (cool, but all from source is long), centos / fedora (I don't like rpm) (sl_bug)

> Ubuntu. Least of all problems with setting up the distribution, a good package manager, often updated. Fedora, openSUSE, and most Ubuntu derivatives are still quite good (for the user). (Evgeny_Shiryaev)

> Debian, Ubuntu. The latter works out of the box with almost all hardware, the first is just a good non-overloaded distribution, which I put on the server and on which I deploy only the required set of packages. (Arceny)

> Mandriva Linux. It happened historically :) Some consider it a distribution for housewives, and in some ways they are right :) (GooRoo)

> Ubuntu. Just because of the popularity of everything is developed (and it should be) and sawn in the first place under it. (kost_bebix)

a2. What tools does it develop (if you lead)?

> vim, gcc, gdb (sl_bug)

> Qt + Qt Creator, for there is nothing better, but vim c emacs is not old enough. (GooRoo)

> Probably would have led with the help of QtCreator, if not hooked on Emaks. (kost_bebix)

a3. What suits and what does not suit in your Linux as a C ++ programmer?

> I don’t like it: interprocedural optimization model in gcc (does not accelerate), standard optimization -O2 (you have to add your own, or -O3), cascading error messages in boost and similar libraries. (Lockal)

> Linux is the best operating system in which I worked, but it is completely unsuitable for developing in C ++ compared to Windows. Although if you wish ...;) (GooRoo)

If it is not difficult - put the number of the question you are answering before the answer. And do not cholivar excessively (I know that I want the impossible :).

Source: https://habr.com/ru/post/69299/


All Articles