Need help with building Fltk-1.3.4-2 with OpenGL on Ubuntu 17.10

171 views
Skip to first unread message

Lars Ruoff

unread,
Mar 21, 2018, 8:32:14 AM3/21/18
to fltk.general
Hi,
I'm trying to compile my FLTK-1.3.4 -based project on Ubuntu 17.10 (for the first time).
I'm not very Linux-savvy.
So i'm trying to build fltk-1.3.4-2:

configure says:
Configuration Summary
-------------------------------------------------------------------------
    Directories: prefix=/usr/local
                 bindir=${exec_prefix}/bin
                 datadir=${datarootdir}
                 datarootdir=${prefix}/share
                 exec_prefix=${prefix}
                 includedir=${prefix}/include
                 libdir=${exec_prefix}/lib
                 mandir=${datarootdir}/man
       Graphics: X11
Image Libraries: JPEG=Builtin
                 PNG=Builtin
                 ZLIB=Builtin
    Large Files: YES
         OpenGL: NO
        Threads: YES

I'm worried about the "OpenGL: NO" part, as my app will be using OpenGl.
How can i get this with OpenGL support?

I already installed this package (after searching the net):
sudo apt-get install libmesa-dev
but it didnt help.

Any ideas?

Albrecht Schlosser

unread,
Mar 21, 2018, 9:16:49 AM3/21/18
to fltkg...@googlegroups.com
First of all, you can try to build FLTK anyway to see how it works.
OpenGL support will be missing, but everything else should work.

> I already installed this package (after searching the net):
> sudo apt-get install libmesa-dev
> but it didnt help.
>
> Any ideas?

Here is the list of packages I installed on Ubuntu 16.10 with some
comments. You don't need all (optional) packages, but I hope the list is
complete and helps.

# configure and build

sudo apt install autoconf # configure
sudo apt install g++ # compiler
sudo apt install make # build (see also ninja)

# FLTK build dependencies

sudo apt install xutils-dev # makedepend (optional)
sudo apt install doxygen # documentation (optional)

sudo apt install freeglut3-dev # OpenGL
sudo apt install libx11-dev # X11
sudo apt install libxft-dev
# Xft
sudo apt install libfontconfig-dev # Xft

sudo apt install libxcursor-dev # Xcursor
sudo apt install libxinerama-dev # Xinerama (optional)
sudo apt install libasound2-dev # sound (optional, demo)

# optional: CMake, ninja, clang, etc. (my preferred build tools)

sudo apt install cmake # build system generator
sudo apt install cmake-qt-gui # cmake-gui: GUI for CMake
sudo apt install cmake-curses-gui # ccmake: text/curses UI for CMake
sudo apt install ninja-build # faster replacement for make
sudo apt install clang # alternative, fast compiler
sudo apt install clang-format # source code formatter

# optional: additional libraries

sudo apt install libpango1.0-dev # for full UTF-8 support
sudo apt install libcairo2-dev # drawing library

# Others (optional)

sudo apt install libjpeg-dev # installs libjpeg-turbo8-dev libjpeg8-dev
sudo apt install libsdl2-dev # experimental SDL2 backend

Lars Ruoff

unread,
Mar 21, 2018, 9:25:35 AM3/21/18
to fltkg...@googlegroups.com
sudo apt install libglu1-mesa-dev
did the trick, for compiling at least.
I got Open GL OK and compiled everything successfully.
However i have unresolved symbols at the link stage (for my project).
I linked with the fltk libraries, but the unresolveds are for the indirect dependencies, like the X11 and GL functions.
Could anyone post a complete library dependence for what i need to download and add to linker settings?




--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lars Ruoff

unread,
Mar 21, 2018, 9:28:26 AM3/21/18
to fltkg...@googlegroups.com
Thanks a lot!
Any ideas for the linker settings?
Basically, i think i have everything installed now but i don't know what library filenames to specify for the  linker settings.
Im using CMake btw.


Albrecht Schlosser

unread,
Mar 21, 2018, 9:50:07 AM3/21/18
to fltkg...@googlegroups.com
On 21.03.2018 14:24 Lars Ruoff wrote:
> Thanks a lot!

