help with building GMP

Started by
7 comments, last by Storyyeller 13 years, 9 months ago
I am trying to use GMP with Code::Blocks on Windows 7, but I can't figure out how to get it working.

The instructions for building GMP say to do
./configure
make
make check

but ./configure isn't a recognized command. Neither is configure

After some searching, I decided to try MPIR, which is supposed to be a more Windows friendly fork of GMP, but the build instructions were the exact same!

After that, I tried installing MSYS, but I still can't get anything to work.
I trust exceptions about as far as I can throw them.
Advertisement
That's *nix stuff... Are you sure that thing supports Windows? (I didn't check it, the documentation should tell you) Are you sure you're reading the instructions for building them on Windows, if they do?
Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.
Quote:After that, I tried installing MSYS, but I still can't get anything to work.

Could you elaborate on this? I've downloaded, built and successfully checked the newest version of GMP under MSYS in about 10 minutes.

There are a few problems I can think about and that you might want to check:

  1. Make sure that $PATH includes the folders where gcc.exe, g++.exe and make.exe are. Check both MSYS/etc/profile for the PATH env. variable and MSYS/etc/fstab for the mount point of MinGW;

  2. You are using MinGW make instead of MSYS make. They're a bit different, and when operating inside the MSYS shell, use the appropriate version or you might have problems;

  3. You are using stuff that are just too old. For example, check that you've got make 3.81. As a general rule about mingw.org, automatic installers == old versions. To make sure you've got the most recent ones, you have to manually download each package. It's a bit (maybe this should be "a LOT") painful, but I'd say it's the only "reliable" way of doing this.

Here's my etc\profile file. gcc.exe and g++.exe are in the folder "C:\Program Files\CodeBlocks\MinGW\bin"

There's no make.exe in that folder but there is something called mingw32-make.exe

I can't understand how the profile file works. Do I need to change anything?

# Copyright (C) 2001, 2002  Earnie Boyd  <earnie@users.sf.net># This file is part of the Minimal SYStem.#   http://www.mingw.org/msys.shtml# #         File:	profile#  Description:	Shell environment initialization script# Last Revised:	2002.05.04if [ -z "$MSYSTEM" ]; then  MSYSTEM=MINGW32fi# My decision to add a . to the PATH and as the first item in the path list# is to mimick the Win32 method of finding executables.## I filter the PATH value setting in order to get ready for self hosting the# MSYS runtime and wanting different paths searched first for files.if [ $MSYSTEM == MINGW32 ]; then  export PATH=".:/usr/local/bin:/mingw/bin:/bin:$PATH"else  export PATH=".:/usr/local/bin:/bin:/mingw/bin:$PATH"fiif [ -z "$USERNAME" ]; then  LOGNAME="`id -un`"else  LOGNAME="$USERNAME"fi# Set up USER's home directoryif [ -z "$HOME" ]; then  HOME="/home/$LOGNAME"fiif [ ! -d "$HOME" ]; then  mkdir -p "$HOME"  cp /etc/inputrc.default "$HOME"/.inputrcfiif [ "x$HISTFILE" == "x/.bash_history" ]; then  HISTFILE=$HOME/.bash_historyfiexport HOME LOGNAME MSYSTEM HISTFILEfor i in /etc/profile.d/*.sh ; do  if [ -f $i ]; then    . $i  fidoneexport MAKE_MODE=unixexport PS1='\[\033]0;$MSYSTEM:\w\007\033[32m\]\u@\h \[\033[33m\w\033[0m\]$ 'alias clear=clsbcd "$HOME"


Also, here's etc/fstab for good measure. I think I've got that one set correctly though.

#Win32_Path		Mount_Pointc:/Program Files/CodeBlocks/MinGW		/mingwc:/ActiveState/perl	/perl
I trust exceptions about as far as I can throw them.
Just a tip: when dealing with unix-like tools, you are strongly advised *not* to use directories that contain spaces. Some tools won't parse these as part of the folder name and instead treat the first and second part as separate entries. Many times it will simply fail, but the results clearly won't be what you want.

Place that MinGW folder somewhere else, such as C:\MinGW just for safety. Change the fstab again and you're almost done. (Just to make sure: you've got MSYS/etc/fstab and not fstab.sample, right? If that's not the case, just copy the file and remove the ".sample" extension)

Next, get a recent copy of make here and extract it into your MSYS folder. When you're done, type make --version to make sure it is a MSYS build and it is version 3.81.

cd into the directory where you downloaded GMP and follow the build instructions as usual. (note: you might want to run ./configure --prefix=/mingw instead of just ./configure so that make install copies everything to the MinGW folder, and not /usr/local)

Ok, I copied everything to C:/MinGW and changed etc/fstab
I downloaded make.exe and make --version reported that it was version 3.81, built for i686-pc-msys

Unfortunately, .\configure still isn't recognized as a command.
I trust exceptions about as far as I can throw them.
Is there any reason that you're trying to compile it yourself? Last I checked, GMP was available for download from the MinGW's sourceforge page.
Quote:Last I checked, GMP was available for download from the MinGW's sourceforge page.
Now that you mention it, if he's using gcc 4.4 or above, it won't even run without GMP.. My bad.

Quote:Unfortunately, .\configure still isn't recognized as a command.
As SiCrane pointed out, if you are using gcc 4.4 or something newer, you actually need GMP to run it. If it's an older version you should be thinking about getting a newer one anyway. For the newer version you can just drop the GMP dev packages available at the site linked in the above reply and you're done..

Just not to let this without a response, "configure" isn't a command, it is a script that is used to prepare the build process for your system. As such, when typing "./configure", you're telling the shell that you want to run something that is in the same folder as you are (the dot-slash) and that the script is called "configure". In order to run it this way, you have to be in the same folder where the script resides. After that type ./configure. And note that "./" is different from ".\".
Ok, I got the version from GCC working. Thanks!

One other question: is there anyway to use a single dll with CodeBlocks instead of having a copy in the folder of every target? (Debug/Release)

[Edited by - Storyyeller on July 3, 2010 9:37:25 PM]
I trust exceptions about as far as I can throw them.

This topic is closed to new replies.

Advertisement