leo-arch / clifm

The shell-like, command line terminal file manager: simple, fast, extensible, and lightweight as hell.
https://github.com/leo-arch/clifm/wiki
GNU General Public License v2.0
1.29k stars 41 forks source link

Allow building with autotools #235

Closed winspool closed 1 year ago

winspool commented 1 year ago

cliFM BUG: When the include of "" can be disabled with "_NO_MAGIC", why is -lmagic still required for linking?

To Reproduce Steps to reproduce the behavior:

I tried a local build of clifm with: PREFIX=$HOME/.local CC=gcc make Build failed:

src/colors.c:29:11: fatal error: sys/capability.h: No such file or directory
   29 | # include <sys/capability.h>
      |           ^~~~~~~~~~~~~~~~~~
compilation terminated.
src/listing.c:33:11: fatal error: sys/capability.h: No such file or directory
   33 | # include <sys/capability.h>
      |           ^~~~~~~~~~~~~~~~~~
compilation terminated.
src/mime.c:36:11: fatal error: magic.h: No such file or directory
   36 | # include <magic.h>
      |           ^~~~~~~~~
compilation terminated.
src/suggestions.c:39:11: fatal error: sys/capability.h: No such file or directory
   39 | # include <sys/capability.h>
      |           ^~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:40: clifm] Error 1

Why does the project is not checking, if all dependencies are available? Without useful output, I had to step back to the eighties and try to guess the provider for the missing includes.

I installed "libcap-dev" and tried again. Next build failure:

src/mime.c:36:11: fatal error: magic.h: No such file or directory
   36 | # include <magic.h>
      |           ^~~~~~~~~
compilation terminated.
make: *** [Makefile:40: clifm] Error 1

git grep for "magic.h" made "#ifdef _NO_MAGIC" visible.

Next try: Building with: PREFIX=$HOME/.local CC=gcc CFALGS="-D_NO_MAGIC " make

Now compiling works, but linking failed (fault of cliFM):

/usr/bin/ld: cannot find -lmagic: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:40: clifm] Error 1

cliFM BUG: When the include of "" can be disabled with "_NO_MAGIC", why is -lmagic still required for linking?

Expected behavior

There is no "configure", but a "Makefile". I expect with a "Makefile", that I just can use "make"

"autotools" just work. When a project replaces "autotools", then the replacement has to work.

As an example for a helpful user information from an "autotools" project: (First build of Wine on this recently installed system)


configure: libXxf86vm 64-bit development files not found, XFree86 Vidmode won't be supported.
configure: libOSMesa 64-bit development files not found (or too old), OpenGL rendering in bitmaps won't be supported.
configure: libpcsclite not found, smart cards won't be supported.
configure: libsane 64-bit development files not found, scanners won't be supported.
configure: libv4l2 64-bit development files not found.
configure: libgphoto2 64-bit development files not found, digital cameras won't be supported.
configure: libgphoto2_port 64-bit development files not found, digital cameras won't be auto-detected.
configure: gstreamer-1.0 base plugins 64-bit development files not found, GStreamer won't be supported.
configure: OSS sound system found but too old (OSSv4 needed), OSS won't be supported.
configure: libSDL2 64-bit development files not found, SDL2 won't be supported.
configure: libcapi20 64-bit development files not found, ISDN won't be supported.
configure: libkrb5 64-bit development files not found (or too old), Kerberos won't be supported.
configure: libnetapi not found, Samba NetAPI won't be supported.

configure: Finished.  Do 'make' to compile Wine.

I did know in advance, that some packages where missing, but the project produces so good informations, that i just used the configure output as an overview, which packages i have to install.

cliFM has no information about missing packages at all.

Desktop (please complete the following information):

leo-arch commented 1 year ago

Hi @winspool, thanks for reporting.

Why is -lmagic still required for linking?

If compiled with _NO_MAGIC, -lmagic can be dropped altogether:

gcc -D_NO_MAGIC -o clifm src/*.c -lreadline -lcap -lacl

Or, you can use the GNU Makefile:

make -f misc/GNU/Makefile _NO_MAGIC=1

More about this here.

I had to step back to the eighties

With an internet connection, there's no need to go back in time nor to guess anything: just consult the documentation.

However, you're right about autotools. I'll take a look at it. Thanks for the advice. Feature request added to the TODO list.