Welcome.

Please don't top-post, we prefer inline citations and trimming of unused
parts for better readability and context.

> Any ideas for the linker settings?
> Basically, i think i have everything installed now but i don't know what
> library filenames to specify for the  linker settings.
> Im using CMake btw.

CMake works but is not fully supported in FLTK 1.3.x. This means that
for instance the generated fltk-config script is not fully functional.
This has recently been improved in FLTK 1.4 development. For FLTK 1.3
you can generate a working one in the source directory with configure.

That said, the linker dependencies vary from system to system and
depending on your configure/CMake choices. Your best option is to use
fltk-config as Ian said (but use the one generated with configure). Run
fltk-config w/o arguments to see options, for instance:

fltk-config --cxxflags --ldflags

This shows the used compiler and linker flags, depending on your build.
Use --use-gl and/or --use-images before --cxxflags/--ldflags if you need
these functionalities.

fltk-config --use-gl --use-images --compile test/hello.cxx

This compiles a simple .cxx file and outputs all compiler and linker
options.

With CMake you can use something like this:

touch <fltk-source-dir>/hello.cxx
make VERBOSE=ON hello
or
ninja -v hello

This will also show all compiler and linker options.

Output with ninja on my system:

$ touch ../../test/hello.cxx
$ ninja -v hello
ninja: warning: multiple rules generate help. builds involving this
target will not be correct; continuing anyway

Ignore this warning, this is fixed in FLTK 1.4

[1/2] /usr/bin/clang++ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
-D_LARGEFILE_SOURCE -I. -I../../ -I/usr/include/freetype2
-I/usr/local/hs/contrib/include -I../../test -Itest -Wall -W -pipe
-fmessage-length=0 -fno-rtti -Wcast-align -Wformat=2 -Wpointer-arith
-Wundef -Wno-cast-align -g -Wall -W -Wno-missing-field-initializers
-Wno-deprecated-declarations -Wno-unused-parameter
-Wno-format-nonliteral -Wreorder -D_THREAD_SAFE -D_REENTRANT -MMD -MT
test/CMakeFiles/hello.dir/hello.cxx.o -MF
test/CMakeFiles/hello.dir/hello.cxx.o.d -o
test/CMakeFiles/hello.dir/hello.cxx.o -c ../../test/hello.cxx
[2/2] : && /usr/bin/clang++ -Wall -W -pipe -fmessage-length=0
-fno-rtti -Wcast-align -Wformat=2 -Wpointer-arith -Wundef
-Wno-cast-align -g -pthread test/CMakeFiles/hello.dir/hello.cxx.o -o
bin/examples/hello -rdynamic lib/libfltk.a -ldl -lpthread -lSM -lICE
-lX11 -lXext -lXinerama -lXfixes -lXcursor -lXrender -lXft -lfontconfig && :

I hope this helps.

From your previous post:

> configure says:
> Configuration Summary
> -------------------------------------------------------------------------
[...]
>         Graphics: X11
> Image Libraries: JPEG=Builtin
>                   PNG=Builtin
>                   ZLIB=Builtin

You may also want to install the "-dev" packages for image libraries and
zlib to speed up building.

libjpeg-dev
libpng12-dev (or libpng16-dev ?)
zlib1g-dev

Lars Ruoff

unread,
Mar 22, 2018, 11:32:00 AM3/22/18
to fltkg...@googlegroups.com
Hey guys,
just to conclude on this and for reference,
i admit (with shame) that i have gone the path of least resistance and instead of compiling myself just did a
sudo apt-get install libfltk1.3-dev
and now my project is building fine with all dependencies.

FYI, my CMake file section for UNIX includes
FIND_PACKAGE(FLTK REQUIRED)
FIND_PACKAGE(OpenGL REQUIRED)
and
target_link_libraries(podball ${OPENGL_LIBRARIES})
target_link_libraries(podball ${FLTK_LIBRARIES})


and this is all it needed.
(And there is more potential for unification of Windows and *nix builds - will check that later)

Many thanks for your effort anyway.
Cheers,
Lars R.

Reply all
Reply to author
Forward
0 new messages