kcl-lang / kcl

KCL Programming Language (CNCF Sandbox Project). https://kcl-lang.io
https://kcl-lang.io
Apache License 2.0
1.7k stars 119 forks source link

[Enhancement] KCL release and artifacts for FreeBSD #1029

Open yonas opened 9 months ago

yonas commented 9 months ago

Bug Report

1. Minimal reproduce step (Required)

Run $ go install kcl-lang.io/cli/cmd/kcl@latest on FreeBSD. Works for me in Ubuntu 23.

2. What did you expect to see? (Required)

3. What did you see instead (Required)

$ go install kcl-lang.io/cli/cmd/kcl@latest
...
# kcl-lang.io/lib
go/pkg/mod/kcl-lang.io/lib@v0.7.8/install.go:63:41: undefined: kclvmCliBin
go/pkg/mod/kcl-lang.io/lib@v0.7.8/install.go:68:8: undefined: installLib

4. What is your KCL components version? (Required)

Using '@latest' as of Feb 4, 2024.

OS: FreeBSD 14

Peefy commented 9 months ago

Hello @yonas. KCL currently does not have a FreeBSD distribution package? Are you willing to contribute it?

yonas commented 9 months ago

Hello @yonas. KCL currently does not have a FreeBSD distribution package? Are you willing to contribute it?

@Peefy Yes, if we can get it to compile. Any idea what might be causing this?

Peefy commented 9 months ago

@yonas This is because KCL lacks dynamic library files for FreeBSD, so there is no conditional compilation for configuring the kcl-lang/lib library. Currently, only Windows, Linux, and macos are available. See here: https://github.com/kcl-lang/lib

yonas commented 2 months ago

I see KCL has been completely rewritten in Rust! :+1: I'm getting this error now:

   Compiling prost-wkt v0.4.1 (/git/kcl/kclvm/third-party/prost-wkt)
error: failed to run custom build command for `prost-wkt-types v0.4.1 (/git/kcl/kclvm/third-party/prost-wkt/wkt-types)`

Caused by:
  process didn't exit successfully: `/git/kcl/kclvm/target/release/build/prost-wkt-types-4463054462d69585/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at third-party/prost-wkt/wkt-types/build.rs:19:52:
  called `Result::unwrap()` on an `Err` value: Error { os: "freebsd", arch: "x86_64" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
gmake: *** [Makefile:26: build] Error 101
yonas commented 2 months ago

We need a way to detect the location of protoc on FreeBSD. Changing these lines resolved the issue:

--- a/kclvm/api/build.rs
+++ b/kclvm/api/build.rs
@@ -8,7 +8,7 @@ fn main() {
     if env::var("PROTOC").is_err() {
         env::set_var(
             "PROTOC",
-            protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
+            "/usr/local/bin/protoc"
         );
     }

diff --git a/kclvm/third-party/prost-wkt/wkt-types/build.rs b/kclvm/third-party/prost-wkt/wkt-types/build.rs
index 620c759..f7850d8 100644
--- a/kclvm/third-party/prost-wkt/wkt-types/build.rs
+++ b/kclvm/third-party/prost-wkt/wkt-types/build.rs
@@ -16,7 +16,7 @@ fn main() {
     if env::var("PROTOC").is_err() {
         env::set_var(
             "PROTOC",
-            protoc_bin_vendored::protoc_bin_path().unwrap().as_os_str(),
+            "/usr/local/bin/protoc"
         );
     }
     let dir = PathBuf::from(env::var("OUT_DIR").unwrap());
Peefy commented 2 months ago

@yonas I see. You can push the vendored protoc binary here https://github.com/kcl-lang/rust-protoc-bin-vendored or set the PROTOC env