Global Management of Multiple Compilers in Lazarus IDE - delphi

I've been searching around the Lazarus IDE documentation for a bit, and thus far only found information related to cross compiling, so I was hoping someone could give me a straight answer on this. I'm currently working on a project that will require compilation for 32-bit Windows as well as 64-bit Windows. Additionally, I've already set up both versions of the Free Pascal Compiler. Does Lazarus have any built in functionality for configuring in both compilers, and then based on the build target, using the appropriate compiler? Ideally, this would be done at a global level, so that the configuration persists across projects, but if it can only be done at the project level, I don't mind doing it that way.

On further reading, I think I found my answer. I didn't realize it, but fpc has the same sort of front-end functionality as gcc. With that said, implementing the functionality described in my question is just a matter of installing the compiler as a cross compiler, rather than as an independent compiler. Since it doesn't look like you can use the x86_64 compiler to create a 32-bit version, you'll have to compile the 32-bit version, and then crosscompile the 64-bit version. In my case, I first compiled and installed the Win32 compiler using:
make all install INSTALL_PREFIX=C:\path\to\lazarus\1.0.8\fpc\2.6.3 OS_TARGET=win32 CPU_TARGET=i686 PP=ppc386.exe
Next, I compiled and crossinstalled the 64-bit compiler:
make crossall crossinstall INSTALL_PREFIX=C:\path\to\lazarus\1.0.8\fpc\2.6.3 OS_TARGET=win64 CPU_TARGET=x86_64
To confirm that it worked, you can find an executable called, ppcrossx64 in your C:\path\to\lazarus\1.0.8\fpc\2.6.3\bin\i386-win32 folder.

Related

I am using Mac, can I install visual C++ 2015 redistribution? because after that I want to install opencv3

Well, I am going to do some deep learning stuff with opencv.
I have already installed scikit-image and scikit-learn.
No, but you could install some C++ compiler on MacOSX.
Visual C++ is a C++ compiler and IDE for Windows (don't confuse it with Visual Studio Code, which is a cross-platform IDE). You need some compiler for MacOSX, which is a Unix variant and nearly POSIX (it could be certified to some specific POSIX standard, but I don't know which).
Probably, both GCC and Clang are available on MacOSX (see this). You need to find some packaged version of them, perhaps with brew; both compilers work really well. Apple is partly funding Clang. GCC is funded by many other corporations. They both are open source compilers, but with a different license (GCC is mostly GPLv3+). GCC is probably producing some faster code (when optimizing, faster by a few percents only). Clang is probably giving better diagnostics. I actually recommend installing both of them (and using occasionally both of them too).
Take care to install recent versions of GCC & Clang. Both are very active projects, and are progressing quite well.
You probably need to install other things too. E.g. a build automation tool (like GNU make), a version control system (like git), a source code editor (like emacs or vim).
You might even install some fancy IDE like Clion, Code::Blocks, XCode, etc.. I recommend avoiding that, because you need to learn how to compile on the command line. These fancy tools are running the command line compiler under the hoods, and you really need to understand what they are doing (and hiding from you). Actually C and C++ are somehow not IDE friendly (you really need to understand what the compiler is doing). In both C11 specification (n1570) and in C++11 specification (n3337) the notion of translation unit and of preprocessing is important (and sadly, IDEs tend to hide these notions).
As remarked in comments, you could install the XCode package (which pulls useful packages like GCC or Clang, etc...), but avoid using the XCode IDE.

VS2015 x86 LIbraries are not in OpenCV 3.1

I've just downloaded the most recent OpenCV Version from the website as I need the VC14 compiled DLLs. They don't have x86 compiled VC14 DLLs though unlike VC12.
Is there a reason for this that I am missing? Do I need to compile them myself? What's the reason for the change?
No, there is no specific reason. You probably should compile it yourself.
Side notes:
Be aware that you can not compile it with CUDA on VS2015 until you
have CUDA 8.0.
If you want to activate vtx, you should disable compiler optimization while building, which is not a good option.
Just an opinion, I think those two reasons may explain why they did not pre-built it.

Which IDE in order to install and use a compiler with C++14 constexpr relaxation?

