Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 950320 - app-misc/ddcutil-2.2.0 - does not compile without X
Summary: app-misc/ddcutil-2.2.0 - does not compile without X
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2025-02-26 20:31 UTC by Morton Pellung
Modified: 2025-03-02 10:06 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log with ddcutil-2.2.0-fix-build-without-X.patch (build-ddcutil.log.bz2,7.26 KB, application/x-bzip2)
2025-02-28 17:16 UTC, Morton Pellung
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Morton Pellung 2025-02-26 20:31:25 UTC
upgrading ddcutil

[ebuild     U ~] app-misc/ddcutil-2.2.0:0/5::gentoo [2.1.4:0/5::gentoo] USE="user-permissions -X -usb-monitor (-drm%)" VIDEO_CARDS="-nvidia" 0 KiB


although flag -X, and this is really a minimal fresh installation without X, it still does search for X headers and fails:

....
Making all in ddc                                                                                                                                                                                                                                                    
make[3]: Entering directory '/var/tmp/portage/app-misc/ddcutil-2.2.0/work/ddcutil-2.2.0/src/ddc'                                                                                                                                                                     
/bin/sh ../../libtool  --tag=CC   --mode=compile x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../..  -I/usr/include/libdrm -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include  -I../../src -I../../src/public  -Wall -std=c11 -Werror=unused-result -Wformat-security -fno-common -Wimplicit-function-declaration -Wno-compound-token-split-by-macro -Wimplicit-fallthrough -D_GLIBCXX_ASSERTIONS -Werror=implicit -Werror=incompatible-pointer-types -Werror=int-conversion   -fPIC -D_GNU_SOURCE -O2 -pipe -march=goldmont-plus -c -o ddc_common_init.lo ddc_common_init.c                                                                                                                                                                                                                               
libtool: compile:  x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../.. -I/usr/include/libdrm -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I../../src -I../../src/public -Wall -std=c11 -Werror=unused-result -Wformat-security -fno-common -Wimplicit-function-declaration -Wno-compound-token-split-by-macro -Wimplicit-fallthrough -D_GLIBCXX_ASSERTIONS -Werror=implicit -Werror=incompatible-pointer-types -Werror=int-conversion -fPIC -D_GNU_SOURCE -O2 -pipe -march=goldmont-plus -c ddc_common_init.c  -fPIC -DPIC -o .l
ibs/ddc_common_init.o                                                                                                                                                                                                                                                
In file included from ../../src/dw/dw_common.h:17,                                                                                                                                                                                                                   
                 from ddc_common_init.c:68:                                                                                                                                                                                                                          
../../src/dw/dw_xevent.h:10:10: fatal error: X11/Xlib.h: No such file or directory                                                                                                                                                                                   
   10 | #include <X11/Xlib.h>                                                                                                                                                                                                                                        
      |          ^~~~~~~~~~~~                                                                                                                                                                                                                                        
compilation terminated.                                                                                                                                                                                                                                              
make[3]: *** [Makefile:511: ddc_common_init.lo] Error 1                                                                                                                                                                                                              
make[3]: Leaving directory '/var/tmp/portage/app-misc/ddcutil-2.2.0/work/ddcutil-2.2.0/src/ddc'               


Reproducible: Always
Comment 1 Märt Bakhoff 2025-02-27 11:49:59 UTC
Reported upstream https://github.com/rockowitz/ddcutil/issues/504 
It seems it fails differently depending on whether the headers are installed or not.
Comment 2 Märt Bakhoff 2025-02-27 14:37:57 UTC
Upstream fix available: 
https://github.com/rockowitz/ddcutil/commit/a35d1dc432d4dd419e4874b37c62d23f3ae70469
Comment 3 Avraham Hollander 2025-02-27 15:51:03 UTC
My situation is slightly different. I have the X11 headers available, but the package is being built with USE="-X", and I get the following error:

libtool: link:  x86_64-pc-linux-gnu-gcc -shared  -fPIC -DPIC  -Wl,--whole-archive ./.libs/libcommon.a libmain/.libs/libsharedlib.a -Wl,--no-whole-archive  -lz -ljansson -lglib-2.0 -ludev -ldrm  -Werror=unused-result -Werror=implicit -Werror=incompatible-pointer-types -Werror=int-conversion -march=native -O3 -flto=auto -fuse-linker-plugin -Wl,-O1 -Wl,--as-needed -Wl,-z -Wl,pack-relative-relocs   -Wl,-soname -Wl,libddcutil.so.5 -Wl,-version-script -Wl,.libs/libddcutil.ver -o .libs/libddcutil.so.5.2.0
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/app-misc/ddcutil-2.2.0/temp/cc0xgFv2.ltrans2.ltrans.o: in function `dw_free_xevent_data':
<artificial>:(.text+0x11dd): undefined reference to `XCloseDisplay'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/app-misc/ddcutil-2.2.0/temp/cc0xgFv2.ltrans2.ltrans.o: in function `dw_send_x11_termination_message':
<artificial>:(.text+0x2aa6): undefined reference to `XSendEvent'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x2af8): undefined reference to `XFlush'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/app-misc/ddcutil-2.2.0/temp/cc0xgFv2.ltrans2.ltrans.o: in function `dw_next_X11_event_of_interest':
<artificial>:(.text+0x2cf1): undefined reference to `XIfEvent'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x2e5d): undefined reference to `XCheckTypedEvent'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/app-misc/ddcutil-2.2.0/temp/cc0xgFv2.ltrans2.ltrans.o: in function `dw_init_xevent_screen_change_notification':
<artificial>:(.text+0x2f2f): undefined reference to `XOpenDisplay'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x2f64): undefined reference to `XRRQueryExtension'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x2f9d): undefined reference to `XCloseDisplay'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x304b): undefined reference to `XRRQueryVersion'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x3088): undefined reference to `XRRSelectInput'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x30aa): undefined reference to `XInternAtom'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x30c2): undefined reference to `XRRSelectInput'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/app-misc/ddcutil-2.2.0/temp/cc0xgFv2.ltrans2.ltrans.o: in function `dw_detect_xevent_screen_change':
<artificial>:(.text+0x3283): undefined reference to `XCheckTypedEvent'
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x32ac): undefined reference to `XCheckTypedEvent'
collect2: error: ld returned 1 exit status


Enabling USE="X" for the package allows it to build without issue.
Comment 4 Avraham Hollander 2025-02-27 15:55:10 UTC
Ok yup I see the same thing in the discussion on GitHub. Chucking that commit in /etc/portage/patches for now makes it work.
Comment 5 Larry the Git Cow gentoo-dev 2025-02-27 16:04:23 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd0c7bedf719a3fc3eab0f2277ba35cd32946262

commit dd0c7bedf719a3fc3eab0f2277ba35cd32946262
Author:     Kostadin Shishmanov <kostadinshishmanov@protonmail.com>
AuthorDate: 2025-02-27 15:00:42 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-02-27 16:03:41 +0000

    app-misc/ddcutil: add patch to fix build with USE=-X
    
    Upstream added a feature [1] that uses X11 API unconditionally which
    broke building with USE=-X. The patch [2] changes it, so support for
    this feature is enabled only if ddcutil is built with X support.
    
    [1] https://github.com/rockowitz/ddcutil/commit/6bf1062d
    [2] https://github.com/rockowitz/ddcutil/commit/a35d1dc
    
    Closes: https://bugs.gentoo.org/950320
    Signed-off-by: Kostadin Shishmanov <kostadinshishmanov@protonmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 app-misc/ddcutil/ddcutil-2.2.0.ebuild              |   1 +
 .../files/ddcutil-2.2.0-fix-build-without-X.patch  | 280 +++++++++++++++++++++
 2 files changed, 281 insertions(+)
Comment 6 Morton Pellung 2025-02-28 17:16:21 UTC
This is not fixed, I see in build.log:

Applying ddcutil-2.2.0-fix-build-without-X.patch ..
...
configure: x11...        disabled
...
In file included from ../../src/dw/dw_common.h:17,
                 from ddc_common_init.c:68:
