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

Creating node in Android with gomobile & kubo is failing by saying GETENT is not found in path #10407

Closed
3 tasks done
athulantonynp opened this issue Apr 18, 2024 · 3 comments
Closed
3 tasks done
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization

Comments

@athulantonynp
Copy link

Checklist

Installation method

third-party binary

Version

No response

Config

No response

Description

Disclaimer: I am fairly new to Golang and IPFS world. I am trying to run kubo with the help of gomobile in an Android app. The process of creating a node is failing with long error saying

constructing the node: could not build arguments for function "github.com/ipfs/kubo/core/node".PeerWith.func1 (/Users/apple/go/pkg/mod/github.com/ipfs/kubo@v0.27.0/core/node/peering.go:30):
 failed to build *peering.PeeringService: could not build arguments for function "github.com/ipfs/kubo/core/node".Peering (/Users/apple/go/pkg/mod/github.com/ipfs/kubo@v0.27.0/core/node/peering.go:14):
 failed to build host.Host: could not build arguments for function "github.com/ipfs/kubo/core/node/libp2p".Host (/Users/apple/go/pkg/mod/github.com/ipfs/kubo@v0.27.0/core/node/libp2p/host.go:40):
 could not build value group []config.Option[group="libp2p"]: received non-nil error from function "github.com/ipfs/kubo/core/node".LibP2P.ResourceManager.func9 (/Users/apple/go/pkg/mod/github.com/ipfs/kubo@v0.27.0/core/node/libp2p/rcmgr.go:32)
: opening IPFS_PATH: exec: "getent": executable file not found in $PATH

What i understood from the error is that the ipfs core package is trying to access GETENT program from the underlying linux arch which is restricted on non-rooted devices. But i am struggling to solve this.

I have created a minimal reproducible example in this repo https://github.com/athulantonynp/ipfs-android-golang with the build instructions.

Also here is my go env output.

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/apple/Library/Caches/go-build'
GOENV='/Users/apple/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/apple/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/apple/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/_3/pglmczx934d_qc7zs9r0dz_w0000gn/T/go-build2297058153=/tmp/go-build -gno-record-gcc-switches -fno-common'

Any leads to solve this issue appreciated.

PS: I have seen some other repos like https://github.com/ipfs-shipyard/gomobile-ipfs and it is working fine even though their approach to create the nodes are similar except the Golang & Kubo versions are bit old compared to what i have used. I guess it shouldn't be a problem.

@athulantonynp athulantonynp added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Apr 18, 2024
@aschmahmann
Copy link
Contributor

Android builds aren't officially supported, although if there any fixes / changes to support that are simple enough we're happy to take them (this particular issue doesn't seem particularly actionable). Looking at what gomobile-ipfs is doing or leveraging the underlying libraries from boxo seems like the best bet.

You may have better luck asking on the forums http://discuss.ipfs.tech/ or chat channels https://docs.ipfs.tech/community/#chat.

@openpokergame
Copy link

I've encountered this as well, how do I solve this problem?

@fengzie
Copy link
Contributor

fengzie commented Aug 23, 2024

The same issue happened here on Android.

core/builder.go:158 constructing the node: could not build arguments for function "reflect".makeFuncStub (/Users/mingfeng/sdk/go1.23.0/src/reflect/asm_arm64.s:29): failed to build pin.Pinner: could not build arguments for function "github.com/ipfs/kubo/core/node".Pinning (/Users/mingfeng/go/pkg/mod/github.com/ipfs/kubo@v0.29.0/core/node/core.go:45): failed to build format.DAGService: could not build arguments for function "github.com/ipfs/kubo/core/node".Dag (/Users/mingfeng/go/pkg/mod/github.com/ipfs/kubo@v0.29.0/core/node/core.go:144): failed to build blockservice.BlockService: could not build arguments for function "github.com/ipfs-shipyard/nopfs/ipfs".WrapBlockService (/Users/mingfeng/go/pkg/mod/github.com/ipfs-shipyard/nopfs/ipfs@v0.13.2-0.20231027223058-cde3b5ba964c/blockservice.go:24): failed to build nopfs.Blocker: received non-nil error from function "github.com/ipfs/kubo/plugin/plugins/nopfs".MakeBlocker (/Users/mingfeng/go/pkg/mod/github.com/ipfs/kubo@v0.29.0*/plugin/plugins/nopfs/nopfs.go:40): exec: "getent": executable file not found in $PATH**

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization
Projects
No open projects
Status: No status
Development

No branches or pull requests

4 participants