Asimage, libAfterImage, X11 implicit function declaration and conversion errors in compiling from source


ROOT Version: 6.40.04 for linuxx8664gcc
Platform: Fedora 44 on WSL 2 on Windows 11 25H2
Compiler: Cling (i think?)


Hello, I am trying to compile Root from source on Fedora 44 through WSL on Windows 11. I cloned the latest stable release from Github and ran the following commands to initialize cmake (make).

root_src is a folder where Root was cloned into. rootinstall is a folder in the same parent directory as root_src and is where I want to build/install Root to. pandora is my user in Fedora.
Some of the cmake options I found online to possibly alleviate the error.

cmake -Dbuiltin_vdt=ON -Dfail-on-missing=ON -DCMAKE_C_FLAGS="-Wno-error=implicit-function-declaration" -DCMAKE_INSTALL_PREFIX=../rootinstall ../root_src

This finishes and I then execute,

cmake --build .

The build/compiling process proceeds until 88% and I receive the following error that I have truncated to a few lines, (the untruncated error is listed at the bottom of this post and has similar flags throughout).

[ 88%] Building C object graf2d/asimage/src/libAfterImage/CMakeFiles/libAfterImage.dir/asfont.c.o
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c: In function ‘open_X11_font_int’:
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:252:20: warning: implicit declaration of function ‘XLoadQueryFont’; did you mean ‘X_QueryFont’? [-Wimplicit-function-declaration]
  252 |         if( (xfs = XLoadQueryFont( fontman->dpy, font_string )) == NULL )
      |                    ^~~~~~~~~~~~~~
      |                    X_QueryFont
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:252:18: error: assignment to ‘XFontStruct *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  252 |         if( (xfs = XLoadQueryFont( fontman->dpy, font_string )) == NULL )
      |                  ^
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:263:9: warning: implicit declaration of function ‘XFreeFont’ [-Wimplicit-function-declaration]
  263 |         XFreeFont( fontman->dpy, xfs );
      |         ^~~~~~~~~
'''
REST OF THE ERROR
'''
gmake[2]: *** [graf2d/asimage/src/libAfterImage/CMakeFiles/libAfterImage.dir/build.make:107: graf2d/asimage/src/libAfterImage/CMakeFiles/libAfterImage.dir/asfont.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:57159: graf2d/asimage/src/libAfterImage/CMakeFiles/libAfterImage.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

I have searched and tried to use the build in libAfterImage package with no avail. I also tried to compile from source on Ubuntu and Debian with similar errors.
Any help is appreciated!
Thanks




Below, the full error from compiling.

[ 88%] Building C object graf2d/asimage/src/libAfterImage/CMakeFiles/libAfterImage.dir/asfont.c.o
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c: In function ‘open_X11_font_int’:
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:252:20: warning: implicit declaration of function ‘XLoadQueryFont’; did you mean ‘X_QueryFont’? [-Wimplicit-function-declaration]
  252 |         if( (xfs = XLoadQueryFont( fontman->dpy, font_string )) == NULL )
      |                    ^~~~~~~~~~~~~~
      |                    X_QueryFont
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:252:18: error: assignment to ‘XFontStruct *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  252 |         if( (xfs = XLoadQueryFont( fontman->dpy, font_string )) == NULL )
      |                  ^
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:263:9: warning: implicit declaration of function ‘XFreeFont’ [-Wimplicit-function-declaration]
  263 |         XFreeFont( fontman->dpy, xfs );
      |         ^~~~~~~~~
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c: In function ‘load_X11_glyph_range’:
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:769:21: warning: implicit declaration of function ‘XCreatePixmap’; did you mean ‘X_CreatePixmap’? [-Wimplicit-function-declaration]
  769 |                 p = XCreatePixmap( dpy, DefaultRootWindow(dpy), total_width, height, 1 );
      |                     ^~~~~~~~~~~~~
      |                     X_CreatePixmap
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:774:31: warning: implicit declaration of function ‘XCreateGC’; did you mean ‘X_CreateGC’? [-Wimplicit-function-declaration]
  774 |                         *gc = XCreateGC( dpy, p, GCFont|GCForeground, &gcv);
      |                               ^~~~~~~~~
      |                               X_CreateGC
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:774:29: error: assignment to ‘GC’ {aka ‘XGCValues *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  774 |                         *gc = XCreateGC( dpy, p, GCFont|GCForeground, &gcv);
      |                             ^
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:776:25: warning: implicit declaration of function ‘XSetForeground’; did you mean ‘XNForeground’? [-Wimplicit-function-declaration]
  776 |                         XSetForeground( dpy, *gc, 1 );
      |                         ^~~~~~~~~~~~~~
      |                         XNForeground
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:777:17: warning: implicit declaration of function ‘XFillRectangle’; did you mean ‘X_PolyRectangle’? [-Wimplicit-function-declaration]
  777 |                 XFillRectangle( dpy, p, *gc, 0, 0, total_width, height );
      |                 ^~~~~~~~~~~~~~
      |                 X_PolyRectangle
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:789:25: warning: implicit declaration of function ‘XDrawImageString16’ [-Wimplicit-function-declaration]
  789 |                         XDrawImageString16( dpy, p, *gc, pen_x-offset, xfs->ascent, &test_char, 1 );
      |                         ^~~~~~~~~~~~~~~~~~
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:795:23: warning: implicit declaration of function ‘XGetImage’; did you mean ‘X_GetImage’? [-Wimplicit-function-declaration]
  795 |                 xim = XGetImage( dpy, p, 0, 0, total_width, height, 0xFFFFFFFF, ZPixmap );
      |                       ^~~~~~~~~
      |                       X_GetImage
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:795:21: error: assignment to ‘XImage *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  795 |                 xim = XGetImage( dpy, p, 0, 0, total_width, height, 0xFFFFFFFF, ZPixmap );
      |                     ^
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:796:17: warning: implicit declaration of function ‘XFreePixmap’; did you mean ‘X_FreePixmap’? [-Wimplicit-function-declaration]
  796 |                 XFreePixmap( dpy, p );
      |                 ^~~~~~~~~~~
      |                 X_FreePixmap
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c: In function ‘load_X11_glyphs’:
/home/pandora/root_src/graf2d/asimage/src/libAfterImage/asfont.c:993:17: warning: implicit declaration of function ‘XFreeGC’; did you mean ‘X_FreeGC’? [-Wimplicit-function-declaration]
  993 |                 XFreeGC( dpy, gc );
      |                 ^~~~~~~
      |                 X_FreeGC
gmake[2]: *** [graf2d/asimage/src/libAfterImage/CMakeFiles/libAfterImage.dir/build.make:107: graf2d/asimage/src/libAfterImage/CMakeFiles/libAfterImage.dir/asfont.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:57159: graf2d/asimage/src/libAfterImage/CMakeFiles/libAfterImage.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

Hi,

I have no experience with WSL on Windows, but seems to be you missing some important X11 headers in your environment. Try to install developer packages first like:

sudo apt install -y libx11-dev libxpm-dev libxft-dev libxext-dev

Regards,
Sergey

Hello Sergey,

Thank you for your response. I have installed seemingly all dependencies listed as requirements for compiling Root from source, including libX11-devel libXpm-devel libXft-devel libXext-devel. I still get the same implicit function declaration and conversion errors as before.


When I run

cmake -Dbuiltin_vdt=ON -Dfail-on-missing=ON -DCMAKE_C_FLAGS="-Wno-error=implicit-function-declaration" -DCMAKE_PREFIX_PATH="/etc/X11" -DCMAKE_INSTALL_PREFIX=../rootinstall ..
/root_src

I get,

-- Looking for X11
-- Found X11: /usr/include  found components: Xpm Xft Xext
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so - found

and later,

-- X11_INCLUDE_DIR: /usr/include
-- X11_LIBRARIES: /usr/lib64/libX11.so;/usr/lib64/libXext.so
-- X11_Xpm_INCLUDE_PATH: /usr/include
-- X11_Xpm_LIB: /usr/lib64/libXpm.so
-- X11_Xft_INCLUDE_PATH: /usr/include
-- X11_Xft_LIB: /usr/lib64/libXft.so
-- X11_Xext_INCLUDE_PATH: /usr/include
-- X11_Xext_LIB: /usr/lib64/libXext.so

I’m pretty sure I have all the packages but cmake is not able to find them maybe?

Check if you have installed of the below (the third is for the “optionals” but install them just in case), or just run all these, to be sure:

sudo dnf install -y git make cmake gcc-c++ gcc binutils libX11-devel libXpm-devel libXft-devel libXext-devel python openssl-devel xrootd-client-devel xrootd-libs-devel

sudo dnf install -y tbb

sudo dnf install -y gcc-gfortran pcre-devel mesa-libGL-devel mesa-libGLU-devel glew-devel ftgl-devel mysql-devel fftw-devel cfitsio-devel graphviz-devel libuuid-devel avahi-compat-libdns_sd-devel openldap-devel python-devel python3-numpy libxml2-devel gsl-devel readline-devel qt5-qtwebengine-devel R-devel R-Rcpp-devel R-RInside-devel

(I used these to compile ROOT in a “real”, fresh Fedora with Gnome, but did not test in WSL)