bedrock-protocol icon indicating copy to clipboard operation
bedrock-protocol copied to clipboard

support bedrock protocol on android

Open Geruays opened this issue 2 years ago • 20 comments

Screenshot_20211112-161552

Geruays avatar Nov 12 '21 09:11 Geruays

Install cmake (apt install cmake) then run “npm install raknet-native”

extremeheat avatar Nov 12 '21 09:11 extremeheat

Install cmake (apt install cmake) then run “npm install raknet-native”

After that i got like this

Screenshot_20211112-164908

Geruays avatar Nov 12 '21 09:11 Geruays

You did not install raknet native correctly. Try on another system.

extremeheat avatar Nov 12 '21 20:11 extremeheat

You did not install raknet native correctly. Try on another system.

How i have install cmake and npm install raknet-native and i always got like that

Geruays avatar Nov 12 '21 22:11 Geruays

Can you show the result of npm install raknet-native ? You may need to run npm uninstall raknet-native first.

Run node then do require('raknet-native')

extremeheat avatar Nov 13 '21 02:11 extremeheat

npm install raknet-native

He's using termux, temux doesn't have MSVC. I don't think it is possible on termux.

CypherpunkSamurai avatar Dec 19 '21 19:12 CypherpunkSamurai

npm install raknet-native

He's using termux, temux doesn't have MSVC. I don't think it is possible on termux.

MSVC is the compiler on windows, clang or gcc will suffice for non-windows as long as cmake is installed. There are also prebuilds shipped for OS X and Linux, although it's possible the kernels they were compiled for are out of date (but with proper build tools installed, it shouldn't matter)

extremeheat avatar Dec 19 '21 20:12 extremeheat

npm install raknet-native

He's using termux, temux doesn't have MSVC. I don't think it is possible on termux.

MSVC is the compiler on windows, clang or gcc will suffice for non-windows as long as cmake is installed. There are also prebuilds shipped for OS X and Linux, although it's possible the kernels they were compiled for are out of date (but with proper build tools installed, it shouldn't matter)

As a matter of fact it doesn't. I have MinGW GNU toolchain, llvm and cygwin, make, cmake, ninja all installed, it still defaults to msvc.

I'm assuming the same occurs for termux. It isn't detecting compiler

CypherpunkSamurai avatar Dec 20 '21 04:12 CypherpunkSamurai

As a matter of fact it doesn't. I have MinGW GNU toolchain, llvm and cygwin, make, cmake, ninja all installed, it still defaults to msvc.

I'm assuming the same occurs for termux. It isn't detecting compiler

What exactly is "it" ? Are you talking about your desktop machine or termux? MinGW is for Windows systems.

On Windows there is no reason to not use MSVC. On unix-based OSes (android, osx, linux), cmake will build based the Makefile with the C/C++ compiler based on the CC and CXX environment flags.

For anyone with this issue, please post the install log for raknet-native. The discord (link in the README badge) is a better place for support questions.

extremeheat avatar Dec 20 '21 05:12 extremeheat

By it i mean raknet-native and its build system.

On Windows there is no reason to not use MSVC.

Just cause I have a windows pc doesn't mean I use MSVC. Also there's multiple reasons to not use MSVC lets not pull that debate here. Point is give users option to use other compilers when required.

CypherpunkSamurai avatar Dec 20 '21 05:12 CypherpunkSamurai

By it i mean raknet-native and its build system.

On Windows there is no reason to not use MSVC.

Just cause I have a windows pc doesn't mean I use MSVC. Also there's multiple reasons to not use MSVC lets not pull that debate here. Point is give users option to use other compilers when required.

I’m not understanding the issue here. We don’t choose the compiler. I also don’t understand the issue with windows—prebuilt binaries should be supplied for Windows 10/11. If you are able to, please join the discord so we can discuss.

extremeheat avatar Dec 20 '21 05:12 extremeheat

By it i mean raknet-native and its build system.

On Windows there is no reason to not use MSVC.

Just cause I have a windows pc doesn't mean I use MSVC. Also there's multiple reasons to not use MSVC lets not pull that debate here. Point is give users option to use other compilers when required.

I’m not understanding the issue here. We don’t choose the compiler. I also don’t understand the issue with windows—prebuilt binaries should be supplied for Windows 10/11. If you are able to, please join the discord so we can discuss.

I'm using Windows 8.1 and prebuilt binaries are not supplied, neither is it using GNU toolchains. Point is we need a solution to force a compiler.

CypherpunkSamurai avatar Dec 20 '21 06:12 CypherpunkSamurai

I'm using Windows 8.1 and prebuilt binaries are not supplied, neither is it using GNU toolchains. Point is we need a solution to force a compiler.

First off this is the wrong repo for this discussion, if you're having trouble with raknet-native open an issue on that repo. Second off there's nothing in raknet-native's CMakeLists.txt that picks a compiler for you. You must learn how to use your own toolchain.

nickelpro avatar Dec 20 '21 07:12 nickelpro

I'm using Windows 8.1 and prebuilt binaries are not supplied, neither is it using GNU toolchains. Point is we need a solution to force a compiler.

First off this is the wrong repo for this discussion, if you're having trouble with raknet-native open an issue on that repo. Second off there's nothing in raknet-native's CMakeLists.txt that picks a compiler for you. You must learn how to use your own toolchain.

Oh damnit i just can use. I don't know anything about cmake or something

Geruays avatar Dec 24 '21 23:12 Geruays

Is this still an issue after running

npm install raknet-native

? Have not seen a reply to this.

extremeheat avatar Mar 05 '22 05:03 extremeheat

@extremeheat sorry for necroposting but it is still an issue as of July 17 2022.

Screenshot_20220717-140559_Termux.jpg

Screenshot_20220717-134857_Termux.jpg

Screenshot_20220717-134832_Termux.jpg

azurenekowo avatar Jul 17 '22 07:07 azurenekowo

Screenshot_2022-07-20-23-27-57-199_com termux @extremeheat I have also same problem... I've install clang, cmake,raknet-native..... But still the same problem

AkramHossainApu avatar Jul 20 '22 17:07 AkramHossainApu

It kinda possible but with change the code

nuuwy0 avatar Nov 22 '22 03:11 nuuwy0

(sorry about my poor English XD)

It is now possible to use bedrock-protocol (raknet-native) on termux.

You need to install nodejs, cmake and g++ first. You can execute the following command to install:

pkg install nodejs-lts
pkg install cmake
pkg install clang

Then execute the bedrock-protocol installation in your nodejs project folder:

npm install bedrock-protocol

If an error about the symlink is returned,

like this (expand to view)
npm ERR! code EPERM
npm ERR! syscall symlink
npm ERR! path ../cmake-js/bin/cmake-js
npm ERR! dest <YOUR PROJECT PATH>/node_modules/.bin/cmake-js
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, symlink '../cmake-js/bin/cmake-js' -> '<YOUR PROJECT PATH>/node_modules/.bin/cmake-js'
npm ERR!  [Error: EPERM: operation not permitted, symlink '../cmake-js/bin/cmake-js' -> '<YOUR PROJECT PATH>/node_modules/.bin/cmake-js'] {
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../cmake-js/bin/cmake-js',
npm ERR!   dest: '<YOUR PROJECT PATH>/node_modules/.bin/cmake-js'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: npm ERR! /data/data/com.termux/files/home/.npm/_logs/XXXX-XX-XXXXX_XX_XX_XXXXX-debug-0.log

This is because Android doesn't allow symlinks to exist in internal shared storage, just move your project directory from internal storage to termux home directory located in data partition to resolve your error. To do this, just use the command mv <YOUR PROJECT PATH> ~. This will move your project directory to /data/data/com.termux/files/home/<...>.

Then you can enjoy bedrock-protocol :)

Cdm2883 avatar Aug 06 '23 12:08 Cdm2883

[ 94%] Building CXX object raknet/Lib/LibStatic/CMakeFiles/RakNetLibStatic.dir/__/__/Source/gettimeofday.cpp.o
[ 95%] Linking CXX static library libRakNetLibStatic.a
[ 95%] Built target RakNetLibStaticaft-data: http
[ 96%] Building CXX object CMakeFiles/node-raknet.dir/src/RakClient.cpp.o
/data/data/com.termux/files/home/bproto/node_modules/raknet-native/src/RakClient.cpp:93:20: error: use of overloaded operator '[]' is ambiguous (with operand types 'Napi::Array' and 'int')
   93 |             packets[i] = Napi::ArrayBuffer::New(env, data->data, data->length, FreeBuf, data);
      |             ~~~~~~~^~
/data/data/com.termux/files/home/bproto/node_modules/node-addon-api/napi-inl.h:1147:49: note: candidate function
 1147 | inline Object::PropertyLValue<uint32_t> Object::operator [](uint32_t index) {
      |                                                 ^
/data/data/com.termux/files/home/bproto/node_modules/node-addon-api/napi-inl.h:1159:22: note: candidate function
 1159 | inline Value Object::operator [](uint32_t index) const {
      |                      ^
/data/data/com.termux/files/home/bproto/node_modules/raknet-native/src/RakClient.cpp:93:20: note: built-in candidate operator[](struct napi_value__ *, int)
   93 |             packets[i] = Napi::ArrayBuffer::New(env, data->data, data->length, FreeBuf, data);
      |                    ^
/data/data/com.termux/files/home/bproto/node_modules/raknet-native/src/RakClient.cpp:93:20: note: built-in candidate operator[](const struct napi_value__ *, int)
/data/data/com.termux/files/home/bproto/node_modules/raknet-native/src/RakClient.cpp:93:20: note: built-in candidate operator[](volatile struct napi_value__ *, int)
/data/data/com.termux/files/home/bproto/node_modules/raknet-native/src/RakClient.cpp:93:20: note: built-in candidate operator[](const volatile struct napi_value__ *, int)
/data/data/com.termux/files/home/bproto/node_modules/raknet-native/src/RakClient.cpp:108:25: warning: left operand of comma operator has no effect [-Wunused-value]
  108 |         while (context->running, p = client->Receive()) {
      |                ~~~~~~~  ^~~~~~~
1 warning and 1 error generated.ecraft-data: http
make[2]: *** [CMakeFiles/node-raknet.dir/build.make:76: CMakeFiles/node-raknet.dir/src/RakClient.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:130: CMakeFiles/node-raknet.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
info REP Build has been failed, trying to do a full rebuild.
info CMD CLEAN
info RUN [
info RUN   'cmake',
info RUN   '-E',
info RUN   'remove_directory',
info RUN   '/data/data/com.termux/files/home/bproto/node_modules/raknet-native/build'
info RUN ]
info CMD CONFIGURE#] - reify:minecraft-data: http
info RUN [#########] - reify:minecraft-data: http
info RUN   'cmake',
info RUN   '/data/data/com.termux/files/home/bproto/node_modules/raknet-native',
info RUN   '--no-warn-unused-cli',
info RUN   '-G',
info RUN   'Unix Makefiles',
info RUN   '-DCMAKE_JS_VERSION=6.3.2',
info RUN   '-DCMAKE_BUILD_TYPE=Release',
info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/data/data/com.termux/files/home/bproto/node_modules/raknet-native/build/Release',
info RUN   '-DCMAKE_JS_INC=/data/data/com.termux/files/home/.cmake-js/node-arm/v20.2.0/include/node',
info RUN   '-DCMAKE_JS_SRC=',
info RUN   '-DNODE_RUNTIME=node',
info RUN   '-DNODE_RUNTIMEVERSION=20.2.0',
info RUN   '-DNODE_ARCH=arm'
info RUN ]

Fleecks avatar Jan 08 '24 21:01 Fleecks

The issue is caused by Termux not bedrock-protocol, it freaks out cause of the serializer. There are better linux terminal apps on android such as UserLand. Had not tested there tho so corrections appreciated

AnyBananaGAME avatar Jan 25 '24 07:01 AnyBananaGAME