https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122416

            Bug ID: 122416
           Summary: Hardcoded system include path breaks cross-compilation
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: cobol
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kartatz at amanoteam dot com
  Target Milestone: ---

The recent inclusion of the libxml dependency in the COBOL frontend
unfortunately broke the ability to cross-compile the gcobol compiler due to the
hardcoded system include path added to the Makefile here
(https://github.com/gcc-mirror/gcc/blob/b20c6458fa0a9e78253052f0493e921f75641828/libgcobol/Makefile.am#L58):

```
$ ../configure --host=aarch64-unknown-linux-gnu --enable-languages=cobol <...>
$ make
...
In file included from /usr/include/libxml2/libxml/parser.h:812,
                 from /usr/include/libxml2/libxml/SAX2.h:18,
                 from ../../../libgcobol/xmlparse.cc:46:
/usr/include/libxml2/libxml/encoding.h:31:10: fatal error: unicode/ucnv.h: No
such file or directory
   31 | #include <unicode/ucnv.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:579: xmlparse.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
...
```

I think it would be more appropriate to test for the existence of the libxml2
library and headers within the standard compiler search paths rather than
directly using system paths, which may not exist or may be undesirable to use
(especially in cross-compilation environments).

Reply via email to