I use conan as a dependency manager for a large C++ project. The project was built for Linux and I am porting it to Windows.
Due to this I am compiling with mingwin since that development environment is closer to mine.
However, conan knows it's running on windows and so it downloads windows binaries.
I am finding that although compilation works, linking fails because mingwin binaries and MSVC binaries are incompatible.
I am not sure if I need to try to instruct meson (my build system) to use cl as the compiler, or trick conan to download Linux libraries instead of windows.
Related
I am building an application using Qt C++ and I want it to run on windows computers without having to install VC Redistributables. Apparently when user tries to run the application an error pops that says that VCRUNTIME140.dll is missing.
Build both Qt and your application using compiler option /MT?
https://learn.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-170
I recommend using GCC (i.e. MinGW) as the compiler. If you do that, your app will generall depend on the msvcrt.dll that comes with Windows and doesn't need to be installed specially (but it depends on exactly how the GCC compiler is configured). It will also possibly depend on some GCC runtime library DLLs that you can just put in the same directory as your EXE.
MSYS2 is a good development environment for using MinGW on Windows: https://msys2.org
I also made a useful set of tools that is capable of cross-compiling statically-linked MinGW/Qt applications from Linux: https://github.com/DavidEGrayson/nixcrpkgs
The Qt applications I build with nixcrpkgs come out as single, standalone EXEs that do not need to be shipped with any DLLs.
Currently, I'm developing a C/C++ Application with the following characteristics:
Multiple target platforms - ARM (Raspbian) and manufacturer-modified x86 distribution
CMake is used to compile C/C++ application
Cross-compilation for ARM and the customized x86 distribution => with CMake (and toolchains to cover cross compilation)
Multiple dependencies (other github repositories) which are separately cross-compiled (according to github READMEs). These are referenced in the CMake of the project. The CMake decides if it uses the ARM or x86 libs.
For deploying I copy the cross-compiled dependency libs to /usr/lib on the target. Afterwards, the cross-compiled application can be launched on the target.
As cross-compilation is very annoying because it's full of pitfalls and I'll need many more dependencies in future, I decided to move to another build system to make things easier:
My goal is to get a rpm/deb file which can be easily installed on the target systems
After a few hours of research, I found out that via Yocto cross-compilation can be managed easier. In addition, it's possible to build deb/rpm/... files which can be installed on the targets.
Anyhow, as far as I understood, this deb/rpm/... file can be only installed on the yocto distribution/image which has been used for compiling => In other words, I would have to flash a completely new distribution on our targets (raspberry & x86). Unfortunately, this is no option for me (because of the custom x86 target).
Question 1: Is it correct that I have to replace the distributions on the targets in order to install the created packages?
Question 2: Is there a way how to create cross-compiled deb files which can be installed on existing distributions? If yes, what do I have to do to achieve this?
I assume that my current build strategy isn't the best. If you have any idea how to make it better, feel free to let me know.
Thanks,
Christoph
I regularly use Code::Blocks and MinGW for my C/C++ projects. I would like to be able to use OpenCV, since it has a nice library for computer vision projects. They have dropped support for MinGW. I have heard you can build it on your own somehow, but I have no experience doing this with 3rd party libraries. Can someone explain how to build it in a simple way for MinGW?
There is, or at least there was at least until 2.4.6, precompiled version of opencv that works out of the box with mingw as long as you use the dw2(standard) version of mingw.
since i needed sjlj support i had to build my own version of openCV 2.4.6
I did he following - i am pretty sure it will work for the current openCV version as well
Setup your preferred Mingw Environment - i would strongly recommend to use gcc 4.5 or newer
Intstall Msys
Intall Cmake - you can get a binary package
Start the Cmake GUI
Select the openCV source folder
Click Configure and select MSYS-Makfiles
Errors in the first run of Configure might be resolved if you run Configure again
Click Generate
use MSYS make to run the generated makefile
Copy all desired libraries and include files to your mingw-installation or your project
I have an Eclipse project that I want to compile on both Ubuntu and Windows.
I am using boost libraries (specifically asio) which require including the libboost_system...* library. I have compiled boost on both Windows and Ubuntu and ended up with libboost_system_mgw48-mt-1_55.a on Windows and libboost_system.a, libboost_system.so, libboost_system.so.1.55.0 on Ubuntu.
I'm not sure which Ubuntu library I need to include but the bigger issue is how to include both the Windows and Ubuntu library but only on the right OS.
I am using the MinGW toolchain on Windows which by my understanding is more or less GCC? I am then assuming that I should simply use GCC on Ubuntu to have the same compile process.
Windows boost build commands:
bootstrap.bat mingw
b2 toolset=gcc
Ubuntu boost build commands:
bootstrap.sh
b2
Can Eclipse get the OS in use on a per install basis that I can access via a globally recognizable variable?
How can I then, assuming yes, use that information to conditionally include only the right libraries?
The solution I came up with was to use two configurations: Debug-Win32 and Debug-Unix in the project properties. This keeps track of independent library & path configurations as well as different tool chains while still pulling from the same code base.
I am new to both Qt and Linux C++ development (although I have many years C and C++ development experience on Windows).
I have some legacy C projects (source files and headers - [not using Qt]) that I want to compile into shared libs on Linux.
I am proposing to store my projects under the following structure:
/home/username/Projects/project_name
/home/username/Projects/project_name/src
/home/username/Projects/project_name/build
Can anyone tell me how to do the following (using Qt to simplify the build process)
Create different build configurations (debug, release etc)
Build a configuration to create the appropriate shared library
As an aside, I have only recently installed Ubuntu 9.10 and the only C/C++ development tool I have installed (using SPM) in Qt - so I dont know if I need to install some other GNU C++ tools.
BTW I have already checked and have gcc (v4.4.1) available on my machine. I do not appear to have g++ though - I do not know whether this is significant or not.
An Ubuntu system doesn't come with build tool chain by default. Instead it has a meta package that you will need to install:
sudo apt-get install build-essential
This will install, among other the g++ compiler, although I am not sure about the Qt headers an such. For them you will need the qt4-dev package (I assume you wish to work with qt4 rather then qt3).
As for the bould structure, you will want to consult the qmake manual, or you might want to consider using CMake (apt-get install cmake) instead. CMake allow for out of build sources, as you require, and personally, I can't recommend it enough.