Installing FLTK with Mingw in Windows

89 views
Skip to first unread message

Theodore

unread,
Sep 19, 2020, 12:17:20 PM9/19/20
to fltk.general
Hi everyone!

I followed the steps from the README.Windows file and I succeded installing FLTK from an Msys2 shell with the commands:
./configure
 make
make install

The problem is I don't know there where they are installed.
I was in the path C:\Program Files\fltk-1.4.x
So I assumed I installed them on this path.

=== quote ===

Then Msys will "install" the libraries to where it thinks the path "/usr/local/" leads to. If you only ever build code from within the Msys environment this works well, but the actual "Windows path" these files are located in will be something like "C:\msys\1.0\local\lib", depending on where your Msys installation is rooted, which may not be useful to other tools.

If you want to install your built FLTK libraries in a non-standard location you may do:
sh configure --prefix=C:/FLTK
make

=== end quote ===

So I created a new subfolder:   "C:\Program Files\fltk-1.4.x\build" , I moved the "configure" file here and I tried to configure, build and install here.
But I get this error:

$ sh configure --prefix=C:/Program Files/fltk-1.4.x/build
sh: configure: No such file or directory

What am I doing wrong?
Thanks for taking the time to answer!

imm

unread,
Sep 19, 2020, 1:16:12 PM9/19/20
to general fltk
Welcome.

OK, first off, if you are planning on using the mingw tools as your build toolchain, then building from the Msys shell is by far the best option anyway.

So just do that, and it'll be fine!

If you need to see the path to where the files actually are, then typing "mount" in the Msys shell will show where the paths map to in the DOS environment, and you can figure it out from there.

Typically, it's all under the folder you install mingw to, so something like C:/mingw/lib or some such thing.

If you *don't* plan on using the mingw tool chain, then you should probably just get the free "community edition" of Visual Studio and use that.

Note that you can't really mix and match tool chains; you need to use one or other, but the libraries are not mutually compatible.

As to what went wrong when you moved the configure file.... Well, let's just say there are several things wrong with that approach and leave it at that.
I'm guessing you're new to this, but in a few weeks you'll know where you went awry...
-- 
Ian
From my Fairphone FP3
   


Greg Ercolano

unread,
Sep 19, 2020, 2:27:01 PM9/19/20
to fltkg...@googlegroups.com
On 2020-09-19 09:14, Theodore wrote:
> Hi everyone!
>
> I followed the steps from the README.Windows file and I succeded installing FLTK from an Msys2 shell with the commands:
> ./configure
>  make

You can probably just stop there and skip the 'make install', as the libs and examples will
already be built at this point, and sitting in that same FLTK folder, e.g.

C:\Program Files\fltk-1.4.x\lib\* -- the constructed lib files
C:\Program Files\fltk-1.4.x\test\*.exe -- the constructed test programs

'make install' will just copy the libs into a more generalized place.
I can't remember where that is in Windows, but in unix it's usually
/usr/local/{bin,lib,include,...}.

> The problem is I don't know there where they are installed.

See above, after 'make' the libs will be in .\lib\* and test programs in .\test\*.exe
if you used configure.

> I was in the path C:\Program Files\fltk-1.4.x
> So I assumed I installed them on this path.

You don't have to use 'make install' if you want the built libs+examples
to be in that C:\Program Files\fltk-1.4.x path.

