FreeBSD and the new code-server for running VScode remotely -> /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found

Fawst

Member

Reaction score: 1
Messages: 24

Hello,

There is a new open-source project release by coder , this project allows you to run VScode on a server and use it on your brother. I'm really excited about this, but I can figure out to install it.

Coder offer to use their tools as a binary, but for linux.

So I installed emulators/linux_base-c7/ using pkg. When it's done, I run the binary but I get this error :

Code:
./code-server: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./code-server)
./code-server: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./code-server)
And when I run

strings /compat/linux/lib64/libstdc++.so.6 | grep GLIBCXX

no surprise :

Code:
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_DEBUG_MESSAGE_LENGTH
How can I do to update libstdc++.so.6 with the last version of GLIBCXX? Can I do something to emulators/linux_base-c7/ and build it from the port ?

Thank you in advance for your precious help.
 

T-Daemon

Daemon

Reaction score: 511
Messages: 1,089

I'm not sure if it's a viable solution. There is a method described in the handbook: Chapter 10.2.1. Installing Additional Libraries Manually (for Linux binaries).

Port/package lang/gcc8 (gcc-8.3.0) installs /usr/local/lib/lang/gcc8/libstdc++.so.6, containing GLIBCXX_3.4.20 and 3.4.21. Renaming /compat/linux/lib64/libstdc++.so.6 and copying the gcc8/libstdc++.so.6 in place might resolve the error.
 

shkhln

Daemon

Reaction score: 678
Messages: 1,670

Port/package lang/gcc8 (gcc-8.3.0) installs /usr/local/lib/lang/gcc8/libstdc++.so.6, containing GLIBCXX_3.4.20 and 3.4.21. Renaming /compat/linux/lib64/libstdc++.so.6 and copying the gcc8/libstdc++.so.6 in place might resolve the error.

That will not work. The native libstdc++.so.6 depends on the FreeBSD libc:
Code:
% ldd /usr/local/lib/gcc8/libstdc++.so.6
/usr/local/lib/gcc8/libstdc++.so.6:
    libm.so.5 => /lib/libm.so.5 (0x80066d000)
    libc.so.7 => /lib/libc.so.7 (0x800248000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x80069f000
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 9,332
Messages: 33,894

RedHat (and by extension CentOS), always has a slightly older glibc compared to Debian/Ubuntu. This is not a library that's easily replaced with something newer, pretty much everything else of the Linux OS (if there is such a thing) depends on it. It's an undertaking I would never, ever, try on a real Linux machine, it can and will break everything.

Coder offer to use their tools as a binary, but for linux.
Don't they have RedHat/CentOS RPMs? I'm betting they only supply Debian DEBs.
 
OP
F

Fawst

Member

Reaction score: 1
Messages: 24

As shkIn and SirDice mentioned it, that do not work I get this :


/code-server: error while loading shared libraries: /lib64/libstdc++.so.6: ELF file OS ABI invalid


They only offer RPMs for Linux and Darwin.
 

wolfspider

New Member

Reaction score: 3
Messages: 8

As shkIn and SirDice mentioned it, that do not work I get this :


/code-server: error while loading shared libraries: /lib64/libstdc++.so.6: ELF file OS ABI invalid


They only offer RPMs for Linux and Darwin.
I came across this and tried to just build it natively on a whim and got as far as it starting up, launching the web server, and trying to access the VSCode internals. I just had to change the Node version of "netstat" from detecting "Darwin" to "FreeBSD". Seems like it is possible but would take a bit of time and focus to pull it off. NPM attempts to build VSCode from source and a number of other things which would have to be altered somewhat. Have you tried just running VSCode by itself on FreeBSD yet? Some things work pretty alright like TypeScript and Rust but there are still other extensions which need to have FreeBSD as a platform added to the runtime detection. To me it looks like code-server runs VSCode in the background and what would be required there is to move some of the bins generated from the NPM build system over from the FreeBSD VSCode- the best way to get that is just download a release from here: https://github.com/prash-wghats/Electron-VSCode-Atom-For-FreeBSD/releases

It was built on 11.x so make sure your running that or you will have to build it for 12 if you are interested at all- would make a pretty cool project for someone for sure! Yeah, just take a look at the files in those releases there are also some Linux libs in the 1.10 release for the extensions too.
 
OP
F

Fawst

Member

Reaction score: 1
Messages: 24

Sorry for the delay, and thank you for you awnser.

If I follow you, I should run VScode on my jail and then run code-server by switching netsat value from Darwin to Freebsd?
 

wolfspider

New Member

Reaction score: 3
Messages: 8

Well, what I was trying to explain is that with a whole lot of tweaking you could potentially build this and develop FreeBSD support into code-server. Keeping up with VSCode is a tall order however for a one off build it could potentially work. Node.js has an implementation of netstat which is used in code-server to determine what platform it's running on. The first step would just be disabling that check by changing where it says "Darwin" to "FreeBSD" in the actual javascript files it runs on. There is no jail necessary to start this server up it's mostly just Node.js intertwined with the VSCode application which has already been ported to FreeBSD. In theory it should work- but just to be clear this would turn into a development project potentially and not just be about making configuration changes.

So, this caught me at a weird time actually today because I was just poking around with the new "VSCode Remote SSH" today and they have gone ahead and written a remote version for themselves (The VSCode team that is). Sadly, the very first thing this feature does is a "uname" command on connect and look for the string "Linux" and then "X86_64". So I faked all of that and set my default terminal to "bash" and then it began to try to download what I assume is the new remote server over SSH. That implementation is 100% NodeJS and it got me thinking...what's needed are BSD tools for VSCode. This way nobody would be complaining they have to support BSD and it could be done differently. FreeBSD is an OS and needs to be treated as such not so much like a runtime environment which Linux has become more recently. Instead of having to lock down a web server it works all through SSH- even better. Before putting all those chips down on code-server take a look for yourself at how this concept has evolved: https://code.visualstudio.com/docs/remote/remote-overview

This means VSCode is baking in the extensions to work with it remotely without needing to host a web server- it may actually be better to wait and see how this plays out IMO.
 

zatarain

New Member


Messages: 1

Hi everyone

I landed here because I was actually looking how use VS Code Remote with FreeBSD (the last option wolfspider said) and then I realized there is the coder solution which is not so bad, actually the idea it's really nice, but since I found first the VS Code Remote now it looks like a workaround for me, please don't get me wrong, I mean I agree with wolfspider, something SSH-based it should be more consistent in my opinion.

So, does someone know if there is a progress on this? I know there is a feature request on the repository, but I was looking for the actual code of the extension in the repository and I didn't find it. I thought an alternative is see how the extension is implemented for Linux and Darwin, so I can fork it and try to do it my self for FreeBSD or even more, contribute to the development if I can.
 
Top