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

Android bind is not working #12

Closed
lu4p opened this issue Aug 25, 2019 · 4 comments
Closed

Android bind is not working #12

lu4p opened this issue Aug 25, 2019 · 4 comments

Comments

@lu4p
Copy link

lu4p commented Aug 25, 2019

I used the provided example for android but got this error while building. Any suggestions on how to mitigate this issue?

Command used to build: gomobile bind -v -x .

Error Log

# github.com/ipsn/go-libtor/libtor
../github.com/ipsn/go-libtor/libtor/../openssl/include/../crypto/rand/rand_unix.c:392: error: undefined reference to 'shmget'
../github.com/ipsn/go-libtor/libtor/../openssl/include/../crypto/rand/rand_unix.c:437: error: undefined reference to 'shmat'
../github.com/ipsn/go-libtor/libtor/../openssl/include/../crypto/rand/rand_unix.c:426: error: undefined reference to 'shmget'
../github.com/ipsn/go-libtor/libtor/../openssl/include/../crypto/rand/rand_unix.c:370: error: undefined reference to 'shmdt'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
# github.com/ipsn/go-libtor/libtor
In file included from ../github.com/ipsn/go-libtor/libtor/openssl_crypto_rand_rand_unix.go:11:
../github.com/ipsn/go-libtor/libtor/../openssl/include/../crypto/rand/rand_unix.c:370:5: warning: implicit declaration of function 'shmdt' is invalid in C99 [-Wimplicit-function-declaration]
../github.com/ipsn/go-libtor/libtor/../openssl/include/../crypto/rand/rand_unix.c:392:23: warning: implicit declaration of function 'shmget' is invalid in C99 [-Wimplicit-function-declaration]
../github.com/ipsn/go-libtor/libtor/../openssl/include/../crypto/rand/rand_unix.c:437:24: warning: implicit declaration of function 'shmat' is invalid in C99 [-Wimplicit-function-declaration]
../github.com/ipsn/go-libtor/libtor/../openssl/include/../crypto/rand/rand_unix.c:437:22: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
# github.com/ipsn/go-libtor/libtor
In file included from ../github.com/ipsn/go-libtor/libtor/zlib_gzlib.go:7:
../github.com/ipsn/go-libtor/libtor/../zlib/gzlib.c:252:9: warning: implicit declaration of function 'lseek' is invalid in C99 [-Wimplicit-function-declaration]
../github.com/ipsn/go-libtor/libtor/../zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
../github.com/ipsn/go-libtor/libtor/../zlib/gzlib.c:258:24: warning: implicit declaration of function 'lseek' is invalid in C99 [-Wimplicit-function-declaration]
../github.com/ipsn/go-libtor/libtor/../zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
../github.com/ipsn/go-libtor/libtor/../zlib/gzlib.c:359:9: warning: implicit declaration of function 'lseek' is invalid in C99 [-Wimplicit-function-declaration]
../github.com/ipsn/go-libtor/libtor/../zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
../github.com/ipsn/go-libtor/libtor/../zlib/gzlib.c:400:15: warning: implicit declaration of function 'lseek' is invalid in C99 [-Wimplicit-function-declaration]
../github.com/ipsn/go-libtor/libtor/../zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
../github.com/ipsn/go-libtor/libtor/../zlib/gzlib.c:496:14: warning: implicit declaration of function 'lseek' is invalid in C99 [-Wimplicit-function-declaration]
../github.com/ipsn/go-libtor/libtor/../zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
# github.com/ipsn/go-libtor/libtor
In file included from ../github.com/ipsn/go-libtor/libtor/zlib_gzread.go:7:
../github.com/ipsn/go-libtor/libtor/../zlib/gzread.c:35:15: warning: implicit declaration of function 'read' is invalid in C99 [-Wimplicit-function-declaration]
../github.com/ipsn/go-libtor/libtor/../zlib/gzread.c:651:11: warning: implicit declaration of function 'close' is invalid in C99 [-Wimplicit-function-declaration]
# github.com/ipsn/go-libtor/libtor
In file included from ../github.com/ipsn/go-libtor/libtor/zlib_gzwrite.go:7:
../github.com/ipsn/go-libtor/libtor/../zlib/gzwrite.c:89:20: warning: implicit declaration of function 'write' is invalid in C99 [-Wimplicit-function-declaration]
../github.com/ipsn/go-libtor/libtor/../zlib/gzwrite.c:110:24: warning: implicit declaration of function 'write' is invalid in C99 [-Wimplicit-function-declaration]
../github.com/ipsn/go-libtor/libtor/../zlib/gzwrite.c:661:9: warning: implicit declaration of function 'close' is invalid in C99 [-Wimplicit-function-declaration]
rm -r -f "$WORK"
gomobile: go build -v -x -buildmode=c-shared -o=/tmp/gomobile-work-178710928/android/src/main/jniLibs/armeabi-v7a/libgojni.so gobind failed: exit status 2

@karalabe
Copy link
Member

The zlib warnings have been fixes a while back. Does this issue still happen to you? I didn't try building from macos(clang) so not sure if something's limited by the C compiler there.

@lu4p
Copy link
Author

lu4p commented Mar 17, 2020

Will check today

@lu4p
Copy link
Author

lu4p commented Mar 17, 2020

build worked can you share your android example project so i can check?

@karalabe
Copy link
Member

I don't think I have an example project stashed away anywhere at the moment. If the build succeeded, I guess everything should work ok. I've build various prototypes on and off, but don't have anything reasonably clean to share.

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