If you use configure, the libs would be in ./lib/*, test programs in ./test/*.exe, etc.
If you use cmake, the libs would be in ./lib/*, test programs in ./bin/test/*, etc.

> But then I read on https://fltk.gitlab.io/fltk/intro.html this:
> === quote ===
>
> Then Msys will "install" the libraries to where it thinks the path "/usr/local/" leads to. If you only ever build code from within the Msys environment this works well, but the actual "Windows path" these files are located in will be something like "C:\msys\1.0\local\lib", depending on where your Msys installation is rooted, which may not be useful to other tools.

Ya, you don't have to use 'make install' or any of that 'local' stuff.
That's only useful if you're using other packages that build against FLTK
and want to look in a 'standard' place for it.

> If you want to install your built FLTK libraries in a non-standard location you may do:
> sh configure --prefix=C:/FLTK
> make
>
> === end quote ===
>
> So I created a new subfolder:   "C:\Program Files\fltk-1.4.x\build"

It'd be normal to create a ./build folder as you describe
for building with cmake *instead of configure*, e.g.

cd "C:\Program Files\fltk-1.4.x"
mkdir build
cd build
cmake -G "Unix Makefiles"
make

..to build FLTK.

"configure" and "cmake" are two different ways to configure FLTK to build
with 'make'.

'configure' is the older build technique, which can only be run from the top level
directory, and you might use instead of 'cmake'. But 'cmake' is the way of the future,
and 'configure' is the way of the past (possibly soon to be obsoleted or removed).

So I would advise using cmake. But if you don't have cmake installed, or want
to just use what you've already had success with using configure, you can certainly
use that for now.. just know 'cmake' is the way things are going these days.

> , I moved the "configure" file here and I tried to configure, build and install here.

No, don't move it. 'configure' has to be in the top level dir only, and when
you run make, everything is built relative to the top level dir (.\lib, .\test, etc)

It's only with cmake you'd use the empty build directory technique, so that when
you build the library, all stuff goes in there, rather than mixed in with the
rest of the library code.

Theodore

unread,
Sep 19, 2020, 2:45:20 PM9/19/20
to fltk.general
Thanks Ian!
I'm planning to use Mingw because it's already set up with Visual Studio Code.

Now I have 2 compilers on 2 different paths:
1. C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
2. C:\msys64\mingw64\bin  -- without this one I could't configure/make/make install FLTK  from the mingw shell

If you say I should use Msys shell.... which doesn't find any compiler ("no acceptable C compiler found in $PATH")
probably I have to figure out how to make Msys shell to see the first compiler...

Indeed I'm new to this and very thankful for any hint in which direction to go next :)

Theodore

unread,
Sep 19, 2020, 2:57:24 PM9/19/20
to fltk.general
Thanks Greg!
Indeed I took the idea of a build subfolder from another reply of yours.
I chose the "configure" path because I was thinking to use Make instead of CMake, I have the impression that it's a simpler tool for simpler projects.
But if you say that CMake is the future... then I have to think again...

Greg Ercolano

unread,
Sep 19, 2020, 3:06:36 PM9/19/20
to fltkg...@googlegroups.com
On 2020-09-19 11:57, Theodore wrote:
> Thanks Greg!
> Indeed I took the idea of a build subfolder from another reply of yours.
> I chose the "configure" path because I was thinking to use Make instead of CMake, I have the impression that it's a simpler tool for simpler projects.
> But if you say that CMake is the future... then I have to think again...

Ya, the reason it's the way of the future is configure doesn't help with creating
Visual Studio IDE files (a large Windows audience uses Visual Studio, the 'native'
compiler for windows from Microsoft), ditto for Xcode. 'cmake' does help with that.

cmake also lets us generate all the build data in a sub directory, which allows
a single FLTK directory to be used to build for multiple platforms. This is useful
if you have a network drive, e.g. /net/fltk-1.4.x/, and that drive is seen by
Windows, Linux, and MacOS machines, and you want to build FLTK on all those machines
using that one directory:

o With 'configure' it would just overwrite everything for each platform build,
so you have to provide some way to keep them separate.

o With 'cmake' you can have a separate build directory for each platform,
and have them all build at the same time without worry of 'crosstalk':

On linux:
cd /net/fltk-1.4.x/; mkdir build-linux; cd build-linux; cmake .. ; make

On Mac:
cd /net/fltk-1.4.x/; mkdir build-mac; cd build-mac; cmake .. ; make

On Windows:
cd /net/fltk-1.4.x/; mkdir build-mingw; cd build-mingw; cmake .. ; make

..etc..

..leaving behind separate platform files that can all be used by your own multi-platform
project built similarly across all platforms.

I do something like this with my commercial software, as it supports at least 3 platforms
(sometimes different linux distros require separate builds).

Albrecht Schlosser

unread,
Sep 19, 2020, 4:15:11 PM9/19/20
to fltkg...@googlegroups.com
On 9/19/20 8:57 PM Theodore wrote:

> I chose the "configure" path because I was thinking to use Make instead
> of CMake, I have the impression that it's a simpler tool for simpler
> projects.
> But if you say that CMake is the future... then I have to think again...

Greg replied already and I second everything he wrote.

Just to clarify things: CMake is not a replacement for make. Despite its
similar name it's a replacement for configure. You have two choices to
build FLTK:

1) ./configure ; make

2) mkdir build; cd build; cmake .. ; make

This is a little simplified because configure can only provide the build
configuration to be used by make with existing and rather complicated
Makefile's. And configure (autotools, autogen, automake) itself is ...
even more complicated.

CMake however creates entire different BUILD SYSTEMs to be used in the
second step from much easier to grok descriptions (CMakeLists.txt). So
you can use either make, ninja, Visual Studio, Xcode (on macOS) or many
other IDE's as your development environment.

The FLTK team provides you with both configure and CMake files so you
can easily choose whatever you like.

However, if you want to build your own project(s), maybe on different
platforms (Windows, macOS, Linux/Unix) and you're just starting
development, then CMake should be your choice. Creating a cross-platform
CMakeLists.txt is much easier than using autotools (configure) and
writing Makefiles.

Side note: there are other similar build system generator tools like
CMake available as well, but CMake seems to be the most popular one
these days.
Reply all
Reply to author
Forward
0 new messages