I am writing a program in QT Creator, for the x86 architecture, using Debian 9 x86. The program will use GNU Readline library [8.0]. Also, my program must be statically built (QT is already statically built). For this I downloaded Readline from here.
Then performed the configuration for the static assembly:
./configure —prefix=/home/out/readlinelibs/ —enable-static —with-curses
then i performed the construction:
make
and installing libraries
make install
In QT's pro file I added the path to the libraries:
LIBS += -L/home/out/readlinelibs/lib -static -lreadline -ltinfo
When compiling the program I get the following error in QT:
error: cannot find -ltinfo
How to build readline in static mode? Thanks.
P.S.: in Debian x64 I also built readline and everything works well.
It was the lack of a tinfo library, as mbieren advised. I performed the installation on a 64-bit system as follows:
Added ability to install 32-bit packages:
sudo dpkg --add-architecture i386
I scanned the package and found that i need. You can do the scan so:
sudo apt-cache search tinfo
Finally i installed that i need:
sudo apt-get install lib32tinfo5 lib32tinfo-dev
Now the compilation of my program for 32-bit architecture is completed successfully!
Related
I am trying to build an embedded program using "make all" with the GNU ARM toolchain, but it is not working yet.
I installed it with xpm according to this website with the xpm installer:
https://gnu-mcu-eclipse.github.io/toolchain/arm/install/
Now when I try to build my program using "make all", I get following error:
$ make all
Collecting dependencies for: Bsp/....cpp
/bin/sh: Zeile 1: arm-none-eabi-gcc: Command not found-
...
The file is of course located in the xpack location:
C:\Users\\AppData\Roaming\xPacks
while the normal mingw64 binaries are in another location. How exactly can I use arm-none-eabi-gcc now or how can I edit the PATH variables of msys2 to use the xpm packages?
There is also a similar toolchain here:
https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa
But I guess I can not install this without something like Linux subsystem...
If you downloaded arm-none-eabi-gcc separately from MSYS2, then after starting your MSYS2 shell, you need to add whatever directory contains arm-none-eabi-gcc.exe to your PATH environment variable by running a command like this:
export PATH=$PATH:/c/Users/path/to/bindir/
You can test it by running arm-none-eabi-gcc in the shell with no arguments, and also running which arm-none-eabi-gcc.
The main place to download such a toolchain is here:
https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain
You can install arm-none-eabi-gcc on MSYS2 using its package manager.
Start MSYS2 using mingw64.exe (or the equivalent shortcut) and then install the toolchain by running:
pacman -S mingw-w64-x86_64-arm-none-eabi-gcc
Now arm-none-eabi-gcc should be on your PATH without any additional work.
I am trying to build the freetype library I got from here: http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz But I am really failing to do so.
I am using Cent OS 6.5, and the compiler is g++ 4.8.2. I need the library to be release, static and 64 bit. Is there anyone who can explain this in simple steps, please?
I am trying to compile my program and I am getting an error telling me I need some freetype .so file.
Before building it myself, I would try
yum install freetype2-devel
If that doesn't install the library you need, you can try configure with something like (enable-static for static build and the target triplet)
./configure --enable-static x86_64-pc-linux-gnu
Then you can build it by running
make
Finally, you can install it by running
sudo make install
I'm trying to compile gcc/g++ 4.8 on a 64-bit Fedora 17 server. I'm configuring the build process wit
./configure --prefix=/opt/gcc-4.8 --with-cpu=x86-64 --enable-languages=c,c++ --disable-multiarch
I then run make. The build chunks along for a while and then fails when it can't find crti.o. I noticed that the compile steps prior to the failure use -m32 option which means the compile is being performed for a 32-bit architecture. When I searched for crti.o, I found it in the /usr/lib64 path, not the /usr/lib path, which typically is for 32-bits. I only want to compile for 64-bit, which is why I included the with-cpu argument to configure. Obviously, this isn't enough.
What arguments do I need to include in configure so that only 64-bit compiles are made of the source and only 64-bit system libraries and similar files are linked?
I am also using 64-bit fc17 and have crti.o:
$ locate crti.o
/usr/lib/crti.o
/usr/lib64/crti.o
$ rpm -qf /usr/lib/crti.o
glibc-devel-2.15-58.fc17.i686
$ rpm -qf /usr/lib64/crti.o
glibc-devel-2.15-58.fc17.x86_64
Try to explicitly install the 32-bit version of glibc-devel:
yum install glibc-devel.i686
I have written some effects in C++ (g++) using freeglut on Linux, and I compile them with
g++ -Wall -lglut part8.cpp -o part8
So I was wondering if it is possible to have g++ make static compiled Windows executables that contains everything needed?
I don't have Windows, so it would be really cool, if I could do that on Linux :)
mingw32 exists as a package for Linux. You can cross-compile and -link Windows applications with it. There's a tutorial here at the Code::Blocks forum. Mind that the command changes to x86_64-w64-mingw32-gcc-win32, for example.
Ubuntu, for example, has MinGW in its repositories:
$ apt-cache search mingw
[...]
g++-mingw-w64 - GNU C++ compiler for MinGW-w64
gcc-mingw-w64 - GNU C compiler for MinGW-w64
mingw-w64 - Development environment targeting 32- and 64-bit Windows
[...]
Suggested method gave me error on Ubuntu 16.04: E: Unable to locate package mingw32
===========================================================================
To install this package on Ubuntu please use following:
sudo apt-get install mingw-w64
After install you can use it:
x86_64-w64-mingw32-g++
Please note!
For 64-bit use: x86_64-w64-mingw32-g++
For 32-bit use: i686-w64-mingw32-g++
One option of compiling for Windows in Linux is via mingw. I found a very helpful tutorial here.
To install mingw32 on Debian based systems, run the following command:
sudo apt-get install mingw32
To compile your code, you can use something like:
i586-mingw32msvc-g++ -o myApp.exe myApp.cpp
You'll sometimes want to test the new Windows application directly in Linux. You can use wine for that, although you should always keep in mind that wine could have bugs. This means that you might not be sure that a bug is in wine, your program, or both, so only use wine for general testing.
To install wine, run:
sudo apt-get install wine
Install a cross compiler, like mingw64 from your package manager.
Then compile in the following way: instead of simply calling gcc call i686-w64-mingw32-gcc for 32-bit Windows or x86_64-w64-mingw32-gcc" for 64-bit Windows. I would also use the --static option, as the target system may not have all the libraries.
If you want to compile other language, like Fortran, replace -gcc with -gfortran in the previous commands.
I've used mingw on Linux to make Windows executables in C, I suspect C++ would work as well.
I have a project, ELLCC, that packages clang and other things as a cross compiler tool chain. I use it to compile clang (C++), binutils, and GDB for Windows. Follow the download link at ellcc.org for pre-compiled binaries for several Linux hosts.
From: https://fedoraproject.org/wiki/MinGW/Tutorial
As of Fedora 17 it is possible to easily build (cross-compile) binaries for the win32 and win64 targets. This is realized using the mingw-w64 toolchain: http://mingw-w64.sf.net/. Using this toolchain allows you to build binaries for the following programming languages: C, C++, Objective-C, Objective-C++ and Fortran.
"Tips and tricks for using the Windows cross-compiler": https://fedoraproject.org/wiki/MinGW/Tips
For Fedora:
# Fedora 18 or greater
sudo dnf group install "MinGW cross-compiler"
# Or (not recommended, because of its deprecation)
sudo yum groupinstall -y "MinGW cross-compiler"
Is there a manual for cross-compiling a C++ application from Linux to Windows?
Just that. I would like some information (links, reference, examples...) to guide me to do that.
I don't even know if it's possible.
My objective is to compile a program in Linux and get a .exe file that I can run under Windows.
The basics are not too difficult:
sudo apt-get install mingw32
cat > main.c <<EOF
int main()
{
printf("Hello, World!");
}
EOF
i586-mingw32msvc-cc main.c -o hello.exe
Replace apt-get with yum, or whatever your Linux distro uses. That will generate a hello.exe for Windows.
Once you get your head around that, you could use autotools, and set CC=i586-mingw32msvc-cc
CC=i586-mingw32msvc-cc ./configure && make
Or use CMake and a toolchain file to manage the build. More difficult still is adding native cross libraries. Usually they are stored in /usr/cross/i586-mingw32msvc/{include,lib} and you would need to add those paths in separately in the configure step of the build process.
It depends on what you mean (I couldn't really say).
If you mean that you want to use an existing Linux application on Windows, then you could try compiling it using Cygwin on Windows. This however does not give you a Windows executable free from all dependencies towards Cygwin (your executable still depends on the cygwin.dll file) - and it still may need some porting before it will work. See http://www.cygwin.com.
If you mean that you want to be able to perform the actual compilation of a Windows application on Linux and produce a .exe file that is executable on Windows - thus using your Linux box for development and/or compilation then you should look into MinGW for Linux which is a tool for crosscompiling for Windows on Linux. See http://www.mingw.org/wiki/LinuxCrossMinGW.
Best regards!
I suggest you give the following, GUB (Grand Unified Builder) a try as it cross-compiles several packages with their dependencies and assembles them into a single installation package for currently 11 architectures. You can download a prebuilt iso for installation in a VM from here and follow the source here. It can currently be used to cross-compile GNU LilyPond/ GNU Denemo / Inkscape and OpenOffice.org.
The target architectures are:
darwin-ppc - tar.bz2 file for Darwin 7 (MacOS 10.3)/PowerPC
darwin-x86 - tar.bz2 file for Darwin 8 (MacOS 10.4)/x86
mingw - mingw executable for Windows32
linux-x86 - shar archive for Linux/x86
linux-64 - shar archive for Linux/x86_64
linux-ppc - shar archive for Linux/PowerPC
freebsd-x86 - shar archive for FreeBSD 4/x86
freebsd-64 - shar archive for FreeBSD 6/x86_64
cygwin - .tar.bz2 packages for Cygwin/Windows32
arm - shar archive for Linux/ARM (largely untested)
debian - shar archive for Debian (largely untested)