../../src/dw/dw_xevent.h:10:10: fatal error: X11/Xlib.h: No such file or directory
Comment 7 Morton Pellung 2025-02-28 17:16:58 UTC
Created attachment 920037 [details]
build.log with ddcutil-2.2.0-fix-build-without-X.patch
Comment 8 Avraham Hollander 2025-02-28 17:26:00 UTC
(In reply to Morton Pellung from comment #6)
> This is not fixed, I see in build.log:
> 
> Applying ddcutil-2.2.0-fix-build-without-X.patch ..
> ...
> configure: x11...        disabled
> ...
> In file included from ../../src/dw/dw_common.h:17,
>                  from ddc_common_init.c:68:
> ../../src/dw/dw_xevent.h:10:10: fatal error: X11/Xlib.h: No such file or
> directory

It doesn't sound intentional that X11/Xlib.h would still be required even when building it with X11 support disabled. This would be an upstream bug.
Comment 9 Märt Bakhoff 2025-03-01 07:22:13 UTC
Upstream just committed some more fixes for this case
Comment 10 Kostadin Shishmanov 2025-03-01 16:04:25 UTC
Märt and Morton, I will make a PR adding the new commits to the patch. I guess the first patch worked for me because I have X installed while you don't.
Comment 11 Larry the Git Cow gentoo-dev 2025-03-01 21:36:42 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0d08b8ad9215bbde888a1d08f3d9ec052667884

commit d0d08b8ad9215bbde888a1d08f3d9ec052667884
Author:     Kostadin Shishmanov <kostadinshishmanov@protonmail.com>
AuthorDate: 2025-03-01 16:10:49 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-03-01 21:35:36 +0000

    app-misc/ddcutil: fix patch for USE=-X
    
    Turns out upstream didn't completely solve the issue and ddcutil
    still failed to build on systems where X was not installed.
    
    Bug: https://bugs.gentoo.org/950320
    Signed-off-by: Kostadin Shishmanov <kostadinshishmanov@protonmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/40832
    Signed-off-by: Sam James <sam@gentoo.org>

 .../files/ddcutil-2.2.0-fix-build-without-X.patch  | 145 ++++++++++++++++++---
 1 file changed, 129 insertions(+), 16 deletions(-)
Comment 12 Morton Pellung 2025-03-02 09:46:55 UTC
Location of error moved to:

make[3]: Entering directory '/var/tmp/portage/app-misc/ddcutil-2.2.0/work/ddcutil-2.2.0/src/ddc'
/bin/sh ../../libtool  --tag=CC   --mode=compile x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../..  -I/usr/include/libdrm -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include  -I../../src -I../../src/public  -Wall -std=c11 -Werror=unused-result -Wformat-security -fno-common -Wimplicit-function-declaration -Wno-compound-token-split-by-macro -Wimplicit-fallthrough -D_GLIBCXX_ASSERTIONS -Werror=implicit -Werror=incompatible-pointer-types -Werror=int-conversion   -fPIC -D_GNU_SOURCE -O2 -pipe -march=goldmont-plus -c -o ddc_services.lo ddc_services.c
libtool: compile:  x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../.. -I/usr/include/libdrm -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I../../src -I../../src/public -Wall -std=c11 -Werror=unused-result -Wformat-security -fno-common -Wimplicit-function-declaration -Wno-compound-token-split-by-macro -Wimplicit-fallthrough -D_GLIBCXX_ASSERTIONS -Werror=implicit -Werror=incompatible-pointer-types -Werror=int-conversion -fPIC -D_GNU_SOURCE -O2 -pipe -march=goldmont-plus -c ddc_services.c  -fPIC -DPIC -o .libs/ddc_services.o
In file included from ddc_services.c:66:
../../src/dw/dw_xevent.h:10:10: fatal error: X11/Xlib.h: No such file or directory
   10 | #include <X11/Xlib.h>
      |          ^~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:511: ddc_services.lo] Error 1
make[3]: Leaving directory '/var/tmp/portage/app-misc/ddcutil-2.2.0/work/ddcutil-2.2.0/src/ddc'
Comment 13 Märt Bakhoff 2025-03-02 10:06:19 UTC
Morton, could you also notify upstream at https://github.com/rockowitz/ddcutil/issues/504 ? I actually have x11 installed so it doesn't reproduce on my machine.