I apologize if this question is out of topic, but it's a matter of accessibility for C++14 programmers.
Today i've updated Qt v5.4 on my PC (Windows 8.1/64bit/x86) and it support now the gcc compiler v4.9.2. But i've seen that constexpr relaxation (which really interest me) is available since gcc v5.1.
A search on google shows that :
clang is the better compiler for C++14 latest features (v3.6 is even dealing with experimental C++17)
clang is not easily suitable with Qt libraries
both gcc and clang "datas" are downloadable but i'm not an expert...
So i'm asking how to get a free IDE on Windows 8.1 with an adequate compiler.
If i dismiss Qt for my C++14 experiments, is Codeblocks a better solution ?
Does any else IDE already include an adequate compiler during the installation ?
Where can i find help to install such a compiler ?
Your question is poorly phrased -- for the most part, ide's and compilers are decoupled -- the exception that comes to mind is visual studio, which is an ide that is tightly coupled to microsoft's compiler.
Whether you chose codeblocks, or eclipse, or use a simple text editor, you should be able to choose your compiler fairly easily, and independently of your ide. So you have two independent questions: Where can you get a free compiler for windows with high standards compliance, and what's a good IDE with which to use that compiler.
I'm not a windows person, but very simple, one-file projects, you might actually find it easy to use a gnu-linux environment, which you can do under windows by using cygwin:
http://preshing.com/20141108/how-to-install-the-latest-gcc-on-windows/
This may seem daunting at first, but let me tell you the benefits:
you'll learn the difference between your compiler and editor.
As long as you are only experimenting with the standard, you may find it simpler to get set up than using an ide.
You'll have to learn about the c++ compile process (compiling, linking, possibly preprocessing), not about ide specific stuff.
This will prevent you from conflating ide-specific stuff with c++ stuff, as you have done in your question. As you begin working with projects you'll probably find an ide an advantage, but in the beginning staying close to the raw tools may give you the fastest learning return on investment.
After install cygwin, all you have to do is write your code (using a syntax highlighting editor like gedit or emacs is suggested), and then run
g++ -std=c++14 filename.cpp
to compile your code.
You should be able to use clang under cygwin as well.

compiled vala itself with vala on windows

I'm not sure if this question is correct but...
Ok, is possible compiled the source vala in vala
because I bean downloading vala source code and inside has many vala files
here vala release source code
https://wiki.gnome.org/Vala/Release
I have been installed on windows this version
https://code.google.com/p/vala-win32/downloads/list
vala-0.12.0.exe
I wont compile the last vala release whit the vala on windows
oky, gracias :D
please, not confused with this question,
Compiling a Vala source On Windows
If 0.20.1 is enough, you can use http://www.tarnyko.net/en/?q=node/35 and possibly avoid this whole thing.
If you really need 0.22.0, Vala release tarballs don't actually require valac to compile—they contain all the generated C. You should be able to use the build system included with Vala (like Robert Rozas mentioned, or via cygwin) to generate executables even without valac installed.
GNOME wiki recommends using either MSYS2 or WSL (Windows 10 only) to get Vala compiler. Another option is using ValaForWindows, which aims to be the easiest option to install and use.

Building cross-platform Delphi applications

I downloaded Lazarus, but have worked with Embarcadero Delphi IDE too. I have a question about building cross-platform Delphi applications.
How can I build them under win32 environment? I read the wiki from Lazarus site, that explains how to do it, but I still do not understand it. Is is possible to build and compile application under win32 environment for Linux and MacOS? If it is possible, can someone explain ste-by-step how to do it exactly.
EDIT:
Now is the time for talking about the new XE2 version of the Delphi IDE I think :)
Thanks
What you're asking for already exists in the lazarus wiki site, you need to read these articles.
Multiplatform Programming Guide
Cross compiling
Cross compiling for Win32 under Linux
How to Write Portable Code (nice doc from Marco van de Voort)
Buildfaq
While crosscompiling to a non windows target is possible (and not that hard), getting used to fpc/lazarus and crosscompiling in one first step is a bridge too far. This because Linux is not a very homogenous target and dealing with this variation requires some understanding how libraries and linking works on Linux. This defeats one-button downloadable cross-compile setups to "general" linux. I know, such one-button thingies that work out of the box for everyone would be great, but it is just not going to happen (or only forvery limited distribution-version combinations)
Crosscompiling with FPC is not extremely difficult or rocket science, but the amount of jargon and details can flabbergast uninitiated people, and without background knowledge it is hard to diagnose problems as a result of minor misconfigurations
I recommend to first familiarize yourself with Lazarus/FPC, and only then make the crosscompilation leap. (and the already mentioned buildfaq names some reasons).
Bottomline: install lazarus on Windows and start porting your app. If that succeeds, start using a linux install (or VM) to familiarize yourself with Linux, and Lazarus under it. You'll need a linux install anyway to test.
Only then start thinking about crosscompiling to speed up the process.
CodeTyphon is a powerful Lazarus/FPC one click easy installation package for cross platform native development. It already supports 4 CPU/OS hosts (Win32, Win64, Linux32, Linux64), and 16 CPU/OS targets (arm-Wince, arm-Linux, arm-Embedded, arm-gba, arm-nds, i386-Win32, i386-Linux, i386-FreeBSD, i386-Haiku, x86_64-Win64, x86_64-Linux, x86_64-FreeBSD, powerpc-Linux, powerpc64-Linux, sparc-Linux, sparc-Solaris). More are supported in Lazarus/FreePascal, but others are not yet integrated in CodeTyphon. Did I mention that it is free? One code to rule them all ;-)
The point is that you don't have to waste days for setting up your cross platform environment, since someone has already done the hard work for you.

Resources