// Native library detection - simple version that works without build tags package main import ( "fmt" "os" "os/exec" "runtime" "strings" ) func main() { fmt.Println("=== Native Library Detection ===") fmt.Printf("Go Version: %s\n", runtime.Version()) fmt.Printf("Architecture: %s/%s\n", runtime.GOOS, runtime.GOARCH) fmt.Printf("CGO Enabled: %v\n", cgoEnabled()) fmt.Println() // Check for native libraries checkNativeLibs() // Show native comparison if available _, cppErr := os.Stat("native_cpp_benchmark_results.txt") _, rustErr := os.Stat("native_rust_benchmark_results.txt") if cppErr == nil { fmt.Println() fmt.Println("C++ native library benchmarks available at: native_cpp_benchmark_results.txt") } if rustErr == nil { fmt.Println("Rust native library benchmarks available at: native_rust_benchmark_results.txt") } if cppErr == nil || rustErr == nil { fmt.Println("To compare Go vs Native:") fmt.Println(" make benchmark-compare") } } func cgoEnabled() bool { // Try to detect CGO by checking if we can import runtime/cgo cmd := exec.Command("go", "env", "CGO_ENABLED") out, err := cmd.Output() if err != nil { return false } return strings.TrimSpace(string(out)) == "1" } func checkNativeLibs() { // Check for C++ native library files cppLibPaths := []string{ "native/build/libdataset_hash.so", "native/build/libdataset_hash.dylib", "native/build/libdataset_hash.dll", "native/build/libqueue_index.so", "native/build/libartifact_scanner.so", "native/build/libstreaming_io.so", } // Check for Rust native library files rustLibPaths := []string{ "native_rust/target/release/libdataset_hash.so", "native_rust/target/release/libdataset_hash.dylib", "native_rust/target/release/libdataset_hash.dll", "native_rust/target/release/libqueue_index.so", "native_rust/target/release/libqueue_index.dylib", "native_rust/target/release/libqueue_index.dll", } foundCpp := false foundRust := false fmt.Println("=== C++ Native Libraries ===") for _, path := range cppLibPaths { if _, err := os.Stat(path); err == nil { fmt.Printf("Found: %s\n", path) foundCpp = true } } if !foundCpp { fmt.Println("✗ No C++ native libraries found") } fmt.Println() fmt.Println("=== Rust Native Libraries ===") for _, path := range rustLibPaths { if _, err := os.Stat(path); err == nil { fmt.Printf("Found: %s\n", path) foundRust = true } } if !foundRust { fmt.Println("✗ No Rust native libraries found") } if !foundCpp && !foundRust { fmt.Println() fmt.Println("To use native libraries:") fmt.Println(" C++: make native-build") fmt.Println(" Rust: make rust-build") fmt.Println() fmt.Println("Current implementation: Go standard library") } }