What is the problem you are having with rclone?
I'm trying to build a library by using librclone
for iOS with gomobile
. For Android, it works perfectly. However, for iOS, the compilation will exit with some error.
The command I used is:
gomobile bind -v -target=iossimulator github.com/rclone/rclone/librclone/gomobile
However, the build cannot continue with such an error:
gomobile: iossimulator/arm64: go build -v -buildmode=c-archive -o /var/folders/cd/j79005393f7_zbyjw3zpkrlc0000gn/T/gomobile-work-1985761860/gomobile-iossimulator-arm64.a ./gobind failed: exit status 2
I started to debug gomobile
and found:
# github.com/shirou/gopsutil/v3/cpu
/Users/[username]/golang/pkg/mod/github.com/shirou/gopsutil/v3@v3.21.8/cpu/cpu_darwin_cgo.go:15:10: fatal error: 'libproc.h' file not found
#include <libproc.h>
^~~~~~~~~~~
1 error generated.
Looks like gopsutil is not compatible with iOS?
Run the command 'rclone version' and share the full output of the command.
N/A
Which cloud storage system are you using? (eg Google Drive)
N/A
The command you were trying to run (eg rclone copy /tmp remote:tmp
)
gomobile bind -v -target=iossimulator github.com/rclone/rclone/librclone/gomobile
The rclone config contents with secrets removed.
N/A
A log from the command with the -vv
flag
N/A
To have a quick fix, remove gopstil
would be a feasible solution for now.
// in osversion.go
func GetOSVersion() (osVersion, osKernel string) {
return "", ""
}
I believe we can write some platform specific code but this does not work:
// Created `osversion_ios.go`
//go:build ios
// +build ios
package buildinfo
// GetOSVersion returns OS version, kernel and bitness
func GetOSVersion() (osVersion, osKernel string) {
return "", ""
}
gomobile
may build all dependencies in go.mod
.
ncw
(Nick Craig-Wood)
January 14, 2022, 5:15pm
4
That looks like a good approach but you will need to add a build tag here
//go:build !windows
package buildinfo
import (
"strings"
"github.com/shirou/gopsutil/v3/host"
)
// GetOSVersion returns OS version, kernel and bitness
func GetOSVersion() (osVersion, osKernel string) {
if platform, _, version, err := host.PlatformInformation(); err == nil && platform != "" {
osVersion = platform
if version != "" {
osVersion += " " + version
}
}
if version, err := host.KernelVersion(); err == nil && version != "" {
This file has been truncated. show original
To stop it building on ios.
WildCat:
// GetOSVersion returns OS version, kernel and bitness
func GetOSVersion() (osVersion, osKernel string) {
return "", ""
}
I'd suggest you return "ios", "unknown" if you can't fill in the correct details easily.
1 Like
WildCat
January 15, 2022, 12:15am
5
1 Like
system
(system)
Closed
February 14, 2022, 12:16am
6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.