Problem installing #walletconnect/react-native-dapp package - android

I want to use walletconnect in my react native app and had setup everything based on the #walletconnect/react-native-dapp package. I followed many articles to make it work.I search it on google and found no result.It seems that error is regarding better-sqlite3. This is the error i got.
error /Users/Shaw/Project/Hercules/node_modules/better-sqlite3:
Command failed.
Exit code: 1
Command: prebuild-install || npm run build-release
Arguments:
Directory: /Users/Shaw/Project/Hercules/node_modules/better-sqlite3
Output:
prebuild-install warn install No prebuilt binaries found (target=19.3.0 runtime=node
arch=arm64 libc= platform=darwin)
./src/util/binder.lzz:37:51: error: no member named 'CreationContext' in 'v8::Object'
v8::Local<v8::Context> ctx = obj->CreationContext();
better-sqlite3#7.6.2 build-release
node-gyp rebuild --release
gyp info it worked if it ends with ok
gyp info using node-gyp#9.3.0
gyp info using node#19.3.0 | darwin | arm64
gyp info find Python using Python version 3.10.9 found at "/opt/homebrew/opt/python#3.10/bin/python3.10"
gyp info spawn /opt/homebrew/opt/python#3.10/bin/python3.10
gyp info spawn args [
gyp info spawn args '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/Shaw/Project/Hercules/node_modules/better-sqlite3/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/Shaw/Library/Caches/node-gyp/19.3.0',
gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/Shaw/Library/Caches/node-gyp/19.3.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/Shaw/Project/Hercules/node_modules/better-sqlite3',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate
ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate
TOUCH Release/obj.target/deps/locate_sqlite3.stamp
CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
LIBTOOL-STATIC Release/sqlite3.a
CXX(target) Release/obj.target/better_sqlite3/src/better_sqlite3.o
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/node.h:73:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8.h:24:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-array-buffer.h:12:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-local-handle.h:12:
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:476:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
SHARED_EXTERNAL_POINTER_TAGS(CHECK_SHARED_EXTERNAL_POINTER_TAGS)
^
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:476:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:476:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:476:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:476:30: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:477:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
PER_ISOLATE_EXTERNAL_POINTER_TAGS(CHECK_NON_SHARED_EXTERNAL_POINTER_TAGS)
^
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:477:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:477:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:477:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:477:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:477:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:477:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:477:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:477:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:477:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:477:35: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:658:61: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
static_assert(kJSObjectType + 1 == kFirstJSApiObjectType);
^
, ""
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:659:55: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
static_assert(kJSObjectType < kLastJSApiObjectType);
^
, ""
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-internal.h:660:63: warning: 'static_assert' with no message is a C++17 extension [-Wc++17-extensions]
static_assert(kFirstJSApiObjectType < kLastJSApiObjectType);
^
, ""
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/node.h:73:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8.h:24:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-array-buffer.h:13:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-object.h:9:
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-maybe.h:106:45: error: no template named 'is_lvalue_reference_v' in namespace 'std'; did you mean 'is_lvalue_reference'?
template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
~~~~~^~~~~~~~~~~~~~~~~~~~~
is_lvalue_reference
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:910:29: note: 'is_lvalue_reference' declared here
struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { };
^
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/node.h:73:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8.h:24:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-array-buffer.h:13:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-object.h:9:
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-maybe.h:106:69: error: expected '(' for function-style cast or type construction
template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-maybe.h:123:43: error: no template named 'is_lvalue_reference_v' in namespace 'std'; did you mean 'is_lvalue_reference'?
template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
~~~~~^~~~~~~~~~~~~~~~~~~~~
is_lvalue_reference
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:910:29: note: 'is_lvalue_reference' declared here
struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { };
^
In file included from ../src/better_sqlite3.cpp:4:
In file included from ./src/better_sqlite3.lzz:11:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/node.h:73:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8.h:24:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-array-buffer.h:13:
In file included from /Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-object.h:9:
/Users/Shaw/Library/Caches/node-gyp/19.3.0/include/node/v8-maybe.h:123:67: error: expected '(' for function-style cast or type construction
template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
./src/util/macros.lzz:157:21: error: no member named 'AccessorSignature' in namespace 'v8'
v8::AccessorSignature::New(isolate, recv)
~~~~^
./src/objects/database.lzz:180:21: warning: variable 'status' set but not used [-Wunused-but-set-variable]
int status = sqlite3_db_config(db_handle, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, NULL);
^
./src/util/binder.lzz:37:51: error: no member named 'CreationContext' in 'v8::Object'
v8::Local<v8::Context> ctx = obj->CreationContext();
~~~~~^
20 warnings and 6 errors generated.
make: *** [Release/obj.target/better_sqlite3/src/better_sqlite3.o] Error 1
rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack at ChildProcess.emit (node:events:513:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Darwin 22.1.0
gyp ERR! command "/opt/homebrew/Cellar/node/19.3.0/bin/node" "/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /Users/Shaw/Project/Hercules/node_modules/better-sqlite3
gyp ERR! node -v v19.3.0
gyp ERR! node-gyp -v v9.3.0
gyp ERR! not ok
I do followed these steps
npx react-native init appName --template react-native-template-typescript
cd appName
npm i --save react-native-crypto react-native-randombytes
cd ios/ && pod install && cd ..
npm i --save-dev rn-nodeify#latest
./node_modules/.bin/rn-nodeify --install
npm i --save node-libs-browser
npm i base-64
#Modify metro.config.js
#Modify shim.js.
#Add shim import to App.tsx
None of the above thing worked.
Any help would be appreciated

Use below method to integrate #walletconnect-react-native-dapp library
https://github.com/WalletConnect/walletconnect-monorepo/issues/753
Refer this post React Native and WalletConnect (Uncaught Error: null is not an object (evaluating 'RNRandomBytes.seed'))

Related

Cross compiling boost for android using conan

I was trying to cross compile some conan libraries using android ndk from my linux machine.
When trying to cross compile boost i get build failure error. Other conan packages cross compile perfectly except boost. I have added the conan profile and err log.
My conan profile:
include(default)
[settings]
arch=armv8
build_type=Release
compiler=clang
compiler.libcxx=libc++
compiler.version=12
os=Android
os.api_level=21
[build_requires]
[options]
[env]
ANDROID_NDK_ROOT=/home/local/Downloads/android-ndk-r23
WARN: replace_in_file didn't find pattern '$(>) > $(<)' in '/home/local/.conan /data/boost/1.76.0/_/_/source/source_subfolder/libs/stacktrace/build/Jamfile.v2' file.
WARN: replace_in_file didn't find pattern '/* thread_local */' in '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/boost/stacktrace/detail/libbacktrace_impls.hpp' file.
WARN: replace_in_file didn't find pattern '/* static __thread */' in '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/boost/stacktrace/detail/libbacktrace_impls.hpp' file.
boost/1.76.0: WARN: Patching user-config.jam
boost/1.76.0: WARN:
using zlib : 1.2.11 : <include>"/home/local/.conan/data/zlib/1.2.11/_/_/package/18bbcddf275ee23aa172cdc6dbfa549e2411acfd/include" <search>"/home/local/.conan/data/zlib/1.2.11/_/_/package/18bbcddf275ee23aa172cdc6dbfa549e2411acfd/lib" <name>z ;
using bzip2 : 1.0.8 : <include>"/home/local/.conan/data/bzip2/1.0.8/_/_/package/a765640a31d963ba8d5612cab2f1811597d3de80/include" <search>"/home/local/.conan/data/bzip2/1.0.8/_/_/package/a765640a31d963ba8d5612cab2f1811597d3de80/lib" <name>bz2 ;
using "clang-linux" : : :
<compileflags>"-I/home/local/.conan/data/libbacktrace/cci.20210118/_/_/package/18bbcddf275ee23aa172cdc6dbfa549e2411acfd/include" <linkflags>"-L/home/local/.conan/data/libbacktrace/cci.20210118/_/_/package/18bbcddf275ee23aa172cdc6dbfa549e2411acfd/lib" ;
boost/1.76.0: Cross building, detecting compiler...
boost/1.76.0: Cross building flags: []
boost/1.76.0: WARN: b2 -q numa=on target-os=android architecture=arm address-model=64 binary-format=elf abi=aapcs --layout=system --user-config=/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=on boost.locale.iconv.lib=libc threading=multi visibility=hidden link=static variant=release --with-atomic --with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-wave toolset=clang-linux pch=on cxxflags="-fPIC -DBOOST_STACKTRACE_ADDR2LINE_LOCATION=/usr/bin/addr2line" install --prefix=/home/local/.conan/data/boost/1.76.0/_/_/package/1e5ed3b96aff577e610fddd01bd296a709542e8c -j12 --abbreviate-paths -d0 --debug-configuration --build-dir="/home/local/.conan/data/boost/1.76.0/_/_/build/1e5ed3b96aff577e610fddd01bd296a709542e8c"
notice: found boost-build.jam at /home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/boost-build.jam
notice: loading B2 from /home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/bootstrap.jam
warning: mismatched versions of B2 engine and core
warning: B2 engine (b2) is 4.5.0
warning: B2 core (at /home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src) is 4.4-git
notice: Searching '/etc' '/home/local' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/kernel' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/util' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/tools' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/contrib' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/.' for site-config configuration file 'site-config.jam'.
notice: Configuration file 'site-config.jam' not found in '/etc' '/home/local' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/kernel' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/util' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/tools' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/contrib' '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/.'.
notice: Loading explicitly specified user configuration file:
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/user-config.jam
notice: Searching '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build' for user-config configuration file 'user-config.jam'.
notice: Loading user-config configuration file 'user-config.jam' from '/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build'.
notice: [zlib] Using pre-installed library
notice: [zlib] Condition
notice: [bzip2] Using pre-installed library
notice: [bzip2] Condition
warning: toolset clang-linux initialization: can not find tool clang++
warning: initialized from /home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/user-config.jam:5
sh: 1: clang++: not found
notice: will use 'clang++' for clang-linux, condition <toolset>clang-linux
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/tools/clang-linux.jam:69: in clang-linux.init
*** argument error
* rule clang.init-cxxstd-flags ( toolset : condition * : version )
* called with: ( clang-linux : <toolset>clang-linux : )
* missing argument version
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/tools/clang.jam:54:see definition of rule 'clang.init-cxxstd-flags' being called
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build/toolset.jam:44: in toolset.using
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build/project.jam:1104: in using
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/user-config.jam:5: in modules.load
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build-system.jam:255: in load-config
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build-system.jam:449: in load-configuration-files
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/build-system.jam:607: in load
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/kernel/modules.jam:295: in import
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/src/kernel/bootstrap.jam:139: in boost-build
/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/boost-build.jam:17: in module scope
boost/1.76.0:
boost/1.76.0: ERROR: Package '1e5ed3b96aff577e610fddd01bd296a709542e8c' build failed
boost/1.76.0: WARN: Build folder /home/local/.conan/data/boost/1.76.0/_/_/build/1e5ed3b96aff577e610fddd01bd296a709542e8c
ERROR: boost/1.76.0: Error in build() method, line 807
self.run(full_command, run_environment=True)
ConanException: Error 1 while executing b2 -q numa=on target-os=android architecture=arm address-model=64 binary-format=elf abi=aapcs --layout=system --user-config=/home/local/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=on boost.locale.iconv.lib=libc threading=multi visibility=hidden link=static variant=release --with-atomic --with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-wave toolset=clang-linux pch=on cxxflags="-fPIC -DBOOST_STACKTRACE_ADDR2LINE_LOCATION=/usr/bin/addr2line" install --prefix=/home/local/.conan/data/boost/1.76.0/_/_/package/1e5ed3b96aff577e610fddd01bd296a709542e8c -j12 --abbreviate-paths -d0 --debug-configuration --build-dir="/home/local/.conan/data/boost/1.76.0/_/_/build/1e5ed3b96aff577e610fddd01bd296a709542e8c"

Building android kernel

since two weeks I try to build the kernel for my htc device. Getting the right sources is not the problem, but since gcc has been removed from toolchains it's a real nightmare. Following the proposals to use clang instead always ends in lot of error messages.
What I've done up to now?
Proper installation of latest android-ndk (21.3.6528147)
Successfully test cross-compiling (just a simple program) over commandline
setup ENV variables for kernel build: (export commands only if not set yet)
$ cd <kernel-source-root>
($ make mrproper) // just after failed attempt to build
$ export ARCH=arm64
$ export SUBARCH=arm64
$ export CROSS_COMPILE=<path-to-toolchain-llvm-bin-folder>
modify Makefile and AndroidKernel.mk
// replace all occurences of 'gcc' with 'clang'
-gcc
+clang
generate .config
$ make msm-perf_defconfig
perform build
$ make V=1
getting error messages:
// ...
../kernel/bounds.c:18:2: error: unexpected token at start of statement
DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS);
^
../include/linux/kbuild.h:5:25: note: expanded from macro 'DEFINE'
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
^
<inline asm>:2:1: note: instantiated into assembly here
->NR_PAGEFLAGS 21 __NR_PAGEFLAGS
^
../kernel/bounds.c:19:2: error: unexpected token at start of statement
DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES);
^
../include/linux/kbuild.h:5:25: note: expanded from macro 'DEFINE'
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
^
<inline asm>:2:1: note: instantiated into assembly here
->MAX_NR_ZONES 3 __MAX_NR_ZONES
^
../kernel/bounds.c:21:2: error: unexpected token at start of statement
DEFINE(NR_CPUS_BITS, ilog2(CONFIG_NR_CPUS));
^
../include/linux/kbuild.h:5:25: note: expanded from macro 'DEFINE'
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
^
<inline asm>:2:1: note: instantiated into assembly here
->NR_CPUS_BITS 3 ilog2(CONFIG_NR_CPUS)
^
../kernel/bounds.c:23:2: error: unexpected token at start of statement
DEFINE(SPINLOCK_SIZE, sizeof(spinlock_t));
^
../include/linux/kbuild.h:5:25: note: expanded from macro 'DEFINE'
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
^
<inline asm>:2:1: note: instantiated into assembly here
->SPINLOCK_SIZE 4 sizeof(spinlock_t)
^
4 errors generated.
make[2]: *** [kernel/bounds.s] Error 1
make[1]: *** [prepare0] Error 2
make: *** [sub-make] Error 2
Does someone see what goes wrong?
Adding -no-integrated-as to the build command fixed it.
According to clang developers:
Add -no-integrated-as. This is a known abuse of the compiler to output something other than assembly.
reference
make ARCH=arm64 -j64 -no-integrated-as

