lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cross-compiling for MinGW on Fedora 36


From: Jean Abou Samra
Subject: Cross-compiling for MinGW on Fedora 36
Date: Sun, 26 Jun 2022 19:13:04 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0

Hi,

I recently reinstalled my system, now on Fedora (version 36) rather than
Ubuntu. I tried cross-compiling LilyPond for MinGW, to continue investigating
https://gitlab.com/lilypond/lilypond/-/issues/6361. However, Ghostscript
fails to compile with



In file included from /home/jean/repos/lilypond/release/binaries/mingw/dependencies/src/ghostscript-9.56.1/base/gp_unix.c:24: /home/jean/repos/lilypond/release/binaries/mingw/dependencies/src/ghostscript-9.56.1/base/time_.h:82:12: fatal error: sys/times.h: No such file or directory
   82 | #  include <sys/times.h>
      |            ^~~~~~~~~~~~~
compilation terminated.


The code in question reads



#if defined(HAVE_SYS_TIMES_H) && HAVE_SYS_TIMES_H == 1
#  include <sys/times.h>
#  define use_times_for_usertime 1
                /* Posix 1003.1b-1993 section 4.8.1.5 says that
                   CLK_TCK is obsolescent and that sysconf(_SC_CLK_TCK)
                   should be used instead, but this requires including
                   <unistd.h>, which is too painful to configure.  */
#  ifndef CLK_TCK
#    define CLK_TCK 100        /* guess for older hosts */
#  endif
#else
#  define use_times_for_usertime 0
#endif




As far as I understood, it's expected that MinGW doesn't have
sys/times.h. The question is thus why HAVE_SYS_TIMES_H was 1.
Looking into mingw/dependencies/build/ghostscript-9.56.1/config.log,
I find


configure:5685: checking sys/times.h usability
configure:5685: x86_64-w64-mingw32-gcc -c  -DNOCONTRIB -DHAVE_RESTRICT=1  conftest.c >&5
conftest.c:63:10: fatal error: sys/times.h: No such file or directory
   63 | #include <sys/times.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
configure:5685: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DIRENT_H 1
| #define HAVE_ERRNO_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_MALLOC_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_TIME_H 1
| /* end confdefs.h.  */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| #  include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| #  include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| #include <sys/times.h>
configure:5685: result: no
configure:5685: checking sys/times.h presence
configure:5685: x86_64-w64-mingw32-gcc -E  conftest.c
conftest.c:30:10: fatal error: sys/times.h: No such file or directory
   30 | #include <sys/times.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
configure:5685: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DIRENT_H 1
| #define HAVE_ERRNO_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_MALLOC_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_TIME_H 1
| /* end confdefs.h.  */
| #include <sys/times.h>
configure:5685: result: no
configure:5685: checking for sys/times.h
configure:5685: result: no



However, at the end, there is


GCFLAGSAUX='  -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -fno-strict-aliasing -Werror=declaration-after-statement -fno-builtin -fno-common -Werror=return-type -DHAVE_STDINT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIBDL=1 -DGX_COLOR_INDEX_TYPE="unsigned long long" -D__USE_UNIX98=1 -DBUILD_PDF=1 -I/home/jean/repos/lilypond/release/binaries/mingw/dependencies/src/ghostscript-9.56.1/pdf -DNOCONTRIB -DHAVE_RESTRICT=1 -fno-strict-aliasing'


That sounds odd. I'm a bit out of my depth here. Does anyone have
a clue?



Also, Fontconfig failed building before I did

diff --git a/release/binaries/lib/dependencies.py b/release/binaries/lib/dependencies.py
index 5cfb6af5d2..a3ef1e72ad 100644
--- a/release/binaries/lib/dependencies.py
+++ b/release/binaries/lib/dependencies.py
@@ -146,6 +146,11 @@ class Fontconfig(ConfigurePackage):
     def __str__(self) -> str:
         return f"Fontconfig {self.version}"

+    def build_env_extra(self, c: Config) -> Dict[str, str]:
+        extra = super().build_env_extra(c)
+        extra["CFLAGS"] = "-fstack-protector"
+        return extra
+

 fontconfig = Fontconfig()


following

https://github.com/msys2/MINGW-packages/issues/5868

(the linker error was about __strcpy_chk).

I have no idea why this is needed. Grepping for "FORTIFY_SOURCES"
in the Fontconfig repository doesn't yield matches. Again, can
anyone shed light on this?

Thanks for your patience.

Jean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]