Skip to content
This repository was archived by the owner on May 23, 2021. It is now read-only.

nbin does not work with non-glibc systems (musl libc on alpine linux, for example) #3

Closed
lsmoura opened this issue Mar 30, 2019 · 5 comments

Comments

@lsmoura
Copy link

lsmoura commented Mar 30, 2019

I'm building code-server using alpine linux docker image, but when using nbin, it fetches the node version that is linked with glibc, thus giving me all these errors (after the code is compiled):

# ./cli-linux-x64 
sh: ./cli-linux-x64: not found
# ldd ./cli-linux-x64 
	/lib64/ld-linux-x86-64.so.2 (0x7fbe1f2f5000)
	libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7fbe1f2f5000)
	librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7fbe1f2f5000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7fbe1f1a0000)
	libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fbe1f2f5000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7fbe1f18c000)
	libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fbe1f2f5000)
	libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fbe1f2f5000)
Error relocating ./cli-linux-x64: __stpcpy_chk: symbol not found
Error relocating ./cli-linux-x64: __vsnprintf_chk: symbol not found
Error relocating ./cli-linux-x64: gnu_get_libc_version: symbol not found
Error relocating ./cli-linux-x64: __fprintf_chk: symbol not found
Error relocating ./cli-linux-x64: __strncpy_chk: symbol not found
Error relocating ./cli-linux-x64: __fdelt_chk: symbol not found
Error relocating ./cli-linux-x64: __memcpy_chk: symbol not found
Error relocating ./cli-linux-x64: __syslog_chk: symbol not found
Error relocating ./cli-linux-x64: __memmove_chk: symbol not found
Error relocating ./cli-linux-x64: __register_atfork: symbol not found
Error relocating ./cli-linux-x64: secure_getenv: symbol not found
Error relocating ./cli-linux-x64: __strcat_chk: symbol not found
Error relocating ./cli-linux-x64: __strcpy_chk: symbol not found
Error relocating ./cli-linux-x64: __open64_2: symbol not found
Error relocating ./cli-linux-x64: __vfprintf_chk: symbol not found
Error relocating ./cli-linux-x64: __memset_chk: symbol not found
Error relocating ./cli-linux-x64: __printf_chk: symbol not found
Error relocating ./cli-linux-x64: __fread_chk: symbol not found
Error relocating ./cli-linux-x64: backtrace: symbol not found
Error relocating ./cli-linux-x64: __pread64_chk: symbol not found
Error relocating ./cli-linux-x64: __read_chk: symbol not found
Error relocating ./cli-linux-x64: __sprintf_chk: symbol not found
Error relocating ./cli-linux-x64: __snprintf_chk: symbol not found

I'm trying to pinpoint and hijack a node version that would be usable on my environment. So far, I see that a node is downloaded on src/api/bundler.ts:151 but the version that's downloaded linked against glibc.

@lsmoura
Copy link
Author

lsmoura commented Mar 30, 2019

I'm making a nbin build specific for alpine-linux. I'll try to use that on the code-server build. I'll update on how that goes.

@Tarocch1
Copy link

Tarocch1 commented Apr 17, 2019

[email protected] support alpine, just add target option in packages/server/scripts/nbin.ts before building code-server.

const bin = new Binary({
  mainFile: path.join(rootDir, "out", "cli.js"),
  target: 'alpine',
});
~/code-server-master/packages/server # ./cli-linux-x64  --version
development
~/code-server-master/packages/server # ldd ./cli-linux-x64
        /lib/ld-musl-x86_64.so.1 (0x7fc33d92c000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7fc33b5eb000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7fc33b5d7000)
        libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7fc33d92c000)

@sdirkwinkel
Copy link

I've had a similar issue trying to build code-server for freebsd (coder/code-server#529)

I've seen that we can set a node binary in configuration but there is a comment noting that it needs to be a patched binary. How are these binaries build and patched?

@sdirkwinkel
Copy link

I guess i found the patch in the node.patch file

@kylecarbs
Copy link
Member

Fixed! There is now an alpine build in the CI :)

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

No branches or pull requests

4 participants