Error: use of undeclared identifier 'PTHREAD_MUTEX_ROBUST' cargo build liblmdb-sys for aarch64-linux-android target

I am trying to compile a rust project into an Android target (aarch64-linux-android).
From the comments in the lmdb code, it seems to need to run the compilation
"aarch64-linux-android-gcc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wall" "-Wextra" "-o" "/Users/username/grin-wallet/target/aarch64-linux-android/release/build/liblmdb-sys-7a2d430dc3c9f3e3/out/mdb/libraries/liblmdb/mdb.o" "-c" "mdb/libraries/liblmdb/mdb.c"
with an additional -DMDB_USE_ROBUST=0 flag. Is this configurable from either the cargo build command or adding something to Cargo.toml?
The error I am getting is:
error: failed to run custom build command for `liblmdb-sys v0.2.2`
Caused by:
process didn't exit successfully: `/Users/username/grin-wallet/target/release/build/liblmdb-sys-b6bfc7b665736f9b/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("aarch64-linux-android")
TARGET = Some("aarch64-linux-android")
HOST = Some("x86_64-apple-darwin")
TARGET = Some("aarch64-linux-android")
TARGET = Some("aarch64-linux-android")
HOST = Some("x86_64-apple-darwin")
CC_aarch64-linux-android = None
CC_aarch64_linux_android = None
TARGET_CC = None
CC = None
TARGET = Some("aarch64-linux-android")
HOST = Some("x86_64-apple-darwin")
CFLAGS_aarch64-linux-android = None
CFLAGS_aarch64_linux_android = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
running: "aarch64-linux-android-gcc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wall" "-Wextra" "-o" "/Users/username/grin-wallet/target/aarch64-linux-android/release/build/liblmdb-sys-7a2d430dc3c9f3e3/out/mdb/libraries/liblmdb/mdb.o" "-c" "mdb/libraries/liblmdb/mdb.c"
cargo:warning=mdb/libraries/liblmdb/mdb.c:4625:13: warning: implicit declaration of function 'pthread_mutexattr_setrobust' is invalid in C99 [-Wimplicit-function-declaration]
cargo:warning= || (rc = pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST))
cargo:warning= ^
cargo:warning=mdb/libraries/liblmdb/mdb.c:4625:49: error: use of undeclared identifier 'PTHREAD_MUTEX_ROBUST'
cargo:warning= || (rc = pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST))
cargo:warning= ^
cargo:warning=mdb/libraries/liblmdb/mdb.c:9821:33: warning: unused parameter 'env' [-Wunused-parameter]
cargo:warning=mdb_env_get_maxkeysize(MDB_env *env)
cargo:warning= ^
cargo:warning=mdb/libraries/liblmdb/mdb.c:10002:10: warning: implicit declaration of function 'pthread_mutex_consistent' is invalid in C99 [-Wimplicit-function-declaration]
cargo:warning= rc2 = mdb_mutex_consistent(mutex);
cargo:warning= ^
cargo:warning=mdb/libraries/liblmdb/mdb.c:351:37: note: expanded from macro 'mdb_mutex_consistent'
cargo:warning=#define mdb_mutex_consistent(mutex) pthread_mutex_consistent(mutex)
cargo:warning= ^
cargo:warning=3 warnings and 1 error generated.
exit code: 1
First, make sure you have all the android build targets installed:
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android
Then install cargo-ndk
cargo install cargo-ndk
Now you need to export a number of variables in the terminal that will be used by the build.
If you are using pkg-config then
export PKG_CONFIG_ALLOW_CROSS=1
The root directory of the NDK
export NDK_HOME=the_path_to_the_ndk
The platform version
export NDK_API_LEVEL=the_api_level
Note that the compilers must be specified as clang for newer versions of the NDK since GCC was deprecated in the android toolchain and is no longer present (some projects try to reference GCC by default)
export CC=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android$NDK_API_LEVEL-clang
export CXX=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android$NDK_API_LEVEL-clang++
Then the rest of the variables
export AR=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar
export AS=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-as
export LD=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ld
export RANLIB=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ranlib
export STRIP=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-strip
You were on the right track in thinking -DMDB_USE_ROBUST=0, it just needed to be passed to the compiler flags
export CFLAGS=-DMDB_USE_ROBUST=0
Then in your rust project, you will need to create a .config directory in the same directory as your .toml file. Within the .config directory, you will need to create a config file.
In the config file you will need to specify the relevant build targets for each target you need built (replace NDK_HOME and NDK_API_LEVEL with their respective values)
[target.aarch64-linux-android]
ar = "<NDK_HOME>/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar"
linker = "<NDK_HOME>/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android<NDK_API_LEVEL>-clang"
You should then be able to build successfully with
cargo ndk --target aarch64-linux-android --android-platform $NDK_API_LEVEL -- build --release
You can't just build and targeting to linex-android, another way to do this is develop your app via Android Studio or with Flutter

