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

CROSS COMPILING ERROR IN ARM64 #20

Open
Moxoo opened this issue May 10, 2024 · 3 comments
Open

CROSS COMPILING ERROR IN ARM64 #20

Moxoo opened this issue May 10, 2024 · 3 comments

Comments

@Moxoo
Copy link

Moxoo commented May 10, 2024

@lassilaiho help!
I try to cross compling rclgo in docker container use image osrf/ros:humble-desktop (on my x86 linux) , but got this:

GOOS=linux GOARCH=arm64 go build -o bin/test_cross main.go
# github.com/tiiuae/rclgo/pkg/rclgo
/root/go/pkg/mod/github.com/tiiuae/[email protected]/pkg/rclgo/goalstatus_string.go:11:8: undefined: GoalUnknown
/root/go/pkg/mod/github.com/tiiuae/[email protected]/pkg/rclgo/goalstatus_string.go:12:8: undefined: GoalAccepted
/root/go/pkg/mod/github.com/tiiuae/[email protected]/pkg/rclgo/goalstatus_string.go:13:8: undefined: GoalExecuting
/root/go/pkg/mod/github.com/tiiuae/[email protected]/pkg/rclgo/goalstatus_string.go:14:8: undefined: GoalCanceling
/root/go/pkg/mod/github.com/tiiuae/[email protected]/pkg/rclgo/goalstatus_string.go:15:8: undefined: GoalSucceeded
/root/go/pkg/mod/github.com/tiiuae/[email protected]/pkg/rclgo/goalstatus_string.go:16:8: undefined: GoalCanceled
/root/go/pkg/mod/github.com/tiiuae/[email protected]/pkg/rclgo/goalstatus_string.go:17:8: undefined: GoalAborted
/root/go/pkg/mod/github.com/tiiuae/[email protected]/pkg/rclgo/goalstatus_string.go:24:9: undefined: GoalStatus
/root/go/pkg/mod/github.com/tiiuae/[email protected]/pkg/rclgo/goalstatus_string.go:25:19: undefined: GoalStatus
make: *** [Makefile:16: arm64] Error 1
@Moxoo
Copy link
Author

Moxoo commented May 10, 2024

The test code is this:

package main

import (
	"fmt"
	"os"

	"github.com/tiiuae/rclgo/pkg/rclgo"
)

func main() {
	Run()
}

func Run() {
	rclArgs, _, err := rclgo.ParseArgs(os.Args[1:])
	if err != nil {
		fmt.Printf("failed to parse ROS args: %v", err)
	}
	if err := rclgo.Init(rclArgs); err != nil {
		fmt.Printf("failed to initialize rclgo: %v", err)
	} else {
		fmt.Println("success ros")
	}
	defer rclgo.Uninit()
	_, err = rclgo.NewNode("greeter", "")
	if err != nil {
		fmt.Printf("failed to create node: %v", err)
	}
	for {
		select {}
	}
}

**build this main in x86, it works

@Moxoo
Copy link
Author

Moxoo commented May 11, 2024

I tried adding "CGO_ENABLED=1" when cross-compiling, but it still didn't work because ros2 arm-version library is also needed.

Finally, I successfully compiled rclgo in the Arm64 container containing the ROS2 environment, although running the arm container on the x86 host requires qemu support.

Ugly but works, so I still hope you can provide an elegant solution later.

@dp1140a
Copy link

dp1140a commented Jun 2, 2024

Can you post an example of your command line to build and run? I would love to be able to write and run on a rasperryPi

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

2 participants