NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
toolchain/61011: Release build fails when source path contains a directory named `C'.
>Number: 61011
>Category: toolchain
>Synopsis: Release build fails when source path contains a directory named `C'.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: toolchain-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Nov 14 22:25:00 +0000 2026
>Originator: RVP
>Release: NetBSD-11.1
>Organization:
>Environment:
NetBSD-HEAD, 11.x, ...
>Description:
Problem reported here:
https://mail-index.netbsd.org/netbsd-users/2026/11/02/msg035167.html
`build.sh release' fails when building `external/lgpl3/gmp' with this
error:
```
/home/ropf/obj/tooldir.Linux-6.18.7-76061807-generic-x86_64/bin/nbm4 -DCONFIG_TOP_SRCDIR=/home/ropf/Documents/workspace/C/NetBSD/netbsd-11-src/external/lgpl3/gmp/lib/libgmp/../../dist -I/home/ropf/Documents/workspace/C/NetBSD/netbsd-11-src/external/lgpl3/gmp/lib/libgmp -I/home/ropf/obj/external/lgpl3/gmp/lib/libgmp/dummy -I/home/ropf/Documents/workspace/C/NetBSD/netbsd-11-src/external/lgpl3/gmp/lib/libgmp/../../dist/ -I/home/ropf/Documents/workspace/C/NetBSD/netbsd-11-src/external/lgpl3/gmp/lib/libgmp/../../dist/mpn -I/home/ropf/obj/external/lgpl3/gmp/lib/libgmp -DPIC -DOPERATION_sqr_diag_addlsh1 /home/ropf/Documents/workspace/C/NetBSD/netbsd-11-src/external/lgpl3/gmp/lib/libgmp/../../dist/mpn/x86_64/sqr_diag_addlsh1.asm > sqr_diag_addlsh1.s
nbm4: unexpected end of input, unclosed parenthesis:
/home/ropf/Documents/workspace/C/NetBSD/netbsd-11-src/external/lgpl3/gmp/lib/libgmp/../../dist/mpn/x86_64/sqr_diag_addlsh1.asm at line 116
*** Failed target: sqr_diag_addlsh1.s
*** In directory: /home/ropf/Documents/workspace/C/NetBSD/netbsd-11-src/external/lgpl3/gmp/lib/libgmp
*** Failed commands:
${TOOL_M4} -DCONFIG_TOP_SRCDIR=${DIST} ${BUILD_S_INCS} ${M4FLAGS} ${M4FLAGS.${.TARGET:R}} -DOPERATION_${.TARGET:R} ${DIST}/${:Umpn/x86_64/sqr_diag_addlsh1.asm} > ${.TARGET}
=> /home/ropf/obj/tooldir.Linux-6.18.7-76061807-generic-x86_64/bin/nbm4 -DCONFIG_TOP_SRCDIR=/home/ropf/Documents/workspace/C/NetBSD/netbsd-11-src/external/lgpl3/gmp/lib/libgmp/../../dist -I/home/ropf/Documents/workspace/C/NetBSD/netbsd-11-src/external/lgpl3/gmp/lib/libgmp -I/home/ropf/obj/external/lgpl3/gmp/lib/libgmp/dummy -I/home/ropf/Documents/workspace/C/NetBSD/netbsd-11-src/external/lgpl3/gmp/lib/libgmp/../../dist/ -I/home/ropf/Documents/workspace/C/NetBSD/netbsd-11-src/external/lgpl3/gmp/lib/libgmp/../../dist/mpn -I/home/ropf/obj/external/lgpl3/gmp/lib/libgmp -DPIC -DOPERATION_sqr_diag_addlsh1 /home/ropf/Documents/workspace/C/NetBSD/netbsd-11-src/external/lgpl3/gmp/lib/libgmp/../../dist/mpn/x86_64/sqr_diag_addlsh1.asm > sqr_diag_addlsh1.s
*** [sqr_diag_addlsh1.s] Error code 1
```
This is due to:
1. The source dir. having a component named `C'.
2. `external/lgpl3/gmp/dist/mpn/x86_64/sqr_diag_addlsh1.asm' having:
```
32
33 include(`../config.m4')
34
```
3. `external/lgpl3/gmp/lib/libgmp/arch/x86_64/config.m4' having:
```
32 include(CONFIG_TOP_SRCDIR`/mpn/asm-defs.m4')
33 include_mpn(`x86_64/x86_64-defs.m4')
```
4. `external/lgpl3/gmp/dist/mpn/asm-defs.m4' having:
```
1045
1046 define(C, `
1047 dnl')
1048
```
(Note that C == dnl)
When libgmp is compiled for the `tools' build, the configure script is
used, and this quotes `CONFIG_TOP_SRCDIR' correctly. However, for the
release build, NetBSD's build system passes `CONFIG_TOP_SRCDIR' on the
command line and this is _not_ quoted:
external/lgpl3/gmp/lib/libgmp/Makefile:
```
228 ${_build:R}.s: Makefile dummy ${.OBJDIR}/config.m4 ${DIST}/${_src}
229 ${TOOL_M4} -DCONFIG_TOP_SRCDIR=${DIST} ${BUILD_S_INCS} \
230 ${M4FLAGS} ${M4FLAGS.${.TARGET:R}} \
231 -DOPERATION_${.TARGET:R} ${DIST}/${_src} > ${.TARGET}
```
So, the dir. named `C' is expanded to `dnl' and closing parenthesis in
the usage in `../config.m4' is lost, and you get the error.
The same issue arises if there's a dir. named `dnl' in the source path.
In this case, buiding `external/bsd/elftoolchain' flakes out, much
sooner.
>How-To-Repeat:
Create a dir called `C' (or `dnl') and extract the source sets into it.
Do a release build.
>Fix:
Patch for -HEAD:
---START patch -HEAD---
diff -urN a/src/external/bsd/elftoolchain/common/sys/Makefile b/src/external/bsd/elftoolchain/common/sys/Makefile
--- a/src/external/bsd/elftoolchain/common/sys/Makefile 2024-03-28 01:50:50.122383438 +0000
+++ b/src/external/bsd/elftoolchain/common/sys/Makefile 2026-11-14 21:43:05.676959806 +0000
@@ -12,7 +12,7 @@
elfdefinitions.h: elfdefinitions.m4 elfconstants.m4
${_MKTARGET_CREATE}
- ${TOOL_M4} -I${SRCDIR} -D SRCDIR=${SRCDIR} ${M4FLAGS} \
+ ${TOOL_M4} -I${SRCDIR} -D SRCDIR=\`${SRCDIR}\' ${M4FLAGS} \
elfdefinitions.m4 > ${.TARGET}
.PHONY: all clean clobber depend
diff -urN a/src/external/lgpl3/gmp/lib/libgmp/Makefile b/src/external/lgpl3/gmp/lib/libgmp/Makefile
--- a/src/external/lgpl3/gmp/lib/libgmp/Makefile 2026-04-19 03:56:37.340374948 +0000
+++ b/src/external/lgpl3/gmp/lib/libgmp/Makefile 2026-11-14 21:41:26.770605674 +0000
@@ -226,7 +226,7 @@
.for _build _src in ${ASM_SRCS_LIST}
${_build:R}.s: Makefile dummy ${.OBJDIR}/config.m4 ${DIST}/${_src}
- ${TOOL_M4} -DCONFIG_TOP_SRCDIR=${DIST} ${BUILD_S_INCS} \
+ ${TOOL_M4} -DCONFIG_TOP_SRCDIR=\`${DIST}\' ${BUILD_S_INCS} \
${M4FLAGS} ${M4FLAGS.${.TARGET:R}} \
-DOPERATION_${.TARGET:R} ${DIST}/${_src} > ${.TARGET}
---END patch -HEAD---
Patch for 11.x:
---START patch 11.1---
diff -urN a/src/external/bsd/elftoolchain/common/sys/Makefile b/src/external/bsd/elftoolchain/common/sys/Makefile
--- a/src/external/bsd/elftoolchain/common/sys/Makefile 2024-03-27 21:55:35.000000000 +0000
+++ b/src/external/bsd/elftoolchain/common/sys/Makefile 2026-11-14 18:54:08.525877430 +0000
@@ -12,7 +12,7 @@
elfdefinitions.h: elfdefinitions.m4 elfconstants.m4
${_MKTARGET_CREATE}
- ${TOOL_M4} -I${SRCDIR} -D SRCDIR=${SRCDIR} ${M4FLAGS} \
+ ${TOOL_M4} -I${SRCDIR} -D SRCDIR=\`${SRCDIR}\' ${M4FLAGS} \
elfdefinitions.m4 > ${.TARGET}
.PHONY: all clean clobber depend
diff -urN a/src/external/bsd/elftoolchain/dist/common/sys/Makefile b/src/external/bsd/elftoolchain/dist/common/sys/Makefile
--- a/src/external/bsd/elftoolchain/dist/common/sys/Makefile 2021-04-29 17:40:42.000000000 +0000
+++ b/src/external/bsd/elftoolchain/dist/common/sys/Makefile 2026-11-14 18:52:55.941156965 +0000
@@ -13,7 +13,7 @@
all: ${INCS}
elfdefinitions.h: elfdefinitions.m4 elfconstants.m4
- m4 -I${.CURDIR} -D SRCDIR=${.CURDIR} ${M4FLAGS} \
+ m4 -I${.CURDIR} -D SRCDIR=\`${.CURDIR}\' ${M4FLAGS} \
elfdefinitions.m4 > ${.TARGET}
depend cleandepend:
diff -urN a/src/external/bsd/elftoolchain/lib/libdwarf/Makefile b/src/external/bsd/elftoolchain/lib/libdwarf/Makefile
--- a/src/external/bsd/elftoolchain/lib/libdwarf/Makefile 2024-04-01 18:33:23.000000000 +0000
+++ b/src/external/bsd/elftoolchain/lib/libdwarf/Makefile 2026-11-14 18:53:50.999963223 +0000
@@ -330,5 +330,5 @@
# Keep the .SUFFIXES line after the include of bsd.lib.mk
.SUFFIXES: .m4 .c
.m4.c:
- ${TOOL_M4} -D SRCDIR=${SRCDIR} ${M4FLAGS} ${.IMPSRC} > ${.TARGET}
+ ${TOOL_M4} -D SRCDIR=\`${SRCDIR}\' ${M4FLAGS} ${.IMPSRC} > ${.TARGET}
diff -urN a/src/external/bsd/elftoolchain/lib/libelf/Makefile b/src/external/bsd/elftoolchain/lib/libelf/Makefile
--- a/src/external/bsd/elftoolchain/lib/libelf/Makefile 2024-03-03 19:13:59.000000000 +0000
+++ b/src/external/bsd/elftoolchain/lib/libelf/Makefile 2026-11-14 18:53:25.131118340 +0000
@@ -172,5 +172,5 @@
# Keep the .SUFFIXES line after the include of bsd.lib.mk
.SUFFIXES: .m4 .c
.m4.c:
- ${TOOL_M4} -D SRCDIR=${SRCDIR} ${M4FLAGS} ${.IMPSRC} > ${.TARGET}
+ ${TOOL_M4} -D SRCDIR=\`${SRCDIR}\' ${M4FLAGS} ${.IMPSRC} > ${.TARGET}
diff -urN a/src/external/lgpl3/gmp/lib/libgmp/Makefile b/src/external/lgpl3/gmp/lib/libgmp/Makefile
--- a/src/external/lgpl3/gmp/lib/libgmp/Makefile 2025-04-06 23:03:05.000000000 +0000
+++ b/src/external/lgpl3/gmp/lib/libgmp/Makefile 2026-11-14 19:16:08.021283763 +0000
@@ -226,7 +226,7 @@
.for _build _src in ${ASM_SRCS_LIST}
${_build:R}.s: Makefile dummy ${.OBJDIR}/config.m4 ${DIST}/${_src}
- ${TOOL_M4} -DCONFIG_TOP_SRCDIR=${DIST} ${BUILD_S_INCS} \
+ ${TOOL_M4} -DCONFIG_TOP_SRCDIR=\`${DIST}\' ${BUILD_S_INCS} \
${M4FLAGS} ${M4FLAGS.${.TARGET:R}} \
-DOPERATION_${.TARGET:R} ${DIST}/${_src} > ${.TARGET}
diff -urN a/src/tools/elftoolchain/libelf/Makefile b/src/tools/elftoolchain/libelf/Makefile
--- a/src/tools/elftoolchain/libelf/Makefile 2024-04-01 18:33:24.000000000 +0000
+++ b/src/tools/elftoolchain/libelf/Makefile 2026-11-14 18:39:48.610043879 +0000
@@ -89,4 +89,4 @@
M4OBJDIR!= cd ${.CURDIR}/../../m4 && ${PRINTOBJDIR}
.SUFFIXES: .m4 .c
.m4.c:
- ${M4OBJDIR}/m4 -D SRCDIR=${LIBELF_DIR} ${.IMPSRC} > ${.TARGET}
+ ${M4OBJDIR}/m4 -D SRCDIR=\`${LIBELF_DIR}\' ${.IMPSRC} > ${.TARGET}
---END patch 11.1---
Home |
Main Index |
Thread Index |
Old Index