Unable to install Phonegap: gyp ERR! configure error

I am following this tutorial in installing phonegap. My computer is Windows 7 64 bit.
However when I run npm install -g phonegap in step 4 of the above tutorial, I am getting errors. The errors displayed in CMD are below
> ws#0.4.31 install C:\Users\Yohan\AppData\Roaming\npm\node_modules\phonegap\nod
e_modules\connect-phonegap\node_modules\socket.io\node_modules\engine.io\node_mo
dules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
/
C:\Users\Yohan\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-ph
onegap\node_modules\socket.io\node_modules\engine.io\node_modules\ws>if not defi
ned npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bi
n\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (no
de rebuild )
> ws#0.4.31 install C:\Users\Yohan\AppData\Roaming\npm\node_modules\phonegap\nod
e_modules\connect-phonegap\node_modules\socket.io\node_modules\socket.io-client\
node_modules\engine.io-client\node_modules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
|
C:\Users\Yohan\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-ph
onegap\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.
io-client\node_modules\ws>if not defined npm_config_node_gyp (node "C:\Program F
iles (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp
\bin\node-gyp.js" rebuild ) else (node rebuild )
^CTerminate batch job (Y/N)? y
The builderror.log file contains the below information.
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 6.1.7600
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Yohan\AppData\Roaming\npm\node_modules\phonegap\node_modules\connect-phonegap\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws
gyp ERR! node -v v4.2.3
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
How can I fix this issue and install phonegap properly?
If possible Try reinstalling node.js with current stable version.
and then in your command prompt
npm install -g phonegap#latest
GoodLuck

Many Errors and Warnings when try to install phonegap

i have a source code of a mobile application written using phonegap and i want to build it to the Android (APK) and IOS versions, the source code is larger than that using phone gap online build service or XDK online build service so i tried to install phonegap and build my application using eclipse for android and xcode for ios.
i already have JDK, Android studio and i also configured all the needed configuration for JAVA, Android, Git in System Variable path key.
When i using command line to install phone gap like this "npm install -g phonegap" i have a lot of warnings and errors:
C:\Users\ahmed.marzouk>npm install -g phonegap
npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config -
-get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit at ChildProcess.exithandler (child_process.js:751:12)
npm WARN addRemoteGit at ChildProcess.emit (events.js:110:17)
npm WARN addRemoteGit at maybeClose (child_process.js:1015:16)
npm WARN addRemoteGit at Socket.<anonymous> (child_process.js:1183:11)
npm WARN addRemoteGit at Socket.emit (events.js:107:17)
npm WARN addRemoteGit at Pipe.close (net.js:485:12)
npm WARN addRemoteGit git+https://github.com/filmaj/node-plist.git resetting re
mote C:\Users\ahmed.marzouk\AppData\Roaming\npm-cache\_git-remotes\https-github-
com-filmaj-node-plist-git-653fe22e because of error: { [Error: Command failed: g
it -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit ]
npm WARN addRemoteGit killed: false,
npm WARN addRemoteGit code: 1,
npm WARN addRemoteGit signal: null,
npm WARN addRemoteGit cmd: 'git -c core.longpaths=true config --get remote.ori
gin.url' }
npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config -
-get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit at ChildProcess.exithandler (child_process.js:751:12)
npm WARN addRemoteGit at ChildProcess.emit (events.js:110:17)
npm WARN addRemoteGit at maybeClose (child_process.js:1015:16)
npm WARN addRemoteGit at Socket.<anonymous> (child_process.js:1183:11)
npm WARN addRemoteGit at Socket.emit (events.js:107:17)
npm WARN addRemoteGit at Pipe.close (net.js:485:12)
npm WARN addRemoteGit git+https://github.com/imhotep/plugman.git#0.5.7 resettin
g remote C:\Users\ahmed.marzouk\AppData\Roaming\npm-cache\_git-remotes\https-git
hub-com-imhotep-plugman-git-20c32d58 because of error: { [Error: Command failed:
git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit ]
npm WARN addRemoteGit killed: false,
npm WARN addRemoteGit code: 1,
npm WARN addRemoteGit signal: null,
npm WARN addRemoteGit cmd: 'git -c core.longpaths=true config --get remote.ori
gin.url' }
npm WARN engine ncallbacks#1.0.0: wanted: {"node":"~0.6.7"} (current: {"node":"0
.12.5","npm":"2.11.2"})
-
> cordova#2.7.4 install C:\Users\ahmed.marzouk\AppData\Roaming\npm\node_modules\
phonegap\node_modules\cordova
> node bootstrap.js
SUCCESS: Minimum requirements for blackberry met.
BOOTSTRAPPING blackberry...
WARNING: Your system does not meet requirements to create wp7 projects. See erro
r output below.
'C:\Users\ahmed.marzouk\AppData\Roaming\npm\node_modules\phonegap\node_modules\c
ordova\lib\cordova-wp7\bin\check_reqs' is not recognized as an internal or exter
nal command,
operable program or batch file.
SKIPPING wp7 bootstrap.
WARNING: Your system does not meet requirements to create ios projects. See erro
r output below.
Xcode is (probably) not installed, specifically the command `xcodebuild` is unav
ailable or erroring out. Output of `xcodebuild -version` is: 'xcodebuild' is not
recognized as an internal or external command,
operable program or batch file.
SKIPPING ios bootstrap.
WARNING: Your system does not meet requirements to create wp8 projects. See erro
r output below.
'C:\Users\ahmed.marzouk\AppData\Roaming\npm\node_modules\phonegap\node_modules\c
ordova\lib\cordova-wp7\bin\check_reqs' is not recognized as an internal or exter
nal command,
operable program or batch file.
SKIPPING wp8 bootstrap.
ERROR! Could not create a native blackberry project test fixture. See below for
error output.
Missing one of the following:
JDK: http://java.oracle.com
Apache ant: http://ant.apache.org
WARNING: Your system does not meet requirements to create android projects. See
error output below.
Please install Android target 17 (the Android 4.2 SDK). Make sure you have the l
atest Android tools installed as well. Run `android` from your command-line to i
nstall/update any missing SDKs or tools.
SKIPPING android bootstrap.
C:\Users\ahmed.marzouk\AppData\Roaming\npm\phonegap -> C:\Users\ahmed.marzouk\Ap
pData\Roaming\npm\node_modules\phonegap\bin\phonegap.js
phonegap#0.9.4 C:\Users\ahmed.marzouk\AppData\Roaming\npm\node_modules\phonegap
├── colors#0.6.2
├── semver#1.1.0
├── qrcode-terminal#0.9.5
├── shelljs#0.0.9
├── optimist#0.3.7 (wordwrap#0.0.3)
├── node-static#0.6.9 (mime#1.3.4)
├── phonegap-build#0.8.0 (qrcode-terminal#0.8.0, phonegap-build-api#0.3.3)
├── prompt#0.2.14 (pkginfo#0.3.0, revalidator#0.1.8, read#1.0.6, winston#0.8.3,
utile#0.2.1)
└── cordova#2.7.4 (ncallbacks#1.0.0, open#0.0.3, shelljs#0.1.2, elementtree#0.1.
3, request#2.11.4, xcode#0.5.1, prompt#0.2.7, plist#0.4.0, express#3.0.6, ripple
-emulator#0.9.29, plugman#0.5.6)
I need to know, is the phonegap installing correctly or not? and if not, how can i solve this issue?
Thanks
I found the solution.
First thing if you have any issue in git like 'git path not found' you should follow the instructions here: installing-git-in-path.
To solve the above problem you should:
first run your cmd as admin it will solve half of the problem.
If there are any issue related toAndroid SDK like
WARNING: Your system does not meet requirements to create android projects. See
error output below.
Please install Android target 17 (the Android 4.2 SDK).
in cmd >
android
then check Android 4.2 SDK and install it.
Thanks

Categories

Resources