cacalabs / libcaca

💩 Colour ASCII Art Library
Do What The F*ck You Want To Public License
520 stars 71 forks source link

Does it work on no-screen environment? #25

Open MewX opened 7 years ago

MewX commented 7 years ago

I check the official website, it requires: X11, but it does nothing for a non-screen VPS.

When I run cacaview, it outputs cacaview: unable to initialise libcaca (I've installed with sudo permission.)

All programs except cacafire didn't work. Even img2txt showed: unable to load subject01.centerlight.png which is known as a working image.

Could you please tell my whether it works on a non-screen environment?

Thanks in advance!

samhocevar commented 7 years ago

Can you maybe provide the output of ./configure when you built libcaca? It looks like libraries are missing.

MewX commented 7 years ago

Hi, thanks for your reply, here's the output (on CentOS):

$ ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '501' is supported by ustar format... yes
checking whether GID '501' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... yes
checking how to run the C preprocessor... gcc -E
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking dependency style of ... none
checking dependency style of gcc... gcc3
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... dlltool
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking return type of signal handlers... void
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for suffix of libraries... .so.0
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking endian.h usability... yes
checking endian.h presence... yes
checking for endian.h... yes
checking for unistd.h... (cached) yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking winsock2.h usability... no
checking winsock2.h presence... no
checking for winsock2.h... no
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking for dlfcn.h... (cached) yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking for signal... yes
checking for ioctl... yes
checking for snprintf... yes
checking for sprintf_s... no
checking for vsnprintf... yes
checking for vsnprintf_s... no
checking for getenv... yes
checking for putenv... yes
checking for strcasecmp... yes
checking for htons... yes
checking for usleep... yes
checking for gettimeofday... yes
checking for atexit... yes
checking _mingw.h usability... no
checking _mingw.h presence... no
checking for _mingw.h... no
checking for getopt_long... yes
checking for Sleep... no
checking for fsin/fcos... yes
checking for fldln2/fxch/fyl2x... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for gzopen in -lz... yes
checking for sin in -lm... yes
checking conio.h usability... no
checking conio.h presence... no
checking for conio.h... no
checking windows.h usability... no
checking windows.h presence... no
checking for windows.h... no
checking slang.h usability... no
checking slang.h presence... no
checking for slang.h... no
checking slang/slang.h usability... no
checking slang/slang.h presence... no
checking for slang/slang.h... no
checking for X... no
checking for XOpenDisplay in -lX11... no
checking X11/XKBlib.h usability... no
checking X11/XKBlib.h presence... no
checking for X11/XKBlib.h... no
checking GL/gl.h usability... no
checking GL/gl.h presence... no
checking for GL/gl.h... no
checking OpenGL/gl.h usability... no
checking OpenGL/gl.h presence... no
checking for OpenGL/gl.h... no
checking for FTGL... no
checking Cocoa/Cocoa.h usability... no
checking Cocoa/Cocoa.h presence... no
checking for Cocoa/Cocoa.h... no
checking ncursesw/ncurses.h usability... no
checking ncursesw/ncurses.h presence... no
checking for ncursesw/ncurses.h... no
checking ncurses/ncurses.h usability... no
checking ncurses/ncurses.h presence... no
checking for ncurses/ncurses.h... no
checking ncurses.h usability... no
checking ncurses.h presence... no
checking for ncurses.h... no
checking curses.h usability... no
checking curses.h presence... no
checking for curses.h... no
checking valid output drivers... no
configure: WARNING: no output drivers were selected!
checking working <iostream>... yes
checking for csc... no
checking for gmcs... no
checking for gacutil... no
checking for javac... no
checking for javah... no
checking for jar... no
checking for a Python interpreter with version >= 2.2... python
checking for python... /usr/bin/python
checking for python version... 2.7
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.7/dist-packages
checking for python extension module directory... ${exec_prefix}/lib64/python2.7/dist-packages
checking for ruby... no
checking available language bindings... C++
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking for IMLIB2... no
checking for PANGOFT2... no
checking for doxygen... /usr/bin/doxygen
checking for pdflatex... no
checking for kpsewhich... no
checking for dvips... no
checking for CPPUNIT... no
checking for zzuf... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating kernel/Makefile
config.status: creating caca/Makefile
config.status: creating caca/t/Makefile
config.status: creating src/Makefile
config.status: creating examples/Makefile
config.status: creating tools/Makefile
config.status: creating java/Makefile
config.status: creating caca-sharp/Makefile
config.status: creating cxx/Makefile
config.status: creating python/Makefile
config.status: creating ruby/Makefile
config.status: creating doc/Makefile
config.status: creating build/Makefile
config.status: creating caca/caca.pc
config.status: creating caca-sharp/caca-sharp.dll.config
config.status: creating cxx/caca++.pc
config.status: creating doc/doxygen.cfg
config.status: creating caca-config
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

And also, the make outputs:

$ make
make  all-recursive
make[1]: Entering directory `/home/mewx/programs/libcaca'
Making all in kernel
make[2]: Entering directory `/home/mewx/programs/libcaca/kernel'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/mewx/programs/libcaca/kernel'
Making all in caca
make[2]: Entering directory `/home/mewx/programs/libcaca/caca'
Making all in .
make[3]: Entering directory `/home/mewx/programs/libcaca/caca'
  CC       libcaca_la-caca.lo
  CC       libcaca_la-caca_conio.lo
  CC       libcaca_la-caca0.lo
  CC       libcaca_la-canvas.lo
  CC       libcaca_la-dirty.lo
  CC       libcaca_la-string.lo
string.c: In function 'caca_blit':
string.c:462:51: warning: variable 'bleed_left' set but not used [-Wunused-but-set-variable]
     int i, j, starti, startj, endi, endj, stride, bleed_left, bleed_right;
                                                   ^
  CC       libcaca_la-legacy.lo
  CC       libcaca_la-transform.lo
  CC       libcaca_la-charset.lo
  CC       libcaca_la-attr.lo
  CC       libcaca_la-line.lo
  CC       libcaca_la-box.lo
  CC       libcaca_la-conic.lo
  CC       libcaca_la-triangle.lo
  CC       libcaca_la-frame.lo
  CC       libcaca_la-dither.lo
dither.c: In function 'caca_dither_bitmap':
dither.c:946:25: warning: variable 'pitch' set but not used [-Wunused-but-set-variable]
     int x1, y1, x2, y2, pitch, deltax, deltay, dchmax;
                         ^
  CC       libcaca_la-font.lo
  CC       libcaca_la-file.lo
  CC       libcaca_la-figfont.lo
figfont.c: In function 'caca_put_figchar':
figfont.c:150:33: warning: variable 'extra' set but not used [-Wunused-but-set-variable]
     int c, w, h, x, y, overlap, extra, xleft, xright;
                                 ^
  CC       libcaca_la-graphics.lo
  CC       libcaca_la-event.lo
  CC       libcaca_la-time.lo
  CC       libcaca_la-prof.lo
  CC       libcaca_la-getopt.lo
  CC       codec/libcaca_la-import.lo
codec/import.c: In function 'import_caca':
codec/import.c:333:16: warning: variable 'y' set but not used [-Wunused-but-set-variable]
         int x, y, handlex, handley;
                ^
codec/import.c:333:13: warning: variable 'x' set but not used [-Wunused-but-set-variable]
         int x, y, handlex, handley;
             ^
codec/import.c:332:18: warning: variable 'attr' set but not used [-Wunused-but-set-variable]
         uint32_t attr;
                  ^
codec/import.c:331:37: warning: variable 'duration' set but not used [-Wunused-but-set-variable]
         unsigned int width, height, duration;
                                     ^
codec/import.c:301:23: warning: variable 'flags' set but not used [-Wunused-but-set-variable]
     uint16_t version, flags;
                       ^
codec/import.c:301:14: warning: variable 'version' set but not used [-Wunused-but-set-variable]
     uint16_t version, flags;
              ^
  CC       codec/libcaca_la-export.lo
  CC       codec/libcaca_la-text.lo
  CC       driver/libcaca_la-conio.lo
  CC       driver/libcaca_la-ncurses.lo
  CC       driver/libcaca_la-null.lo
  CC       driver/libcaca_la-raw.lo
  CC       driver/libcaca_la-slang.lo
  CC       driver/libcaca_la-vga.lo
  CC       driver/libcaca_la-win32.lo
  CC       driver/libcaca_la-x11.lo
  CC       driver/libcaca_la-gl.lo
  OBJCLD   libcaca.la
make[3]: Leaving directory `/home/mewx/programs/libcaca/caca'
Making all in t
make[3]: Entering directory `/home/mewx/programs/libcaca/caca/t'
  CC       simple.o
  CCLD     simple
  CC       bench.o
  CCLD     bench
  CC       bug-setlocale.o
  CCLD     bug-setlocale
make[3]: Leaving directory `/home/mewx/programs/libcaca/caca/t'
make[2]: Leaving directory `/home/mewx/programs/libcaca/caca'
Making all in src
make[2]: Entering directory `/home/mewx/programs/libcaca/src'
  CC       cacademo.o
cacademo.c: In function ‘do_plasma’:
cacademo.c:408:22: warning: variable ‘x’ set but not used [-Wunused-but-set-variable]
         unsigned int x;
                      ^
  CCLD     cacademo
  CC       aafire.o
aafire.c: In function ‘firemain’:
aafire.c:185:25: warning: variable ‘i’ set but not used [-Wunused-but-set-variable]
   register unsigned int i;
                         ^
  CCLD     cacafire
  CC       cacaplay.o
  CCLD     cacaplay
  CC       cacaview-cacaview.o
  CC       cacaview-common-image.o
  CCLD     cacaview
  CC       img2txt-img2txt.o
  CC       img2txt-common-image.o
  CCLD     img2txt
  CC       cacaclock.o
  CCLD     cacaclock
  CC       cacaserver.o
  CCLD     cacaserver
  CC       cacadraw.o
  CCLD     cacadraw
make[2]: Leaving directory `/home/mewx/programs/libcaca/src'
Making all in examples
make[2]: Entering directory `/home/mewx/programs/libcaca/examples'
  CC       trifiller-trifiller.o
  CCLD     trifiller
  CC       blit.o
  CCLD     blit
  CC       canvas.o
  CCLD     canvas
  CC       colors.o
  CCLD     colors
  CC       conio.o
  CCLD     conio
  CXXLD    conio-snake
  CC       demo.o
  CCLD     demo
  CC       demo0.o
  CCLD     demo0
  CC       dithering.o
  CCLD     dithering
  CC       driver.o
  CCLD     driver
  CC       event.o
  CCLD     event
  CC       export.o
  CCLD     export
  CC       figfont.o
  CCLD     figfont
  CC       font.o
  CCLD     font
  CC       font2tga.o
  CCLD     font2tga
  CC       frames.o
  CCLD     frames
  CC       fullwidth.o
  CCLD     fullwidth
  CC       gamma.o
  CCLD     gamma
  CC       hsv.o
  CCLD     hsv
  CC       input.o
  CCLD     input
  CC       spritedit.o
  CCLD     spritedit
  CC       swallow.o
  CCLD     swallow
  CC       text.o
  CCLD     text
  CC       transform.o
  CCLD     transform
  CC       truecolor.o
  CCLD     truecolor
  CC       unicode.o
  CCLD     unicode
  CC       import.o
  CCLD     import
  CC       mouse.o
  CCLD     mouse
make[2]: Leaving directory `/home/mewx/programs/libcaca/examples'
Making all in tools
make[2]: Entering directory `/home/mewx/programs/libcaca/tools'
  CC       optipal.o
  CCLD     optipal
  CC       sortchars.o
  CCLD     sortchars
make[2]: Leaving directory `/home/mewx/programs/libcaca/tools'
Making all in cxx
make[2]: Entering directory `/home/mewx/programs/libcaca/cxx'
  CXX      caca++.lo
  CXXLD    libcaca++.la
  CXXLD    cxxtest
make[2]: Leaving directory `/home/mewx/programs/libcaca/cxx'
Making all in caca-sharp
make[2]: Entering directory `/home/mewx/programs/libcaca/caca-sharp'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/mewx/programs/libcaca/caca-sharp'
Making all in python
make[2]: Entering directory `/home/mewx/programs/libcaca/python'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/mewx/programs/libcaca/python'
Making all in ruby
make[2]: Entering directory `/home/mewx/programs/libcaca/ruby'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/mewx/programs/libcaca/ruby'
Making all in java
make[2]: Entering directory `/home/mewx/programs/libcaca/java'
make  all-am
make[3]: Entering directory `/home/mewx/programs/libcaca/java'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/mewx/programs/libcaca/java'
make[2]: Leaving directory `/home/mewx/programs/libcaca/java'
Making all in doc
make[2]: Entering directory `/home/mewx/programs/libcaca/doc'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/mewx/programs/libcaca/doc'
make[2]: Entering directory `/home/mewx/programs/libcaca'
make[2]: Leaving directory `/home/mewx/programs/libcaca'
make[1]: Leaving directory `/home/mewx/programs/libcaca'
samhocevar commented 7 years ago

This indicates that no rendering library is available. You should install at least one of libslang-dev or libncurses-dev for terminal output.

checking for slang.h... no
checking slang/slang.h usability... no
checking slang/slang.h presence... no
checking for slang/slang.h... no
[...]
checking ncursesw/ncurses.h usability... no
checking ncursesw/ncurses.h presence... no
checking for ncursesw/ncurses.h... no
checking ncurses/ncurses.h usability... no
checking ncurses/ncurses.h presence... no
checking for ncurses/ncurses.h... no
checking ncurses.h usability... no
checking ncurses.h presence... no
checking for ncurses.h... no
checking curses.h usability... no
checking curses.h presence... no
checking for curses.h... no
checking valid output drivers... no
configure: WARNING: no output drivers were selected!
rofl0r commented 7 years ago

shouldnt it be fatal if no rendering library at all is detected ?

samhocevar commented 7 years ago

No, libcaca has a lot of non-rendering features. img2txt is an example program that does not use the display functions. Also, such plugins could be installed separately.

MewX commented 7 years ago

Hi, thanks, I installed the libncurses-dev package. Then it worked, and it didn't show cannot load libcaca any more.

However, when I tried to use cacaview to open a bmp file, it showed Error loading 'hairstyle.bmp'. Only BMP is supported. in the center of the screen. And this file was just 900KB.

Before that, I tried some jpeg files, and got the same error.


$ img2txt -W 80 yaleallsmall_ori.jpg
img2txt: unable to load yaleallsmall_ori.jpg
$ img2txt -W 80 yaleallsmall_ori.bmp
img2txt: unable to load yaleallsmall_ori.bmp

In addition, img2txt still doesn't work.

MewX commented 7 years ago

I tried installing imlib2, but it now cannot be built:

In file included from ../src/common-image.c:21:0,
                 from trifiller.c:14:
/usr/local/include/Imlib2.h:26:22: fatal error: X11/Xlib.h: No such file or directory
 #include <X11/Xlib.h>
                      ^
compilation terminated.

P.S. When building freetype2 (used by imlib2), there was an option to disable X server by passing --without-x.

samhocevar commented 7 years ago

This is a problem with your version of imlib. If its header Imlib2.h requires X11/Xlib.h then that header should be present on the system, too.

MewX commented 7 years ago

Oh, yeah, thanks, you're right! I removed the Xlib dependency, and libcaca could be compiled successfully again.

But still doesn't work, showing Error loading 'hairstyle.bmp' or Error loading 'hairstyle.jpg'. The good thing is that it doesn't show Only BMP is supported. now!

What's the current problem do you think?


Update:

I installed xorg-x11-devel, the problem above remained. It showed Loadingyaleallsmall_ori.bmp'at the beginning, then changed toError loading xxxx`.

rofl0r commented 7 years ago

in case you just wanna look at some pics in the terminal you could also try https://github.com/rofl0r/conpix . doesn't have any X11 deps.

MewX commented 7 years ago

Thanks! I tried conpix, and my git-bash and ubuntu on Windows 10 terminal went to messes. All followed inputs are invisible, so weird :/

This is what the message looked like exactly:

Error in pixRemoveColormap: pixs must be {1,2,4,8} bpptown conpix]$
Error in pixGetDepth: pix not definedreturnedconpix]$ [mewx@snackintown conpix]$ [mewx@snackintown conpix]$ [mewx@snacki
Error in pixConvertTo8Or32: depth not 8 or 32 bppnackintown conpix]$ logout
Error in pixScaleGeneral: pixt not madened
Error in pixOctreeColorQuant: pixs not defined

BTW, cacademo works perfectly! Just cacaview and img2txt cannot read files properly.

Anyway, I guess it might be the reason of AWZ's OS. I'll try it on my Arch then, and will let you know the results. Thanks again!

P.S. The "always" results of cacaview: snipaste_20170520_235337

MewX commented 7 years ago

On my Arch Linux, it worked perfectly with a pop-up X-server window. But for this VPS, it doesn't work :/

rofl0r commented 7 years ago

as far as conpix is concerned, it would probably work if you use it with xterm( export TERM=xterm-256color ). but it's probably not appropriate to discuss this here, so if you're interested and still have problems with it, we should bring further conpix-related discussion to its own issue tracker.

MewX commented 7 years ago

Alright, thanks! One more question, does this program have a logging output? (Or, how could I turn it on?)

rofl0r commented 7 years ago

if you mean conpix with "this program" then no; it's a very simple app (basically a proof-of-concept), no logging output, no zoom, only a single pic, etc. so if you need any advanced functionality you should work on getting libcaca doing what you want. maybe add some debug output to where it says "Error loading"... in the source code.