STR #3346

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]

Return to Bugs & Features | Roadmap 1.3 | Post Text | Post File | Prev | Next ]

STR #3346

Application:FLTK Library
Status:5 - New
Priority:3 - Moderate, e.g. unable to compile the software
Scope:2 - Specific to an operating system
Subsystem:Build Files
Summary:FreeBSD/NetBSD: cannot build with make without running configure before
Created By:manolo
Assigned To:Unassigned
Fix Version:Unassigned
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File ]

No files

Trouble Report Comments:

Post Text ]
Name/Time/Date Text top right image
#1 manolo
23:08 Oct 24, 2016
1) On FreeBSD 11.0, typing make right after untar'ing the
1.3.4rc2 archive fails:

make: "/usr/home/xx/fltk-1.3.4rc2/Makefile" line 19: Could not find makeinclude
make: Fatal errors encountered -- cannot continue
make: stopped in /usr/home/xx/fltk-1.3.4rc2
xx@FreeBSD11:~/fltk-1.3.4rc2 %

If  gmake  is used instead, building is OK.

This other path, without gmake, also runs OK :

Other slight problem: make clean in subdir examples fails :

xx@FreeBSD11:~/fltk-1.3.4rc2 % cd examples/
xx@FreeBSD11:~/fltk-1.3.4rc2/examples % make clean
make: "/usr/home/xx/fltk-1.3.4rc2/examples/Makefile.FLTK" line 14: Need an operator
make: "/usr/home/xx/fltk-1.3.4rc2/examples/Makefile.FLTK" line 16: Need an operator
make: Fatal errors encountered -- cannot continue
make: stopped in /usr/home/xx/fltk-1.3.4rc2/examples
xx@FreeBSD11:~/fltk-1.3.4rc2/examples %

2) On NetBSD 7.0, same problems, slightly worse, because
gmake loops endlessly running configure,
and because make wants to run configure even if configure was run right before make.
#2 manolo
23:21 Oct 24, 2016
Correction: the statement above that building is "slightly worse"
with NetBSD is wrong. It was caused by bad setting of the date
of a virtual machine.

Building 1.3.4rc2 with NetBSD is just like with FreeBSD.
#3 AlbrechtS
08:15 Jan 01, 2019
Manolo, what's the state of this STR? Is it fixed, can we close it?  
#4 manolo
02:04 Jan 03, 2019
The (minor) problem reported by this STR is still here.

Typing make right after unpacking the downloaded FLTK source code
fails at line #19 of the top Makefile
     include makeinclude
because file makeinclude does not exist yet.

I see that make runs well without this
     include makeinclude
statement both under Debian and FreeBSD.
Shouldn't we just remove that strange include statement of a file that
does not exist initially?

The STR also indicates that
make clean
fails when run in the examples dir because of this construct
ifeq '$(OS)' "Windows_NT"
EXEEXT = .exe
introduced by Greg in 2011 to support Windows

Is it possible to rewrite that in a way recognized both by
Unix make and gmake?
#5 manolo
07:18 Jan 03, 2019
----continuing previous post----
include makeinclude
is not a solution because the image libraries don't get built.

Replacing that by
-include makeinclude
(with an extra leading minus)
seems mostly OK:

gmake (and thus make on linux) runs well,
and make runs without building the built-in jpeg and png libraries,
so it stops when building fluid; at that point, running make again
completes the FLTK build.
#6 AlbrechtS
07:28 Jan 03, 2019
Manolo, ISTR that there was a note in the docs that we require a gnu make compatible make program but I couldn't find it anywhere right now. Maybe my memory was faulty.

However I found this in our current (1.4) README.txt:

$ grep -n -B2 -A1 'make makeinclude' README.txt
90-    If you've just checked out a fresh copy of FLTK from SVN,
91-    you'll need to generate an initial version of 'configure'
92:    by running 'make makeinclude'. (We don't include a copy
93-    of configure in svn)

Except that this is not yet rewritten (svn -> git) it says that you need to run 'make makeinclude'. Does this work with the standard 'make'?

My habit is to run 'make clean' once which does also create configure and makeinclude, but I don't know if this works with Free/NetBSD make as well.

If one of these ways works we should document it and leave it as-is, IMHO. I don't know if removing 'include makeinclude' in the top level Makefile would do any harm (need to check this). I'm sure we need it in the other Makefile's, e.g. in src/ and documentation/.

Re examples/Makefile: see follow-up
#7 AlbrechtS
07:35 Jan 03, 2019
Re examples/Makefile:

I believe the current Makefile was intended (by Greg) to be an example Makefile people can copy and use. However, if we decided to 'include ../makeinclude' we'd get $(EXEEXT) for free because it's defined there.

I tested the following modifications of examples/Makefile (replacing lines 1 to ...):

--- begin of Makefile ---
FLTKCONFIG   = ../fltk-config
include ../makeinclude

        @echo "building $@"
        @$(FLTKCONFIG) --use-images --compile $< >/dev/null


# Executables
ALL = clipboard$(EXEEXT) \
(rest of the file unchanged).

Does this work with standard BSD make?

