-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add FreeBSD Support #312
Comments
Have a look at // #cgo LDFLAGS: -Wl,-rpath,${SRCDIR} -L${SRCDIR} -lwasmvm
import "C" is missing. |
@webmaster128 And clue on how to resolve this? I should have mentioned that I'm not a developer/programmer and that I have no experience with go. |
@moonshine-cc if that is the case I see very little chance for FreeBSD support any time soon. We have to build the library for each target system individually which is quite hard for Linux/Mac/Windows on x86/ARM already and this is the first time I hear about the desire for building for FreeBSD. What's your motivation for targetting this system? |
@webmaster128 With FreeBSD it's possible to use Linux binaries and libraries natively thanks to its Linux Binary Compatibility Layer, which makes use of CentOS 7 (if interested in the details, see Chapter 10. Linux Binary Compatibility of the FreeBSD handbook. I'm running a set of validators on a server powered by FreeBSD, which is an extremely pleasant experience so far (way better then with the usual Linux distributions). Thanks to the Linux Binary Compatibilty Layer and all the needed components (like go and rust) available natively, I could make almost all validator projects that I have tried run without problems so far, except the latest one that made use of CosmWasm. |
Oh, that's interesting. Our .so is built on a CentOS 7 system. So it might just work with this diff: #313. Can you try that? |
@webmaster128 Seems to have worked:
No errors, but now I'm puzzled, what's the result? |
@webmaster128 Wow, it really works! 😃 So I have just rebuilt said project with the necessary changes applied and everything indeed turned out fine (though there was some trickery involved, but that's that project's fault). This doesn't even require the FreeBSD Linux Compatibilty Layer, because with go and rust being available natively, So all that needs to be done to make wasmvm compatible with FreeBSD is as follows:
You than can add FreeBSD to the supported builds in the This is just awesome, because I have been fiddling around with this several times including giving up in the meantime, only to come back and try again. The major catch with said project was, that it doesn't build the |
Glad to hear that. Now the question is how you want this deployed. The Linux .so is built by the CI and checked into git for every change. See https://github.com/CosmWasm/wasmvm/tree/main/api for the .so and .dylib. I would like to do that for FreeBSD too because it comsumes a lot of space in git and I don't know if I found a FreeBSD CI system. If you don't want to build everything manually and patch the chain for every upgrade using a local version of wasmvm, it's probably better to use the Linux build. |
@webmaster128 Sorry, not really sure what you mean. The already present Linux |
But didn't you say it can be used via CentOS 7 compatibility mode on FreeBSD? |
That's what I thought as well, but it didn't work. This is what it looks like with the Linux
I'm not able to explain what the problem is with this (looks like the Linux binary can't find the needed libraries in the right place, and even with some manual symlinking, it then said something about a wrong glibc version). This is what it looks like with the FreeBSD
So the only way to go is to build |
@webmaster128 So it's working, but I'm not sure how you could implement the required patches to make it universally usable. The diff for the two I have GNU Make installed on FreeBSD, so I'm compiling the project with
Any ideas? |
I think it should not be too hard to convert the main Makefile into a set of shell scripts. We hardly use any make feature there anyways. If you want to roll out
|
Manual build seems the way to go. you could also do a modification to the existing makefile with a BSD branch SHARED_LIB_EXT = "" # File extension of the shared library
ifeq ($(OS),Windows_NT)
SHARED_LIB_EXT = dll
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
SHARED_LIB_EXT = so
endif
ifeq ($(UNAME_S), FreeBSD) # since the library works for both OS
SHARED_LIB_EXT = so
endif
ifeq ($(UNAME_S),Darwin)
SHARED_LIB_EXT = dylib
endif
endif @moonshine-cc This might lead to underlying issues so thread carefully e.g: |
Running FreeBSD 13.0-RELEASE with current versions of go, rust and gmake installed:
build-rust-release
works and finishes without errors (only requires a modification of SHARED_LIB_EXT = "so" for FreeBSD OS detection in the Makefile).build-go
doesn't work. Here is the output:The text was updated successfully, but these errors were encountered: