nodejs/node · error
Unable to create map file: %s.\n
Error message
Unable to create map file: %s.\n
What it means
pkgdata cannot open the generated .map (linker map) file for writing. The filename is built from o->shortName + MAP_FILE_EXT and opened with T_FileStream_open(...,"w"). A nullptr return means the filesystem refused the create — typically a permission denial, a read-only build directory, a full disk, or an invalid shortName producing an illegal filename. The tool returns nullptr from the calling function, aborting map-file generation for that library mode.
Source
Thrown at deps/icu-small/source/tools/pkgdata/pkgdata.cpp:1988
}
}
tmpbuffer[index++] = flag[i];
if (flag[i] == 0) {
break;
}
}
uprv_memset(flag, 0, length);
uprv_strcpy(flag, tmpbuffer);
uprv_strcpy(mapFile, o->shortName);
uprv_strcat(mapFile, MAP_FILE_EXT);
f = T_FileStream_open(mapFile, "w");
if (f == nullptr) {
fprintf(stderr,"Unable to create map file: %s.\n", mapFile);
return nullptr;
} else {
snprintf(tmpbuffer, sizeof(tmpbuffer), "%s%s ", o->entryName, UDATA_CMN_INTERMEDIATE_SUFFIX);
T_FileStream_writeLine(f, tmpbuffer);
T_FileStream_close(f);
}
}
#elif U_PLATFORM == U_PF_CYGWIN || U_PLATFORM == U_PF_MINGW
/* Cygwin needs to change flag options. */
char *flag = nullptr;
int32_t length = 0;
flag = pkgDataFlags[GENLIB];
length = static_cast<int32_t>(uprv_strlen(pkgDataFlags[GENLIB]));
int32_t position = length - 1;View on GitHub (pinned to 1b2de5e052)
Solutions
- Verify the working directory is writable: touch the build dir as the build user.
- Run the build with adequate disk space (df -h .).
- Check that -O/--shortName (or the ICU_DATA short name) contains no path separators or illegal filename characters.
- Ensure no directory named <shortName>.map already exists in the output location.
Example fix
// before: build into read-only tree make install # runs as user without write perms // after: write into a user-writable staging dir mkdir -p /tmp/icu-stage && make DESTDIR=/tmp/icu-stage install
Defensive patterns
Strategy: validation
Validate before calling
// Validate the output directory is writable and the map filename is legal before invoking pkgdata.
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
bool canWriteMapFile(const char *outdir, const char *shortName) {
if (access(outdir, W_OK | X_OK) != 0) return false; // need write+search on dir
struct stat st;
char path[PATH_MAX];
snprintf(path, sizeof(path), "%s/%s.map", outdir, shortName);
if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) return false; // name collides with a dir
for (const char *p = shortName; *p; ++p)
if (*p == '/' || *p == '\\') return false; // shortName must be a bare name
return true;
} Prevention
- Run pkgdata from a user-writable directory.
- Never embed path separators in the package short name.
- Confirm disk space before large data builds.
- Ensure no directory shares the <shortName>.map filename.
When it happens
Trigger: Reached only in the branch that writes a map file (the non-Cygwin/Mingw path guarded by the #elif above). T_FileStream_open(mapFile,"w") returns nullptr. Triggers when the CWD or output dir is not writable, when o->shortName contains path separators/illegal chars, or when MAP_FILE_EXT resolves to a name that already exists as a directory.
Common situations: Building ICU data into a directory the build user cannot write (e.g. make install running as non-root into /usr), NFS-mounted read-only source trees, out-of-disk conditions during a parallel build, or a shortName set from a package name containing a slash.
Related errors
- T_FileStream_open failed to open %s for writing\n
- Error creating symbolic links of the data library file.
- Error creating installation directory: %s\n
- U_FILE_ACCESS_ERROR
- T_FileStream_remove failed to delete %s\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/572b5c06bca79ee9.
Report an issue: GitHub.