Building 64bit application with makefiles using cmake-gui - 64-bit

When I run cmake-gui and hit configure, I can specify the generator for my project. I can choose Visual Studio solution, Eclipse, makefiles etc...
I am on 64bit system and want to build 64bit application. Till now, I used Visual Studio 10 Win64 generator to generate my solutions. No I want to (have to) build it with makefiles. But there is no options 32b/64b.
Are makefiles for 64bit build used by default (on 64b system) and for 32b only after using something like export CFLAGS=-m32 inside my cmake files?

Are makefiles for 64bit build used by default (on 64b system)
Right.
and for 32b only after using something like export CFLAGS=-m32 inside my cmake files?
Right. The relevant variable is called CMAKE_C_FLAGS though.

Related

scons environment configuration from Linux to Windows

I have a scons scrip that specifies Boost libraries. This script is specific to Linux.
env.Append(LINKFLAGS=['-lboost_program_options', '-lboost_filesystem', '-lboost_system'])
env.Append(CXXFLAGS=['-std=c++17', '-lboost_program_options', '-lboost_filesystem', '-lboost_system'])
env.Append(LIBS=['-lboost_program_options', '-lboost_filesystem', '-lboost_system' ])
I want to install the application on a Windows machine and have installed Boost on the Windows machine. But how to modify the scons script to point to Boost? The -std=c++17 is easy since Visual Studio can toggle standard from C/C++ Language in the Project setting. Don't know where to set boost_program_options, boost_filesystem, and boost_system in the script.
Some of this is incorrect for any platform. Here's what would be correct for linux.
env.Append(CXXFLAGS=['-std=c++17'])
env.Append(LIBS=['boost_program_options', 'boost_filesystem', 'boost_system' ])
Here's what would be correct for windows:
env.Append(CXXFLAGS=['/std:c++17'])
env.Append(LIBS=['boost_program_options', 'boost_filesystem', 'boost_system' ])
You should not specify -lLIBRARY_NAME anywhere for SCons.
Just the LIBRARY_NAME in LIBS.
You'll need to specify LIBPATH to point to the libraries on windows. (Or perhaps env['ENV']['PATH'] as well)

Which IDE and toolchain on Windows to generate a program for an embedded arm linux?

I usually work on linux when i have a linux target but this time i must work from a Windows based computer and must keep all my work on Windows.
I tried with Code::blocks and GNUARM, the build has no problem but can't be runned on the target.
When using code sourcery G++ i can build with command a single .c file and it runs on my board.
When i try to put the sourcery g++ exécutables in a toolchain configuration in code::blocks the software seems to build with no error but is generating nothing...
Now i would like to go a step further an build a project, no more single files, and i don't seems to be able to find a solution to this problem.
Does anyone here has experience from this kind of situation ?
I finally got it to work, here is a little explanation on how i did it : first i installed the jdk and eclipse, the code sourcery g++ lite and finally the gnu arm Tools (not the gnu arm plugin). I then went into the toolchain configuration in eclipse and changed the Tools "cs-make" and "cs-rm" from code sourcery to the "make" and "rm" from the gnu arm Tools kit. I changed the format from c++11 to c++9 too and now i am generated a elf file which run on my board.

How can I build gettext 64bit dll on Windows.

I succeeded to build gettext 32bit dll on Windows.
I installed these.
gettext-0.18.11
mingw (include msys)
./configure --prefix=/mingw --enable-threads=win32 --enable-relocatable
cd gettext-runtime
make
But I don't know how to build 64bit dll.
Someone said I should use mingw64. Then I installed mingw64 and msys.
But I don't know how to do setting mingw64 and msys to build 64bit dll.
And I don't know gettext configure option to build 64bit dll.
Thanks.
Download latest MinGW-w64 targeting 64-bit (there are also targeting 32-bit, so be careful) here.
NOTE: As you added --enable-threads=win32, then probably you would be interested in the distribution with Win32 threading support, rather than POSIX, so be cautious when you choose which one to download.
Configure in almost the same way, but with addition of one option:
./configure --build=x86_64-w64-mingw32 --prefix=/mingw --enable-threads=win32 --enable-relocatable
Lean back. :)
First download gettex from here: https://mlocati.github.io/articles/gettext-iconv-windows.html
then add system var PATH: C:\Program Files\gettext-iconv\bin
afterwards
create in your project a folder that bears the note of
locale/
afterwards
add variable in settings.py: LOCALE_PATHS = (BASE_DIR + 'locale/', )
and
finally try to run
python manage.py makemessages -l fr

