How to build/install fltk 1.3.5 on Ubuntu 20.04

57 views
Skip to first unread message

Hui Peng, Alan Ng

unread,
Oct 14, 2020, 1:29:45 PM10/14/20
to fltk.general
Greetings

I am trying to install fltk 1.3.5 on Ubuntu 20.04 without success. I have used the following 3 bash shell commands, including results from the last command -

alan@alan-Aspire-E1-422:~/reference/fltk-1.3.5$ ./configure --enable-debug --disable-gl --enable-shared --enable-threads --enable-xdbe --enable-xft --includedir=/home/alan/reference/fltk-1.3.5/include --bindir=/home/alan/reference/fltk-1.3.5/bin --libdir=/home/alan/reference/fltk-1.3.5/lib --prefix=/home/alan/reference/fltk-1.3.5

alan@alan-Aspire-E1-422:~/reference/fltk-1.3.5$ make

alan@alan-Aspire-E1-422:~/reference/fltk-1.3.5$ sudo make install
=== installing FL ===
Installing include files in /home/alan/reference/fltk-1.3.5/include...
=== installing jpeg ===
Installing ../lib/libfltk_jpeg.a in /home/alan/reference/fltk-1.3.5/lib...
/usr/bin/install: '../lib/libfltk_jpeg.a' and '/home/alan/reference/fltk-1.3.5/lib/libfltk_jpeg.a' are the same file
make[1]: *** [Makefile:103: install] Error 1
make: *** [Makefile:33: install] Error 1

config.log is attached for reference.
Will appreciate any leads and/or suggestions to correct the errors.

Thank you
config.log

Albrecht Schlosser

unread,
Oct 14, 2020, 1:49:54 PM10/14/20
to fltkg...@googlegroups.com
You are trying to install (with `sudo make install`) to the same
directory you're building FLTK in (error: "'../lib/libfltk_jpeg.a' and
'/home/alan/reference/fltk-1.3.5/lib/libfltk_jpeg.a' are the same file").

There are some issues with your commands:

(1) You do not need to "install" FLTK to use it. If your build (2nd
command: 'make') worked w/o errors you're ready to use FLTK in another
project and you can run the example programs in the test/ folder.

(2) Several of your ./configure command switches are default so you
don't need them, for instance "--enable-threads --enable-xdbe
--enable-xft". You can safely remove these commandline switches.

(3) The following switches are (AFAICT) redundant or even wrong. You
should remove those.

> --includedir=/home/alan/reference/fltk-1.3.5/include
> --bindir=/home/alan/reference/fltk-1.3.5/bin
> --libdir=/home/alan/reference/fltk-1.3.5/lib

(4) You don't need `sudo' if you (really) want to "install" the FLTK
libs to a subdirectory of your home folder (if that's what you did). You
need `sudo' only if you install to a system directory.

(5) If you really want to "install" FLTK (that's fine although not
necessary) and want to use a subdirectory of your home folder I suggest
to use something where you'll maybe install other software as well, e.g.
'/home/alan/dev' or another appropriate directory (not the source
directory of FLTK).

That all said, your configure, build, and install commands might look
like this:

$ ./configure --enable-debug --disable-gl --enable-shared
--prefix=/home/alan/dev

$ make

$ make install

Note that --prefix is used for the install target folder, change this as
required.

One last hint: I'd try to use the defaults when building new software
and amend the commands only when needed. The default values are usually
(and in the FLTK case definitely) a good starting point.

Welcome to the FLTK community, have fun!

nghui...@gmail.com

unread,
Oct 15, 2020, 7:02:39 AM10/15/20
to fltk.general
Hi Albrecht

Thank you for the hints. The build works. I follow hint #1 to compile hello.cxx from listing 1 of the FLTK 1.3.5 Programming Manual by running the shell script provided by the build :

alan@alan-Aspire-E1-422:~/reference/fltk-1.3.5$ ./fltk-config --compile hello.cxx

g++ -I. -I./jpeg -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -fvisibility-inlines-hidden -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT -o 'hello' 'hello.cxx' ./lib/libfltk.a -lXrender -lXft -lfontconfig -lpthread -ldl -lm -lX11

alan@alan-Aspire-E1-422:~/reference/fltk-1.3.5$

The Hello, World! window appears when I run the executable file. Great that it works, but I notice it has a file size of 2.5 MB. Seems exceedingly large. What could be the possible causes or remedies? Thank you

Reply all
Reply to author
Forward
0 new messages