From nobody Fri May 26 16:53:15 2023 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QSWG21sfvz4CfNp for ; Fri, 26 May 2023 16:53:30 +0000 (UTC) (envelope-from fbl@aoek.com) Received: from mail.yourbox.net (mail.yourbox.net [IPv6:2001:41d0:1:767d::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.yourbox.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QSWG11C2Fz45d8; Fri, 26 May 2023 16:53:29 +0000 (UTC) (envelope-from fbl@aoek.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=aoek.com header.s=mailbox header.b="R/SpvMBE"; spf=pass (mx1.freebsd.org: domain of fbl@aoek.com designates 2001:41d0:1:767d::1 as permitted sender) smtp.mailfrom=fbl@aoek.com; dmarc=pass (policy=reject) header.from=aoek.com Received: from mail.yourbox.net (localhost [IPv6:0:0:0:0:0:0:0:1]) by mail.yourbox.net (8.17.1/8.17.1) with ESMTP id 34QGrKa6023356; Fri, 26 May 2023 18:53:21 +0200 (CEST) (envelope-from fbl@aoek.com) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=aoek.com; s=mailbox; t=1685120001; bh=Lem2QqdyKeEcb80/o9NUDm8+erc3UZAmIu5TufIuvGs=; h=Date:From:To:Cc:Subject; b=R/SpvMBEkqsj5HHleAcDxloUJpHzbQaQchEy7AtNLOj1nP+A/3W+jt/dWoKxkVOTP +iC2rZYOXzYwG+nIUmUWl8qHil0Q1UJRjOPXkZOME6/47UWQGEtawGsrQxhlFUnJ04 4MVfRuqyr6H40yev9Tg6OYkhpkxdxlNU3n/MfOaBtj1snCyrA8loiSPkOUFVeiBZ4v pXHlS+U07n7JxTDX4/hF5f+jn9pRKsvNWf69gPXWuGOtE1IDsBwS8nY4ZiQX3xtR3g afP1g+U9gAeEoc91uSltD0+wUUs2TSjTLROvHrqJjcwv4mAulpdisepxuoytOyzb0k Zsaiwr0WmOLqg== List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Fri, 26 May 2023 18:53:15 +0200 From: =?UTF-8?Q?Jos=C3=A9_P=C3=A9rez?= To: freebsd-arm@freebsd.org Cc: kevans@freebsd.org Subject: devel/arm-none-eabi-newlib headers inconsistencies (not functional) or am I misusing something? Message-ID: <11a941a3a1c9e001559ccc6183af131d@mail.yourbox.net> X-Sender: fbl@aoek.com User-Agent: Roundcube Webmail/1.2.0 X-Spamd-Result: default: False [-2.37 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.999]; R_MIXED_CHARSET(0.63)[subject]; DMARC_POLICY_ALLOW(-0.50)[aoek.com,reject]; R_SPF_ALLOW(-0.20)[+mx]; R_DKIM_ALLOW(-0.20)[aoek.com:s=mailbox]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[freebsd-arm@freebsd.org]; ASN(0.00)[asn:16276, ipnet:2001:41d0::/32, country:FR]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[aoek.com:+]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; TO_DN_NONE(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Queue-Id: 4QSWG11C2Fz45d8 X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N Hi, a source as simple as this does not compile with devel/arm-none-eabi-newlib installed #include int main(int argc, char *argv[]) { return 0; } % arm-none-eabi-gcc break_arm.c In file included from break_arm.c:1: /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:59:26: error: expected ';' before 'typedef' 59 | __NULLABILITY_PRAGMA_PUSH | ^ | ; 60 | 61 | typedef __off_t fpos_t; | ~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:61:9: error: unknown type name '__off_t' 61 | typedef __off_t fpos_t; | ^~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:76:9: error: unknown type name '__off_t' 76 | typedef __off_t off_t; | ^~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:80:9: error: unknown type name '__ssize_t' 80 | typedef __ssize_t ssize_t; | ^~~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:86:9: error: unknown type name '__off64_t' 86 | typedef __off64_t off64_t; | ^~~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:91:9: error: unknown type name '__va_list' 91 | typedef __va_list __not_va_list__; | ^~~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:149:29: error: expected ')' before '_close' 149 | int (* _Nullable _close)(void *); | ^~~~~~~ | ) /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:150:29: error: expected ')' before '_read' 150 | int (* _Nullable _read)(void *, char *, int); | ^~~~~~ | ) /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:151:29: error: expected ')' before '_seek' 151 | fpos_t (* _Nullable _seek)(void *, fpos_t, int); | ^~~~~~ | ) /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:152:29: error: expected ')' before '_write' 152 | int (* _Nullable _write)(void *, const char *, int); | ^~~~~~~ | ) /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:174:9: error: unknown type name '__mbstate_t' 174 | __mbstate_t _mbstate; /* multibyte conversion state */ | ^~~~~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:373:25: error: unknown type name '__off_t'; did you mean '_off_t'? 373 | int fseeko(FILE *, __off_t, int); | ^~~~~~~ | _off_t /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:374:1: error: unknown type name '__off_t'; did you mean '_off_t'? 374 | __off_t ftello(FILE *); | ^~~~~~~ | _off_t /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:427:20: error: conflicting types for '_Nullable'; have 'int (*)(void *, const char *, int)' 427 | int (* _Nullable)(void *, const char *, int), | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:426:20: note: previous definition of '_Nullable' with type 'int (*)(void *, char *, int)' 426 | int (* _Nullable)(void *, char *, int), | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:428:23: error: conflicting types for '_Nullable'; have 'fpos_t (*)(void *, fpos_t, int)' {aka 'int (*)(void *, int, int)'} 428 | fpos_t (* _Nullable)(void *, fpos_t, int), | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:427:20: note: previous definition of '_Nullable' with type 'int (*)(void *, const char *, int)' 427 | int (* _Nullable)(void *, const char *, int), | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:429:20: error: conflicting types for '_Nullable'; have 'int (*)(void *)' 429 | int (* _Nullable)(void *)); | ~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:428:23: note: previous definition of '_Nullable' with type 'fpos_t (*)(void *, fpos_t, int)' {aka 'int (*)(void *, int, int)'} 428 | fpos_t (* _Nullable)(void *, fpos_t, int), | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:433:9: error: unknown type name '__ssize_t' 433 | typedef __ssize_t cookie_read_function_t(void *, char *, size_t); | ^~~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:434:9: error: unknown type name '__ssize_t' 434 | typedef __ssize_t cookie_write_function_t(void *, const char *, size_t); | ^~~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:450:25: error: unknown type name '__off_t'; did you mean '_off_t'? 450 | int ftruncate(int, __off_t); | ^~~~~~~ | _off_t /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:454:1: error: unknown type name '__off_t'; did you mean '_off_t'? 454 | __off_t lseek(int, __off_t, int); | ^~~~~~~ | _off_t /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:454:21: error: unknown type name '__off_t'; did you mean '_off_t'? 454 | __off_t lseek(int, __off_t, int); | ^~~~~~~ | _off_t /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:458:46: error: unknown type name '__off_t'; did you mean '_off_t'? 458 | void *mmap(void *, size_t, int, int, int, __off_t); | ^~~~~~~ | _off_t /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:462:33: error: unknown type name '__off_t'; did you mean '_off_t'? 462 | int truncate(const char *, __off_t); | ^~~~~~~ | _off_t /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:546:25: error: expected ';' before 'int' 546 | __NULLABILITY_PRAGMA_POP | ^ | ; Regarding the first error it seems that __NULLABILITY_PRAGMA_PUSH is not defined in the headers of devel/arm-none-eabi-*. I managed to work the issue around by copying and pasting this from /usr/include/sys/cdefs.h at the end of /usr/local/arm-none-eabi/include/sys/cdefs.h /* * Nullability qualifiers: currently only supported by Clang. */ #if !(defined(__clang__) && __has_feature(nullability)) #define _Nonnull #define _Nullable #define _Null_unspecified #define __NULLABILITY_PRAGMA_PUSH #define __NULLABILITY_PRAGMA_POP #else #define __NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"") #define __NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop") #endif But this workaround looks quite odd to me because, as the comment itself mentions, this is a clang only thing and we are on gcc, so maybe we shall instead remove all the __NULLABILITY_PRAGMA_PUSHes and __NULLABILITY_PRAGMA_POPs from the arm-none-eabi-* ports headers? Regarding the typedef errors, I am unsure on how to proceed: for example __off_t is defined here /usr/local/arm-none-eabi/include/machine/types.h:19 typedef long int __off_t; but this header is not included by stdio.h. If I force the inclusion, i.e. #include #include ... the corresponding error goes away, but the following errors remain: /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:80:9: error: unknown type name '__ssize_t' 80 | typedef __ssize_t ssize_t; | ^~~~~~~~~ /usr/local/lib/gcc/arm-none-eabi/11.3.0/include-fixed/stdio.h:86:9: error: unknown type name '__off64_t' 86 | typedef __off64_t off64_t; | ^~~~~~~~~ ... (others similar follow) __ssize_t nor __off64_t are not typedef'd anywhere in /usr/local/arm-none-eabi (devel/arm-none-eabi-newlib) nor /usr/local/lib/gcc/arm-none-eabi/11.3.0 (devel/arm-none-eabi-gcc). They are typedef'd in default /usr/include/sys/_types.h which is not in the search path, so it seems that the arm-none-eabi-* ports are not self sufficient. Maybe there is a missing dependency? Any suggestion? BR, -- José Pérez