Re: [Mingw-users] MSYS on Windows - Setting Directories?
- Date: Sat, 5 Mar 2016 14:11:27 +0000
- From: John Brown <johnbrown105@xxxxxxxxxxx>
- Subject: Re: [Mingw-users] MSYS on Windows - Setting Directories?
On Friday, March 4, 2016 10:22 AM, Eli Zaretskii wrote:
> On Fri, 4 Mar 2016 13:19:27 +0000, Domonic Tom wrote:
>> I still have a question though. Let's say that I build zlib at c:/zlib:
>> ./congigure --prefix=c:/my_directory
>> make install
>> Then I switch off my computer and come back later. I restart MSYS
>> and go to build libpng (which depends on zlib). How does MSYS
>> know that my zlib headers and library files are in c:/my_directory ?
> If you use --prefix=c:/mingw, then the headers and the libraries will
> all be installed in the place where GCC expects them to be, because
> GCC's own installation is also rooted at c:/mingw.
You have not told the original poster what he really wanted to know,
which was "How are my headers and libraries found if they are not
installed in the compiler's directory where they will automatically
The answer is that when building software that requires a library
that is installed in a custom location, you have to tell the configure
script where that custom location is. Let us say that you are building
ImageMagick, which has optional dependencies on various libraries
including libjpeg, which you have installed in c:\libjpeg. You want to
install ImageMagick in c:/imagemagick. There are various ways:
1) Set the CPPFLAGS and LDFLAGS environment variables, e.g.
CPPFLAGS=-Ic:/libjpeg/include -I/another/custom/include/directory ... \
LDFLAGS = -Lc:/libjpeg/lib -L/another/custom/library/directory ...\
2) The configure script may have an option for specifying custom
locations, such as a custom environment variable
(JPEG_INCLUDE_DIR) or an argument to configure such as
./configure --prefix=c:/imagemagick --jpeg-include-dir=c:/libjpeg
3) gcc recoginses a number of environment variables. See
>> By doing this:
>> ./configure --prefix=c:/my_directory when building libpng, am I
>>also telling MSYS where to find the zlib
>> headers and library files?
>> make install this part also stores headers and library files
>> into c:/my_directory
`make install' while cause files to be installed under the
directory selected with configure--prefix
and you can override it with
make install prefix=/path/to/alternative/directory
(Note: not make --prefix). If the program is not relocatable then
overriding at this stage will not work. The files will be copied to the
alternative location, but your programs may expect configuration
files to be in the original --prefix location and not work.
> They should all be in the same place: headers in c:/mingw/include,
> libraries in c:/mingw/lib, executables and DLLs in c:/mingw/bin,
> documentation and auxiliary files in c:/mingw/share, etc.
As Eli says, the easiest thing to do is always set --prefix=c:/mingw,
but I gather that this is not what you want.
MinGW-users mailing list
This list observes the Etiquette found at
We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.
You may change your MinGW Account Options or unsubscribe at: