Skip to content

hw/dmx/config: Link directly with libdmxconfig.a

orbea requested to merge orbea/xserver:dmx into master

When building xserver with slibtool (https://dev.midipix.org/cross/slibtool) the build will fail.

/usr/bin/ld: cannot find -ldmxconfig

This is because xserver creates libdmxconfig.a internally and then links with the linker flag -ldmxconfig. However according to automake documentation the -lfoo linker flags should only be used for external dependencies and all internal libraries should be linked with the libtool archive file (.la) or the static archive (.a) when the former is not available.

GNU libtool is far more permissive and happens to silently obscure this issue while slibtool fails because it instead sees '-L./.libs -ldmxconfig'.

rdlibtool --tag=CC --mode=link clang -DHAVE_DIX_CONFIG_H -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-defin
ition -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Werror=implicit -Werror=nonnull -Werror=init-self -Werror=main -Werror=mi
ssing-braces -Werror=sequence-point -Werror=return-type -Werror=trigraphs -Werror=array-bounds -Werror=write-strings -Werror=address -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -fno-strict-aliasin
g -fno-strict-aliasing -D_DEFAULT_SOURCE -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -I/usr/include/pixman-1 -I/usr/include/X11/dri -I/usr/include/libdrm -I/usr/include/valgrind -I/usr/include/freetype2 -
I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I../../../include -I../../../include -I../../../Xext -I../../../composite -I../../../damageext -I../../../
xfixes -I../../../Xi -I../../../mi -I../../../miext/sync -I../../../miext/shadow -I../../../miext/damage -I../../../render -I../../../randr -I../../../fb -I../../../dbe -I../../../present -fvisibility=hidden 
-I../../../hw/dmx -DHAVE_DMX_CONFIG_H -DDMX_LOG_STANDALONE -I/usr/include/libdrm -I/usr/include/valgrind -g -O2 -pthread -o xdmxconfig xdmxconfig-xdmxconfig.o xdmxconfig-dmxlog.o xdmxconfig-Canvas.o -L. -ldmx
config -lXaw7 -lXmu -lXt -lXpm -lX11 -lm

rdlibtool: lconf: {.name="libtool"}.
rdlibtool: fdcwd: {.fdcwd=AT_FDCWD, .realpath="/tmp/xserver/hw/dmx/config"}.
rdlibtool: lconf: fstatat(AT_FDCWD,".",...) = 0 {.st_dev = 34, .st_ino = 38053}.
rdlibtool: lconf: openat(AT_FDCWD,"libtool",O_RDONLY,0) = -1 [ENOENT].
rdlibtool: lconf: openat(AT_FDCWD,"../",O_DIRECTORY,0) = 3.
rdlibtool: lconf: fstat(3,...) = 0 {.st_dev = 34, .st_ino = 37921}.
rdlibtool: lconf: openat(3,"libtool",O_RDONLY,0) = -1 [ENOENT].
rdlibtool: lconf: openat(3,"../",O_DIRECTORY,0) = 4.
rdlibtool: lconf: fstat(4,...) = 0 {.st_dev = 34, .st_ino = 37484}.
rdlibtool: lconf: openat(4,"libtool",O_RDONLY,0) = -1 [ENOENT].
rdlibtool: lconf: openat(4,"../",O_DIRECTORY,0) = 3.
rdlibtool: lconf: fstat(3,...) = 0 {.st_dev = 34, .st_ino = 37046}.
rdlibtool: lconf: openat(3,"libtool",O_RDONLY,0) = 4.
rdlibtool: lconf: found "/tmp/xserver/libtool".
rdlibtool: link: clang xdmxconfig-xdmxconfig.o xdmxconfig-dmxlog.o xdmxconfig-Canvas.o -DHAVE_DIX_CONFIG_H -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Werror=implicit -Werror=nonnull -Werror=init-self -Werror=main -Werror=missing-braces -Werror=sequence-point -Werror=return-type -Werror=trigraphs -Werror=array-bounds -Werror=write-strings -Werror=address -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -fno-strict-aliasing -fno-strict-aliasing -D_DEFAULT_SOURCE -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -I/usr/include/pixman-1 -I/usr/include/X11/dri -I/usr/include/libdrm -I/usr/include/valgrind -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I../../../include -I../../../include -I../../../Xext -I../../../composite -I../../../damageext -I../../../xfixes -I../../../Xi -I../../../mi -I../../../miext/sync -I../../../miext/shadow -I../../../miext/damage -I../../../render -I../../../randr -I../../../fb -I../../../dbe -I../../../present -fvisibility=hidden -I../../../hw/dmx -DHAVE_DMX_CONFIG_H -DDMX_LOG_STANDALONE -I/usr/include/libdrm -I/usr/include/valgrind -g -O2 -pthread -L./.libs -ldmxconfig -lXaw7 -lXmu -lXt -lXpm -lX11 -lm -o .libs/xdmxconfig
/usr/bin/ld: cannot find -ldmxconfig
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
rdlibtool: exec error upon slbt_exec_link_create_executable(), line 1773: (see child process error messages).
rdlibtool: < returned to > slbt_exec_link(), line 2095.
make[5]: *** [Makefile:789: xdmxconfig] Error 2
make[5]: Leaving directory '/tmp/xserver/hw/dmx/config'
make[4]: *** [Makefile:912: install-recursive] Error 1
make[4]: Leaving directory '/tmp/xserver/hw/dmx/config'
make[3]: *** [Makefile:1072: install] Error 2
make[3]: Leaving directory '/tmp/xserver/hw/dmx/config'
make[2]: *** [Makefile:878: install-recursive] Error 1
make[2]: Leaving directory '/tmp/xserver/hw/dmx'
make[1]: *** [Makefile:614: install-recursive] Error 1
make[1]: Leaving directory '/tmp/xserver/hw'
make: *** [Makefile:815: install-recursive] Error 1

Merge request reports