[MacPorts] #70504: links @2.30+x11: configure: error: No graphics drivers found.

MacPorts noreply at macports.org
Thu Nov 14 19:54:59 UTC 2024


#70504: links @2.30+x11: configure: error: No graphics drivers found.
------------------------+--------------------
  Reporter:  ballapete  |      Owner:  (none)
      Type:  defect     |     Status:  new
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.9.3
Resolution:             |   Keywords:
      Port:  links      |
------------------------+--------------------
Changes (by ryandesign):

 * cc: dgonyier, aeiouaeiouaeiouaeiouaeiouaeiou (added)


Comment:

 This is happening due to a combination of a strange configure script and a
 patch that we are adding in the port. The patch was correct when I added
 it to fix #62432, but links was updated many times since then. Most
 recently, during the 2.30 update, most of the patch was removed presumably
 because it was no longer needed but the section that previously fixed the
 detection of X was kept.

 ----

 In the unpatched 2.29 configure script it says:

 {{{#!m4
   test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
 }}}

 and the test uses this function:

 {{{#!c
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 }}}

 which expands to:

 {{{#!c
 int main() {
 XtMalloc()
 ; return 0; }
 }}}

 Per the old ticket, this had failed due to:

 {{{
 configure:8935:1: error: implicit declaration of function 'XtMalloc' is
 invalid in C99 [-Werror,-Wimplicit-function-declaration]
 XtMalloc()
 ^
 1 error generated.
 }}}

 I had tried to fix it by adding:

 {{{#!c
 #include <X11/Intrinsic.h>
 }}}

 But this had failed with:

 {{{
 configure:8946:10: error: too few arguments to function call, expected 1,
 have 0
 XtMalloc()
 ~~~~~~~~ ^
 /opt/local/include/X11/Intrinsic.h:1853:14: note: 'XtMalloc' declared here
 extern char *XtMalloc(
              ^
 1 error generated.
 }}}

 Therefore I further changed:

 {{{#!c
 ${x_direct_test_function}()
 }}}

 to:

 {{{#!c
 ${x_direct_test_function}(0)
 }}}

 and that's what's still in the patch today.

 ----

 links is weird in that I believe its developer generates the configure
 script by running the `rebuild` script which post-processes the configure
 script in various ways, including, as of 2.30, this `sed` expression:

 {{{#!sh
 s/XtMalloc/'int XtMalloc'/
 }}}

 As a result, the configure script in 2.30 now reads:

 {{{
   test -z "$x_direct_test_function" && x_direct_test_function='int
 XtMalloc'
 }}}

 and the test function:

 {{{#!c
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 }}}

 now expands to:

 {{{#!c
 int main() {
 int XtMalloc()
 ; return 0; }
 }}}

 which looks like nonsense to me. The compiler allows it but it certainly
 doesn't do anything to verify whether or not `XtMalloc` exists. The
 previous code in 2.29 and earlier tried to call `XtMalloc`, thereby
 verifying it exists. The new 2.30 code declares a local `XtMalloc`
 function inside the `main` function which it never calls. If we remove our
 patch, configure "finds" X, though I'm pretty sure it would "find" X even
 if it weren't there.

 With our patch in place, the function being tested becomes:

 {{{#!c
 int main() {
 int XtMalloc(0)
 ; return 0; }
 }}}

 which is not only nonsense but also a syntax error which is why configure
 currently fails.

 The developer of links needs to be notified to fix the configure test
 properly and to remove their weird `sed` replacement of `XtMalloc` by
 `'int XtMalloc'`.

-- 
Ticket URL: <https://trac.macports.org/ticket/70504#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list