mention how to compile FLTK 1.5 on Linux as shared library with debug and optimization

20 views
Skip to first unread message

Basile Starynkevitch

unread,
Sep 9, 2025, 5:03:54 AMSep 9
to fltk.general
Hello all,

Please mention on the FLTK website in an easily readable way how to compile FLTK 1.5 on Linux/Debian with both debug information and optimizations as a shared (not static) library

Since many recent GCC compilers accept all of `-fPIC -shared -O -g`

Thanks

 Basile STARYNKEVITCH           <bas...@starynkevitch.net>
8 rue de la Faïencerie
92340 Bourg-la-Reine,          France
http://starynkevitch.net/Basile & https://github.com/bstarynk
https://github.com/RefPerSys/RefPerSys/

Albrecht Schlosser

unread,
Sep 9, 2025, 8:43:00 AMSep 9
to fltkg...@googlegroups.com
On 9/9/25 11:03 Basile Starynkevitch wrote:
> Please mention on the FLTK website in an easily readable way how to
> compile FLTK 1.5 on Linux/Debian with both debug information and
> optimizations as a shared (not static) library

This is not something we would mention "on the FLTK website", this would
rather be in the documentation, and we can't publish special advice for
a particular system like "Linux/Debian".

> Since many recent GCC compilers accept all of `-fPIC -shared -O -g`

FLTK 1.5 uses CMake exclusively, and CMake adds appropriate compiler
switches (not only for gcc) automatically. What you want seems to be
done if you enable the build of shared libraries in "Debug" mode, i.e.

  $ cmake -D CMAKE_BUILD_TYPE=Debug -D FLTK_BUILD_SHARED_LIBS=ON # ...
more options

This is all documented in README.CMake.txt which every user building the
library should consult anyway.

Or did I miss anything?

I don't think that it is appropriate to explicitly mention what you
proposed above. Other users would need to know which other compiler
flags *they* want to set. This is up to the user to decide.

Manolo

unread,
Sep 10, 2025, 6:43:32 AMSep 10
to fltk.general
Le mardi 9 septembre 2025 à 11:03:54 UTC+2, bas...@starynkevitch.net a écrit :
Please mention on the FLTK website in an easily readable way how to compile FLTK 1.5 on Linux/Debian with both debug information and optimizations as a shared (not static) library

Since many recent GCC compilers accept all of `-fPIC -shared -O -g`

I believe what you are looking for is CMake's option CMAKE_CXX_FLAGS.

These commands will build the FLTK shared libraries with "-fPIC -O -g":

 cmake -B -your-build-dir -S your-source-dir/ -DCMAKE_CXX_FLAGS="-fPIC -O" -DCMAKE_BUILD_TYPE=Debug -DFLTK_BUILD_SHARED_LIBS=1
 make -j6 fltk_images-shared 

Reply all
Reply to author
Forward
0 new messages