What is the equivalent of ./configure in Windows?
Sometimes I download a C/C++ library and when I use the make it, it says "use ./configure" but obviously ./configure can only be used on a Linux machine and the libraries don't usually have instructions for compiling on Windows (although they do support Windows, they don't provide instructions).
For example, the library wxSVG says it works on Windows, but when I download it I don't see any instructions for compiling on Windows, and I only Linux files for configuring it.
I just faced with the same issue and here is what I did,
I first installed MinGw using the installation manager (with msys base included). Then I go to C:\MinGW\msys\1.0\ folder in my pc, where msys.bat (to evoke the MinGW shell) and run it. Then on that bash screen, I navigated to the folder that I wanted to install initially. After that, using "./configure" and "make" worked just fine.
Actually, ./configure is not Linux-specific at all. Its original purpose was to smooth over the differences between the many variants of Unix now thankfully relegated to the dust heap of history, but nowadays it may well know how to set up things to work on Windows.
I would install the MinGW/MSYS development tools and see if the configure script is happy in that environment. (If that doesn't work, I can't help you any further.)
./configure is a script that comes with the source you have downloaded. You will use it the same on windows as you do on any other operating system. Unfortunately, you will need a posix-like shell to run it. A good option for that is to use mingw or cygwin
I'd say that this is program dependant. You see "configure" is a program/script in the local directory, it's not a global command/program (like "dir" would be)...
You either have luck to find something like "configure.bat" or "configure.cmd", or you'd have to adapt the configure-file into a BATCH-file.
You only run the ./configure command when building certain applications from source.
So Unzip it where you want to install it and then go to the folder where you unziped it and run "./configure"
Related
I have an application that I built using Qt Creator on Linux and want to deploy it now. However, I don't want to statically build it as I don't want it to be open-sourced. I tried the ldd ./YourExecutable command, however that only lists (and not add) the additional dependencies the application needs in order for it to run. My question is, how do I gather the necessary dependencies without having to individually look for these files? Is there a tool, such as windeployqt.exe on Windows, that I can use on Linux for the same purpose? Or is there a better approach than the one I'm thinking of?
Get Cygwin setup.exe: http://www.cygwin.com/
1.1. Run setup.exe and continue to package selection list.
1.2. Under Devel catagory select tools you need for compiling your source. For
example 'GNU make'.
1.3. Finish installing.
Get linux crosscompilers for cygwin:
"cygwin-gcc-linux.tar.bz2" (68.2 Mb).
md5sum: 340e91a346f5bb17e660db10e43005b8
These compilers are made with crosstool 0.28-rc37. This package contains:
gcc-3.3.4 and gcc-2.95.3 for i386 (glibc 2.1.3) and gcc-3.3.3 for amd64
(glibc 2.3.2).
Note! There is now newer version of GCC avaible with glibc 2.3.2:
"cygwin-gcc-3.3.6-glibc-2.3.2-linux.tar.bz2 (i386, x86_64)".
2.1. Copy 'cygwin-gcc-linux.tar.bz2' to 'c:\cygwin' or install directory which
you selected in setup.exe.
2.2. Open Cygwin shell and change directory to root with 'cd /'.
2.3. Uncompress to Cygwin root with command:
'tar -jxvf cygwin-gcc-linux.tar.bz2'.
Cross-compilers are installed under '/opt/crosstool'. You can use theim
directly or with commands: gcc-linux, g++-linux, gcc-linux-2.95,
g++-linux-2.95, gcc-linux-x86_64 and g++-linux-x86_64.
From: Cross-compiling on Windows for Linux
More info here.
It sounds like you want to use the shared library deployment option:
http://doc.qt.io/qt-5/linux-deployment.html#creating-the-application-package
Then if you wanted to go further than that, you could look into making a .rpm or a .deb .
There are lots of examples of qt projects that are now available on GitHub and have packages made. Usually for prebuilt binaries you need to make one for x86 and a separate one for x64.
Hope that helps.
Is is possible to compile c++ code on linux using g++ and run the code on Mac OSX? I have a few c++ programs that use one .cpp file, a few .h files, and a MakeFile altogether that produces a .o file that I typically run through the terminal. However, I'd like to find a way to send only the executable to my partner's home mac so he may review my program locally. (I've also use a few of these programs for automated math calculations, so it would be very convenient to run locally). I understand OSX typically uses .app bundles, but I'm not extremely familiar with how this works. Will the .o file (or ./a.out that's more common around here) simply run on OSX? I'd rather not install xCode on this machine if I don't have to.
Thanks a ton
It is possible to compile C++ on Linux and produce an executable on OS X. However you have to compile the code in a special way, called 'cross compilation'. It's not particularly simple to set up cross compilation and you need certain files from the platform you're targeting.
It's much simpler to just compile directly on the target platform.
If the Mac has a recent version of OS X installed you can easily install the necessary command line tools: Just try to run one of them or run the command xcode-select --install and OS X will ask to install the command line tools. (This will install just the necessary tools for compilation on the command line, and not the entire Xcode applicaiton.)
I understand OSX typically uses .app bundles, but I'm not extremely familiar with how this works.
You don't need to worry about .app bundles for simple C++ programs. OS X can run regular executable files just like linux. (Though the executable file format is different: OS X uses the Mach-O format instead of Linux's ELF format.)
Will the .o file (or ./a.out that's more common around here) simply run on OSX?
.o files, called 'object' files, don't run on their own anyway; They have to be 'linked' into an executable file. The default name for executable files created by the gcc toolchain is 'a.out' (as specified in the POSIX standard).
If you set up cross compilation to OS X then, yes, you could produce a.out files that would just run on OS X. The a.out files you produce normally for Linux , i.e. without cross compilation, won't run on OS X.
I'd rather not install xCode on this machine if I don't have to.
Xcode doesn't run on Linux anyway, so you couldn't run it. Instead you'd get a version of gcc that cross-compiles to OS X, or you'd install a different compiler, clang (and linker, lld instead of ld or gold).
A simple answer to your question is no. You cannot compile a program under linux and expect it to run on MacOSX.
However, MacOSX is just another UNIX OS under the hood and you can build your project with Make and GCC. If your partner doesn't know how to do this, I would suggest asking him to let you SSH into his machine.
However, if you're building executable on a mac you will want to install XCode. Even if you're using GCC from brew.
Another alternative is have your partner install a linux VM. He can use oracles virtual box to install linux and run your code w/in macosx.
I would suggest you sign up at Amazon for a free EC2 (Elastic Compute Cloud) account and take the free Basic Linux box. Install and build your software on Linux on there and then let your partner log into it and run it using just ssh which is already on OSX anyway. So no need to install anything on his Mac.
That way there is no need to transfer files between yourselves and update stuff when you make changes - just one environment to manage and keep up to date that you can both access from anywhere, any time.
I'm running windows XP.
I have been following this tutorial and so downloading mingw-get-inst here.
I've done this a couple times and the last time I checked boes to install EVERYTHING including, but not limited to, gcc, g++, MSYS and the MinGW Compiling Suite. I told it to make a program menu shortcut, too.
I believe I have correctly added MinGW/bin to the Environment Settings' Path.
So I have the shortcut to the MSYS shell now. It goes to C:\MinGW\msys\1.0\msys.bat, but the whole msys directory does not exist!
There are tons of "packages" have been downloaded as far as I can tell ("mingw-get show" brings up a lot!), but it doesn't seem like any of it installed correctly.
Also, should I be able to use commands like "g++ foo.cpp -o foo.exe" from cmd.exe or only from the MSYS shell? Because I was unable to use cmd.exe.
Please help!
The MSYS and MinGW installation procedure is a nightmare, and has got worse over the years. If you just want the compiler suite (no UNIX tools like sed, grep), then I suggest you go to Twilight Dragon Media and download GCC from there. If you also want all the tools, including the Bash shell, the easiest way I've found to get them is to install Git for Windows (which you may want anyway), which includes them all. And if you want a C++ IDE that works well with GCC, take a look at Code::Blocks.
What is the result of running, at a cmd.exe prompt, the command echo %Path%? It should (given what you wrote about your system) include “C:\MinGW\bin”—does it?
What is the result of running dir C:\MinGW?
Note that mingw-get show shows details of available packages—those mingw-get knows how to download and install. The installer is a bit primitive, but has gotten better over the last year or so.
If you issue the command $ echo $PATH, you'll notice it contains /mingw/bin But the /mingw directory is unavailable. To mount it, edit the MSYS fstab, adding a line like C:\MinGW /mingw For details, see the MingW Getting Started guide, more specifically section "After Installing You Should..."
You only need to add MinGW/bin to the Windows' Environment Settings' Path if you plan to use MingW's executables outside of MSYS.
I'm starting to learn Qt and I'm stuck on particular step, which is: I cannot create executable file. My steps are as follows:
Creation of *.cpp
In console typing qmake -project (this creates .pro file)
In console typing qmake -makefile (now I have makefile + some other files)
I'm trying to create .exe by typing qmake but this isn't working. I've also tried nmake, bmake and make but no results.
Any help will be appreciated.
Thank you.
It depends on what compiler you are using. If you're using GCC or MinGW, type make. If make cannot be found, either it is not installed, or it's not in your path (more likely to be the case). Try using the command prompt shortcut Qt provides you (if on Windows). If on a POSIX-based/-like system, make should exist. If it doesn't, then it depends if you're on a Mac or on Linux/BSD. On a Mac, make should come with the developer tools, which is one of the last CDs in the OS X installation CDs. If you're on Linux, use your package manager. rpm for Red Hat based systems, apt for Debian based systems, and so on. Google about them.
If you're using Visual C++ and nmake doesn't work, it could mean that nmake isn't on your path. Try using the Visual C++ command prompt instead of the normal command prompt (should be somewhere in your start menu).
It would be more helpful if you could mention how you installed Qt, and on what system.
I believe you need to do something like:
qmake -o Makefile hello.pro
Then type make or nmake depending on the compiler you use.
I've gone to http://sourceforge.net/project/showfiles.php?group_id=2435, downloaded the Automated MinGW Installer for MinGW 5.1.4 and at the same time the GNU Source-Level Debugger Release Candidate: GDB 6.8-3. I've then installed MinGW base tools into C:\MinGW. No problem so far.
However when I come to install the gdb debugger it has a lot of files and folders with the same names as some already installed but the files are different to those already installed. e.g C:\MinGW\include\bfd.h is 171 KB but gdb-6.8-mingw-3\include\bfd.h is 184 KB.
How do I add gdb to MinGW without breaking what's already installed?
In a command prompt I browsed to C:\MinGW\bin and ran:
mingw-get.exe install gdb
That fixed it for me. Not sure if it matters but I have C:\MinGW\bin in my path (guess I probably didn't need to browse to C:\MinGW\bin).
The Current Release (5.2.1) version of gdb at the project files page has always worked for me. The download is a stand-alone .exe, you don't need anything else.
But I'll bet the .exe in the 6.8 package will work, too. I'd try using just the .exe, and then if there are problems, try extracting the other files from the 6.8 package. (Though that may cause problems with the rest of the MinGW installation.)
Update: There seems to be a 7.something version. I haven't tested it thoroughly, but it seems to work, even with gcc 3.
Get Wascana Desktop Developer. It combines MinGW, gcc, Eclipse and gdb in one package.
You can safely overwrite the files prepackaged with MinGW with the (newer) ones from the gdb tarball. You can also choose not to overwrite them - just make sure to pick either one set, i.e. avoid mixing files from the older and the newer package.
Most of the offending files are probably not really relevant to you anyway. For example, the files belonging to the libbfd library aren't required for gdb's day to day operation, they're used if you want to extend the debugger or write debugging tools yourself.
At any rate, make a backup of the mingw directory before untarring the new release. It's very easy since MinGW is self-contained in that directory. That way, if anything should malfunction, you can just delete the directory and restore from the backup.
Usually for installing gdb in windows, You have to 2 ways to install:
1) use ready-made binaries that were build and compiled from GNU gdb by some provider (easy to install)
use TDM-GCC binaries provided from the following URL and that is including inturn the gcc complier and also gdb debugger.
http://tdm-gcc.tdragon.net/
use Equation package inside which GNU GDB was already compiled and built.
http://www.equation.com/servlet/equation.cmd?fa=gdb
2) use minimal mingw or cygwin package then after install gdb inside it.
Install either mingw or cygwin inside which GDB is already shipped
Open cygwin or mingw terminal and just type the following to make sure it is already installed
$ gdb --version
Hint: if you did not find gdb installed, simply open the cygwin or mingw package installer and make sure you already check gdb
Hint: getting and installing a debug build of the OHRRPGCE is providing useful information about crashes.
From cygwin or mingw terminal, Start gdb using the following
c:\mingw\bin\gdb.exe program_to_debug.exe
REF: http://rpg.hamsterrepublic.com/ohrrpgce/GDB_on_Windows
The TDM GCC/MinGW32 builds installer includes gdb. It's gcc 4.4.x with all the core binary packages required for basic Windows development, and is widely used without any unusual problems.