The only issues are that this is now tied to the build directory (using ../makeinclude) and the redirection of fltk-config's output to /dev/null to avoid clutter. But maybe this is the way to go. OTOH we could add a '--quiet' option to fltk-config to avoid this redirection.
#8 manolo
07:39 Jan 03, 2019
When file makeinclude is absent, any make command fails
include makeinclude
is the first non-comment statement of the Makefile.
make makeinclude
is no better than
Same for
make clean
#9 manolo
07:44 Jan 03, 2019
The problem in examples/ is not in Makefile but in Makefile.FLTK,
which Makefile includes and which contains

ifeq '$(OS)' "Windows_NT"
EXEEXT = .exe

that seems to be unknown to make (as opposed to gmake).

I've no idea how to rewrite that in a make-portable way.
#10 manolo
07:49 Jan 03, 2019
The FLTK CMP contains a section dedicated to makefiles and reads:

" allow FLTK to be built on as many systems and environments as possible."

That is why my understanding was that compatibility with make
(as opposed to gmake) was expected. But that may be outdated.
#11 AlbrechtS
08:00 Jan 03, 2019
> The problem in examples/ is not in Makefile but in Makefile.FLTK,
> which Makefile includes and which contains ...

My proposal does not include Makefile.FLTK. Makefile.FLTK can be deleted if my solution gets implemented.
#12 AlbrechtS
08:30 Jan 03, 2019
Regarding the CMP and supported 'make' versions: now after thinking about it I believe that the intention is to support as many systems (and thus: make versions) as possible.

Your working method to run './configure' before 'make' is the *usual* way to configure and build software, so this is what users would normally expect and do anyway.

FLTK has a built-in exception to this "rule" in that it can run 'make' w/o running ./configure - because make will run ./configure. So this is what we usually recommend to do.

That said, the direct download from git (or the Zip file from GitHub) does not include a 'configure' file (we don't have it in Git) so the method to run ./configure first doesn't work with a clean git checkout.

To test this in a git working directory you may run:

$ git worktree add ../fltk-temp
$ cd ../fltk-temp

Run tests...

Reset to a clean state:

$ git clean -xdf  # CAUTION: (-f, --force) deletes ALL user files!


Cleanup after tests:

$ cd <original fltk dir>
$ git worktree remove ../fltk-temp

(see 'git help worktree' and 'git help clean').


Back to the topic. I found that this might work always:

$ touch makeinclude
$ make [clean]

Does this work on *BSD as well?

Note: 'makeinclude' is always generated and overwritten by configure, so 'touch makeinclude' should be safe. 'make [clean]' would run configure (clean is optional).
#13 manolo
08:49 Jan 03, 2019

touch makeinclude; make
is as good as using
-include makeinclude
in that it does not build the built-in jpeg and png and
goes all the way to linking fluid and stops
because libfltk_jpeg and libfltk_png are missing.

is run again, FLTK results correctly built.
#14 manolo
09:02 Jan 03, 2019
About examples/Makefile:
Sorry, I had not read carefully your proposal.
Yes, with your proposal,
make clean
run perfectly well under FreeBSD.
#15 AlbrechtS
10:20 Jan 03, 2019
Re examples/Makefile: OK, thanks, that sounds good. I'm not sure if we *want* this solution though - at least we should ask Greg (since he probably wrote the original Makefile) and/or discuss this in fltk.coredev. As I wrote before - the drawback is that the Makefile is no longer a stand-alone example, it's tied to the FLTK build directory.  
#16 AlbrechtS
10:24 Jan 03, 2019
Re makeinclude: what happens when you execute:

$ touch makeinclude; make clean; make

in a clean (git) build directory? Does this build everything? The idea is that 'make clean' runs configure and creates the correct makeinclude file so the following 'make' should build everything.
#17 manolo
23:35 Jan 03, 2019
# ls makeinclude
ls: makeinclude: No such file or directory
# touch makeinclude
# make clean
core *.o
/bin/sh: core: not found
*** Error code 127 (ignored)
for dir in examples  src  fluid test documentation; do echo "=== cleaning $dir ==="; (cd $dir; make   clean) || exit 1; done
=== cleaning examples ===
make[1]: exec(clipboard) failed (No such file or directory)
*** Error code 1

make[1]: stopped in /usr/home/mgouy/fltk-git/examples
*** Error code 1

make: stopped in /usr/home/mgouy/fltk-git
#18 manolo
23:40 Jan 03, 2019
gmake clean
runs configure, as expected.
#19 manolo
01:30 Jan 04, 2019
The FLTK build instructions should may be state

1) starting from the archive of a public full FTK release, do :

cd [top of FLTK source tree]
./configure [options]

2) starting from the result of the 'git clone' command, do :

cd [top of FLTK source tree]
./configure [options]

3) if the system uses a GNU make command, or if gmake is installed,
and if only default configure settings are desired,
a shortcut is possible in all cases:

cd [top of FLTK source tree]
make (or gmake)
bottom left image   bottom right image

Return to Bugs & Features | Post Text | Post File ]


Comments are owned by the poster. All other content is copyright 1998-2023 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to ''.