Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to cross compile #42

Open
g1i1U opened this issue Jun 12, 2024 · 3 comments
Open

failed to cross compile #42

g1i1U opened this issue Jun 12, 2024 · 3 comments

Comments

@g1i1U
Copy link

g1i1U commented Jun 12, 2024

first I salute you for this great work.
I tried to cross compile and it failed except for the linux/amd64 which is the host.

~ build_all.sh ~ the script used to cross compile~

#!/bin/bash

# List of OS/ARCH combinations to build
targets=(
    "linux/amd64"
    "linux/arm"
    "linux/arm64"
    "windows/amd64"
    "windows/386"
    "darwin/amd64"
    "darwin/arm64"
)

# Output directory
output_dir="build"

# Create output directory if it doesn't exist
mkdir -p $output_dir

# Loop over each target and build
for target in "${targets[@]}"; do
    os=$(echo $target | cut -d'/' -f1)
    arch=$(echo $target | cut -d'/' -f2)
    output_name="out-$os-$arch"
    
    if [ "$os" = "windows" ]; then
        output_name+=".exe"
    fi
    
    echo "Building for $os/$arch..."
    
    GOOS=$os GOARCH=$arch go build -o $output_dir/$output_name main.go
    
    if [ $? -ne 0 ]; then
        echo "An error occurred while building for $os/$arch."
    fi
done

echo "Builds completed and placed in the $output_dir directory."
```
# bash build_all.sh 
Building for linux/amd64...
Building for linux/arm...
package command-line-arguments
	imports github.com/ipsn/go-libtor
	imports github.com/ipsn/go-libtor/libtor: build constraints exclude all Go files in /root/go/pkg/mod/github.com/ipsn/[email protected]/libtor
An error occurred while building for linux/arm.
Building for linux/arm64...
package command-line-arguments
	imports github.com/ipsn/go-libtor
	imports github.com/ipsn/go-libtor/libtor: build constraints exclude all Go files in /root/go/pkg/mod/github.com/ipsn/[email protected]/libtor
An error occurred while building for linux/arm64.
Building for windows/amd64...
package command-line-arguments
	imports github.com/ipsn/go-libtor
	imports github.com/ipsn/go-libtor/libtor: build constraints exclude all Go files in /root/go/pkg/mod/github.com/ipsn/[email protected]/libtor
An error occurred while building for windows/amd64.
Building for windows/386...
package command-line-arguments
	imports github.com/ipsn/go-libtor
	imports github.com/ipsn/go-libtor/libtor: build constraints exclude all Go files in /root/go/pkg/mod/github.com/ipsn/[email protected]/libtor
An error occurred while building for windows/386.
Building for darwin/amd64...
package command-line-arguments
	imports github.com/ipsn/go-libtor
	imports github.com/ipsn/go-libtor/libtor: build constraints exclude all Go files in /root/go/pkg/mod/github.com/ipsn/[email protected]/libtor
An error occurred while building for darwin/amd64.
Building for darwin/arm64...
package command-line-arguments
	imports github.com/ipsn/go-libtor
	imports github.com/ipsn/go-libtor/libtor: build constraints exclude all Go files in /root/go/pkg/mod/github.com/ipsn/[email protected]/libtor
An error occurred while building for darwin/arm64.
Builds completed and placed in the build directory.
```
@0xffffa
Copy link

0xffffa commented Jun 16, 2024

I dont think the library is compatiable on these platforms

@g1i1U
Copy link
Author

g1i1U commented Jun 22, 2024

@karalabe @ww9 any hints?

@ww9
Copy link
Contributor

ww9 commented Jun 22, 2024

Sorry I'm not experienced in this lib. And looking at the message I can't think of a solution. Good luck friend! o/

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

No branches or pull requests

3 participants