Cross-platform build under Windows targeting Linux using CMake

I am developing a software in C++ on windows 32-bit (using MSVC++), but since I want to be able to use my software on every platform, I have decided to use CMake as my build generator.
Therefore, I am still just a beginner in CMake. From the CMake tutorials, I understand that in order to cross compile codes, first a toolchain simulating the target platform should be installed on the host platform. Then using the appropriate target-platform C and C++ compilers provided by this toolchain, CMake would be able to generate makefiles etc.
Now, I want to build my code for Linux platform(GNU/Linux) on a Win32 platform. I tried doing the above procedure using CMake combined with Cygwin and using gcc and g++ as compilers. It built fine, created makefiles, and when I issued "make" in Cygwin terminal, the generated makefiles were "made". Now I have got an executable which I was hoping would run on Linux platform. But on Linux I get the error: bash cannot execute binary file.
Using command file executablename, I realized the executable which is made by the above procedure is of type PE32 which is only for Windows.
Now my question is: Is my understanding of cross-platform build procedure using cmake correct?Or should I just use another Linux toolchain under windows to get a Linux ELF executable? What toolchains come to your mind which would give me what I want?
Many thanks
Setareh
You will want to look here: cmake-toolchains(7) if you do cross compiling. However, I would suggest that you install a Linux VM like virtual box on your windows machine and build naively on Linux. It will compile much faster and you will not have to worry about cross compiling. You can mount the windows disk from the linux VM so you can share the same source tree. The linux VM will compile much faster than gcc running under windows.
Your understanding of CMake is correct... it will determine how to create the build system you request (or is default for the platform you are currently on) based on rules in your CMakeLists.txt file. However, this won't necessarily help you compile for linux on a windows machine if you don't have something installed that can target linux.
To compile targeting linux, you will need to use a linux compiler. The link posted by #stjin tells you how to install one on cygwin. Then, to set up your CMake build, do this in the terminal:
CC=gcc-linux CXX=g++-linux cmake . [options]
This will tell CMake to locate the special linux targeted compilers. Hopefuly, after compiling with these compilers you will be able to run on linux.

How can I cross compile my Linux application to get a Windows executable in Linux?

I need to cross compile my QT application in Linux. I compiled my application from the QT SDK in Linux and it is working properly.
How do I create an .exe for the same application in Linux. I have installed Mingw in Linux and qmake, but I dont know how to proceed with cross compiling.
How do I link my QT with a cross compiler like MinGW and Qmake. I am using SuSE Linux. I have also gone through http://Silmore/29 but I am not getting a clear picture of how to proceed futher.
I'm not familiar with SuSE, but Ubuntu has the mingw32 packages which is a windows targetted cross compiler, along with the open source win32api:
(source: liranuna.com)
After a small search, turns out there are RPMs for it here, while it should probably be in your repositories.
Basically, you use your cross-toolchain for the Make process rather than the host toolchain. I assume there is no autotools configure script. If there is you can run configure with --host specified and have it all figured out for you.
So what you'll need to do is set CC, LD, CFLAGs, LDFLAGS (probably also CXX and CXXFLAGS) and modify the Makefile to use the right QT libraries - which will need to be mingw, not your Linux libraries. So you may also need to obtain the MinGW/Windows QT SDK and store it separately so your paths cam be specified properly.
Hope this helps!
You could run the Visual C++ Express Edition 2008 cl.exe through wine to compile your project.

Resources