Skip to content

libnest build causes segmentation fault exclusively on GNU/Linux systems (Alpine Linux is not affected) #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
joshunrau opened this issue Mar 31, 2025 · 1 comment

Comments

@joshunrau
Copy link
Collaborator

When attempting to build even the simplest app (see below), running libnest build segfaults, exclusively on GNU systems. Despite this, verything in the build script runs successfully, and the generated code runs with (seemingly) no issues.

This occurs on both amd64 and aarch64, with Node 22.11, 22.14, and 23.10. There is no issue on Alpine Linux or MacOS.

app.ts

import { $BaseEnv, AppFactory } from '@douglasneuroinformatics/libnest';
import { Module } from '@nestjs/common';

@Module({})
class AppModule {}

export default AppFactory.create({
  envSchema: $BaseEnv,
  imports: [AppModule],
  prisma: {
    dbPrefix: 'data-bank'
  },
  version: '1'
});

libnest.config.ts

import * as path from 'node:path';

import { defineUserConfig } from '@douglasneuroinformatics/libnest/user-config';

export default defineUserConfig({
  build: {
    outfile: path.resolve(import.meta.dirname, './dist/app.js')
  },
  entry: () => import('./src/app.js')
});

Command

> rm -rf dist && libnest build -c libnest.config.ts --verbose

Successfully loaded user config
Attempting to parse entry function...
Parsed entry specifier './src/app.js' from user config
Attempting to bundle application...
Attempting to dynamically import esbuild...
Successfully imported esbuild
Defining global variables...
Set global variables: {"process.env.NODE_ENV":"'production'"}
Invoking esbuild to bundle application....
Bundling complete
Successfully built application
Done!
Segmentation fault
@joshunrau
Copy link
Collaborator Author

See swc-project/swc-node#920

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant