NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/58674: HEAD fails to build tools on recent Linux (Fedora 40)
>Number: 58674
>Category: lib
>Synopsis: HEAD fails to build tools on recent Linux (Fedora 40)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Sep 17 00:20:00 +0000 2024
>Originator: David H. Gutteridge
>Release: HEAD (10.99.12)
>Organization:
TNF
>Environment:
Linux arcusxiii.nonus-porta.net 6.10.10-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Sep 12 18:26:09 UTC 2024 x86_64 GNU/Linux
>Description:
"./build.sh -U -m amd64 -j 2 tools" fails on Fedora 40 initially like
so:
# compile date/date.lo
cc -O -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/home/disciple/NetBSD/src/tools/compat/obj -I/home/disciple/NetBSD/src/tools/compat/obj/include -I/home/disciple/NetBSD/src/tools/compat -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -I/home/disciple/NetBSD/src/tools/date/../../bin/date -c -o date.lo.o -Wno-format-nonliteral /home/disciple/NetBSD/src/tools/date/../../bin/date/date.c
/home/disciple/NetBSD/src/tools/date/../../bin/date/date.c: In function 'main':
/home/disciple/NetBSD/src/tools/date/../../bin/date/date.c:115:37: error: implicit declaration of function 'strptime'; did you mean 'strftime'? [-Wimplicit-function-declaration]
115 | p = strptime(optarg, "%Y%m%d", &tm);
| ^~~~~~~~
| strftime
/home/disciple/NetBSD/src/tools/date/../../bin/date/date.c:115:35: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
115 | p = strptime(optarg, "%Y%m%d", &tm);
| ^
/home/disciple/NetBSD/src/tools/date/../../bin/date/date.c: In function 'setthetime':
/home/disciple/NetBSD/src/tools/date/../../bin/date/date.c:231:19: error: assignment to 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
231 | t = strptime(p, fmt, lt);
| ^
To work around this, I added this hack (not where we'd do this, I imagine):
RCS file: /cvsroot/src/tools/date/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile 27 May 2021 08:41:35 -0000 1.2
+++ Makefile 16 Sep 2024 18:23:46 -0000
@@ -19,4 +19,6 @@
COMPATOBJ!= cd ${NETBSDSRCDIR}/tools/compat && ${PRINTOBJDIR}
.-include "${COMPATOBJ}/defs.mk"
+HOST_CFLAGS+= -D_XOPEN_SOURCE
+
.include "${.CURDIR}/../Makefile.host"
That gets me past that error and on to more in the same tool.
cc -O -D_XOPEN_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/home/disciple/NetBSD/src/tools/compat/obj -I/home/disciple/NetBSD/src/tools/compat/obj/include -I/home/disciple/NetBSD/src/tools/compat -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -I/home/disciple/NetBSD/src/tools/date/../../bin/date -c -o date.lo.o -Wno-format-nonliteral /home/disciple/NetBSD/src/tools/date/../../bin/date/date.c
In file included from /home/disciple/NetBSD/src/tools/compat/obj/nbtool_config.h:934,
from /home/disciple/NetBSD/src/tools/date/../../bin/date/date.c:33:
/home/disciple/NetBSD/src/tools/compat/compat_defs.h: In function 'be16enc':
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1153:13: error: implicit declaration of function 'htobe16' [-Wimplicit-function-declaration]
1153 | u = hto ## endian ## bits (u); \
| ^~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1157:1: note: in expansion of macro '__GEN_ENDIAN_ENC'
1157 | __GEN_ENDIAN_ENC(16, be)
| ^~~~~~~~~~~~~~~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h: In function 'be32enc':
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1153:13: error: implicit declaration of function 'htobe32' [-Wimplicit-function-declaration]
1153 | u = hto ## endian ## bits (u); \
| ^~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1160:1: note: in expansion of macro '__GEN_ENDIAN_ENC'
1160 | __GEN_ENDIAN_ENC(32, be)
| ^~~~~~~~~~~~~~~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h: In function 'be64enc':
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1153:13: error: implicit declaration of function 'htobe64' [-Wimplicit-function-declaration]
1153 | u = hto ## endian ## bits (u); \
| ^~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1163:1: note: in expansion of macro '__GEN_ENDIAN_ENC'
1163 | __GEN_ENDIAN_ENC(64, be)
| ^~~~~~~~~~~~~~~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h: In function 'le16enc':
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1153:13: error: implicit declaration of function 'htole16' [-Wimplicit-function-declaration]
1153 | u = hto ## endian ## bits (u); \
| ^~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1166:1: note: in expansion of macro '__GEN_ENDIAN_ENC'
1166 | __GEN_ENDIAN_ENC(16, le)
| ^~~~~~~~~~~~~~~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h: In function 'le32enc':
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1153:13: error: implicit declaration of function 'htole32' [-Wimplicit-function-declaration]
1153 | u = hto ## endian ## bits (u); \
| ^~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1169:1: note: in expansion of macro '__GEN_ENDIAN_ENC'
1169 | __GEN_ENDIAN_ENC(32, le)
| ^~~~~~~~~~~~~~~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h: In function 'le64enc':
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1153:13: error: implicit declaration of function 'htole64' [-Wimplicit-function-declaration]
1153 | u = hto ## endian ## bits (u); \
| ^~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1172:1: note: in expansion of macro '__GEN_ENDIAN_ENC'
1172 | __GEN_ENDIAN_ENC(64, le)
| ^~~~~~~~~~~~~~~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h: In function 'be16dec':
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1185:22: error: implicit declaration of function 'be16toh' [-Wimplicit-function-declaration]
1185 | __GEN_ENDIAN_DEC(16, be)
| ^~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1182:16: note: in definition of macro '__GEN_ENDIAN_DEC'
1182 | return endian ## bits ## toh (u); \
| ^~~~~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h: In function 'be32dec':
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1188:22: error: implicit declaration of function 'be32toh' [-Wimplicit-function-declaration]
1188 | __GEN_ENDIAN_DEC(32, be)
| ^~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1182:16: note: in definition of macro '__GEN_ENDIAN_DEC'
1182 | return endian ## bits ## toh (u); \
| ^~~~~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h: In function 'be64dec':
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1191:22: error: implicit declaration of function 'be64toh' [-Wimplicit-function-declaration]
1191 | __GEN_ENDIAN_DEC(64, be)
| ^~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1182:16: note: in definition of macro '__GEN_ENDIAN_DEC'
1182 | return endian ## bits ## toh (u); \
| ^~~~~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h: In function 'le16dec':
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1194:22: error: implicit declaration of function 'le16toh' [-Wimplicit-function-declaration]
1194 | __GEN_ENDIAN_DEC(16, le)
| ^~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1182:16: note: in definition of macro '__GEN_ENDIAN_DEC'
1182 | return endian ## bits ## toh (u); \
| ^~~~~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h: In function 'le32dec':
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1197:22: error: implicit declaration of function 'le32toh' [-Wimplicit-function-declaration]
1197 | __GEN_ENDIAN_DEC(32, le)
| ^~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1182:16: note: in definition of macro '__GEN_ENDIAN_DEC'
1182 | return endian ## bits ## toh (u); \
| ^~~~~~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h: In function 'le64dec':
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1200:22: error: implicit declaration of function 'le64toh' [-Wimplicit-function-declaration]
1200 | __GEN_ENDIAN_DEC(64, le)
| ^~
/home/disciple/NetBSD/src/tools/compat/compat_defs.h:1182:16: note: in definition of macro '__GEN_ENDIAN_DEC'
1182 | return endian ## bits ## toh (u); \
| ^~~~~~
/home/disciple/NetBSD/src/tools/date/../../bin/date/date.c: In function 'main':
/home/disciple/NetBSD/src/tools/date/../../bin/date/date.c:155:31: error: implicit declaration of function 'setenv'; did you mean 'getenv'? [-Wimplicit-function-declaration]
155 | (void)setenv("TZ", "UTC0", 1);
| ^~~~~~
| getenv
*** Failed target: date.lo
In general, it seems like builds wouldn't work with recent Linux
distros, such as Fedora 40, which has (for example)
-Wimplicit-function-declaration baked on (as an error) by default.
Looking in tools/compat/compat_defs.h, I find some things seemingly
contradictory:
/*
* On NetBSD, ensure that _NETBSD_SOURCE does not get defined, so that
* accidental attempts to use NetBSD-specific features instead of more
* portable features is likely to be noticed when the tools are built
* on NetBSD. Define enough other feature test macros to expose the
* features we need.
*/
#ifdef __NetBSD__
#define _ISOC99_SOURCE
#define _POSIX_SOURCE 1
#define _POSIX_C_SOURCE 200112L
#define _XOPEN_SOURCE 600
#endif /* __NetBSD__ */
/*
* Linux: <features.h> turns on _POSIX_SOURCE by default, even though the
* program (not the OS) should do that. Preload <features.h> and
* then override some of the feature test macros.
*/
#if defined(__linux__) && HAVE_FEATURES_H
#include <features.h>
#undef _POSIX_SOURCE
#undef _POSIX_C_SOURCE
#define __USE_ISOC99 1
#endif /* __linux__ && HAVE_FEATURES_H */
So, on NetBSD the idea is those various defines are required
universally, but on Linux "the program ... should do that". Which is it?
(Yes, I know _XOPEN_SOURCE isn't touched there.)
I haven't got to looking at those undefined conversion macros yet.
Dave
>How-To-Repeat:
As above.
>Fix:
Home |
Main Index |
Thread Index |
Old Index