Could not successfully built FLTK1.4 (latest commit) on Manjaro Linux

66 views
Skip to first unread message

Charalampos Rempas

unread,
Oct 3, 2021, 8:39:40 AM10/3/21
to fltk.general

I got FLTK from the final commit on master (git clone https://...) and I tried to build it on Manjaro linux. I use the following configuration settings: `./configure --disable-gl --disable-xinerama --enable-shared`. Then I built the library with `make -j8` and there was no shared libraries to be found. I can also confirm that by the fact that when a program and then try to run it, I'm getting the following error message: "error while loading shared libraries: libfltk.so.1.4: cannot open shared object file: No such file or directory". Another thing I'm discovered is that I'm not able to compile with "cc" ("gcc" in my case) but only with "c++". In the official docs in the basics section, It shows that I should have been able to compile with "gcc" but when I'm trying to do that, I'm getting the following error: "/usr/bin/ld: /tmp/ccelgt6s.o: undefined reference to symbol '_ZdlPvm@@CXXABI_1.3.9'
/usr/bin/ld: /usr/lib/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status" which from what I understand means that the C++ standard library should also be linked. Any ideas?

Albrecht Schlosser

unread,
Oct 4, 2021, 7:21:57 AM10/4/21
to fltkg...@googlegroups.com
On 10/3/21 2:08 PM Charalampos Rempas wrote:

I got FLTK from the final commit on master (git clone https://...) and I tried to build it on Manjaro linux. I use the following configuration settings: `./configure --disable-gl --disable-xinerama --enable-shared`. Then I built the library with `make -j8` and there was no shared libraries to be found.

For historical reasons the shared libraries are built in the 'src' folder if you're using configure/make. IMHO a bad choice, but that's how it is.


I can also confirm that by the fact that when a program and then try to run it, I'm getting the following error message: "error while loading shared libraries: libfltk.so.1.4: cannot open shared object file: No such file or directory".

Sure, the shared libs are not in a known directory of your system. You have (at least) these choices:

(1) use `[sudo] make install` to install in the default system directory '/usr/local' (not recommended for several reasons)

(2) configure with `--prefix=/path/to/location` and the use `make install` to install to that location

(3) use CMake to build which will build all libraries (static and shared) in the '/path/to/build/lib' folder

No matter what you choose, you will likely need to set up your environment to find the libraries when linking and running your programs.

Please note also that we recommend building static FLTK libraries (only) and link your program(s) with the static libs. This is easier and more portable (you don't need to deploy/install the shared libs with your program).


Another thing I'm discovered is that I'm not able to compile with "cc" ("gcc" in my case) but only with "c++". In the official docs in the basics section, It shows that I should have been able to compile with "gcc" but when I'm trying to do that, I'm getting the following error: "/usr/bin/ld: /tmp/ccelgt6s.o: undefined reference to symbol '_ZdlPvm@@CXXABI_1.3.9'
/usr/bin/ld: /usr/lib/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status" which from what I understand means that the C++ standard library should also be linked. Any ideas?

The examples using 'CC' or 'gcc' are only that: examples. I admit that using 'c++', 'g++', 'clang++' in these examples would have been a better choice, but this part of the docs is very old and not updated frequently. That said, yes, you need a C++ compiler to build FLTK.

Note that the following paragraphs describe how to use `fltk-config` to find out which command line and arguments your system needs. This tool has been configured by the `configure` command and "knows" what you need to build FLTK programs on your particular system. This will also help you to find out how you link with libstdc++.

Albrecht Schlosser

unread,
Oct 4, 2021, 8:47:35 AM10/4/21
to fltkg...@googlegroups.com
On 10/4/21 1:21 PM Albrecht Schlosser wrote:
> On 10/3/21 2:08 PM Charalampos Rempas wrote:
>>
>> I got FLTK from the final commit on master (git clone https://...)
>> and I tried to build it on Manjaro linux. I use the following
>> configuration settings: `./configure --disable-gl --disable-xinerama
>> --enable-shared`. Then I built the library with `make -j8` and there
>> was no shared libraries to be found.
>
> For historical reasons the shared libraries are built in the 'src'
> folder if you're using configure/make. IMHO a bad choice, but that's
> how it is.

I updated the README file 'lib/README.txt' to clarify this.

> The examples using 'CC' or 'gcc' are only that: examples. I admit that
> using 'c++', 'g++', 'clang++' in these examples would have been a
> better choice, but this part of the docs is very old and not updated
> frequently. That said, yes, you need a C++ compiler to build FLTK.

I also updated the docs which can be found within about an hour on our
GitLab mirror:
https://fltk.gitlab.io/fltk/basics.html#basics_compiling

Charalampos Rempas

unread,
Oct 5, 2021, 11:58:12 AM10/5/21
to fltk.general
Στις Δευτέρα, 4 Οκτωβρίου 2021 στις 3:47:35 μ.μ. UTC+3, ο χρήστης Albrecht Schlosser έγραψε:
I updated the README file 'lib/README.txt' to clarify this.
 
I also updated the docs which can be found within about an hour on our
GitLab mirror:
https://fltk.gitlab.io/fltk/basics.html#basics_compiling

Thanks a lot for your help!!! I had forget about Cmake. As a Linux user, I automatically looked in the "README.Unix.txt". Tbh, there are a lot of "README" files and it's just confusing. Why not just keep the "README.CMake.txt" and rename it to "BUILD.txt" which already describes how to build. In my opinion, I also think that the old way to do it with autoconf/make should not be supported and the deprecated options from Cmake should also get removed. In general, the build system could get less confusing and the build instructions could fit into one place (file). Thanks a lot for your time and your work!
Reply all
Reply to author
Forward
0 new messages