Building Panda on Android


#42

$ uname -a
Linux localhost 3.10.65-9236909 #2 SMP PREEMPT Thu Dec 7 17:41:18 KST 2017 armv7l Android
$ getprop ro.product.cpu.abi
armeabi-v7a
$ getprop ro.product.cpu.abi2
armeabi
$


#43

Just to be absolutely clear, platform.machine() returned armv71 and not armv7l?


#44

Either way, I’ve checked in a change that should handle your case in makepanda. Just cd to the panda3d directory and type git pull to get the latest changes.


#45

~~^
fatal error: too many errors emitted, stopping now
[-ferror-limit=]
20 errors generated.

I get a total of 20 errors so it doesnt compile.


#46

Could you include the error messages you get from the compiler?


#47

cstdlib:155:9: error: no member named ‘at_quick_exit’ in the global namespace

And a bunch of these. All of them are the same namespace issue with different member names.


#48

Sorry i forgot to mention that this seems to be a problem caused by my termux and not panda3d. The full path line was too long.


#49

error: /data/data/com.termux/files/usr/bin/…/include/c++/v1/cstdlib:155:9:
no member named ‘at_quick_exit’ in the global namespace
error: no member named ‘at_quick_exit’ in the global
namespace using ::at_quick_exit;
~~^ using ::at_quick_exit;
~~^

error: error:
no member named ‘quick_exit’ in the global namespace
no member named ‘quick_exit’ in the global namespace
using ::quick_exit; ~~^
using ::quick_exit; ~~^

error: no member named ‘iswblank’ in the global
namespace; did you mean ‘isblank’?
using ::iswblank;
~~^

error:
no member named ‘iswblank’ in the global
namespace; did you mean ‘isblank’?
using ::iswblank;

error: no member named ‘vfwscanf’ in the global
namespace using ::vfwscanf;

error:
no member named ‘vfwscanf’ in the global namespace
/data/data/com.termux/files/usr/bin/…/include/c++/v1/cwchar:128:9: error: using ::vfwscanf;
~~^
no member named ‘vswscanf’ in the global namespace
using ::vswscanf; ~~^

error: no /data/data/com.termux/files/usr/bin/…/include/c++/v1/cwchar:138:9: error:
no member named ‘wcstof’ in the global
namespace
member named ‘vswscanf’ in the global
namespace
using ::wcstof;
~~^
using ::vswscanf;

error:
no member named ‘iswblank’ in the global
namespace; did you mean ‘isblank’?
return ::iswblank©;
~~^
/data/data/com.termux/files/usr/include/ctype.h:66:5: note:
‘isblank’ declared here int isblank(int __ch);
^ /data/data/com.termux/files/usr/bin/…/include/c++/v1/__locale:60:7: error: use of undeclared identifier ‘uselocale’
uselocale(_old_loc); ^

error: use of undeclared identifier ‘uselocale’
…__loc) : _old_loc(uselocale(__loc)) {} ^
/data/data/com.termux/files/usr/bin/…/include/c++/v1/__locale:60:7: error:
use of undeclared identifier ‘uselocale’ uselocale(_old_loc);
^

error:
no member named ‘iswblank’ in the global
namespace; did you mean ‘isblank’?
return ::iswblank©;
~~^
/data/data/com.termux/files/usr/include/ctype.h:66:5: note:
‘isblank’ declared here int isblank(int __ch);
^ /data/data/com.termux/files/usr/bin/…/include/c++/v1/__locale:60:7: error: use of undeclared identifier ‘uselocale’
uselocale(_old_loc); ^

error:
use of undeclared identifier ‘wcsnrtombs’
return wcsnrtombs(__dest, __src, __nwc…
^
/data/data/com.termux/files/usr/bin/…/include/c++/v1/__bsd_locale_fallbacks.h:64:12: error:
use of undeclared identifier ‘mbsnrtowcs’ return mbsnrtowcs(__dest, __src, __nms…
^

error: use of undeclared identifier ‘wcsnrtombs’
return wcsnrtombs(__dest, __src, __nwc… ^
/data/data/com.termux/files/usr/bin/…/include/c++/v1/__bsd_locale_fallbacks.h:64:12: error:
use of undeclared identifier ‘mbsnrtowcs’ return mbsnrtowcs(__dest, __src, __nms…
^

error:
use of undeclared identifier ‘strtoll_l’; did
you mean ‘strtol_l’?
long long __ll = strtoll_l(a, &
^

error:
use of undeclared identifier ‘strtoull_l’; did you mean ‘strtol_l’?
unsigned long long _ll = strtoull

error:
use of undeclared identifier ‘strtoll_l’; did
you mean ‘strtol_l’?
/data/data/com.termux/files/usr/bin/…/include/c++/v1/locale:819:12: error:
use of undeclared identifier ‘strtold_l’; long long __ll = strtoll_l(a, &
^

error:
use of undeclared identifier ‘strtoull_l’;
did you mean ‘strtol_l’?
unsigned long long _ll = strtoull

error: use of undeclared identifier ‘strtold_l’; did
you mean ‘strtod_l’?
return strtold_l(__a, __p2, _LIBCPP_GET…
^

error:
no member named ‘log2f’ in the global namespace
…__lcpp_x) NOEXCEPT {return ::log2f(
~~^
/data/data/com.termux/files/usr/include/c++/v1/math.h:1303:93: error: no member named ‘log2l’ in the global
namespace
…double __lcpp_x) _NOEXCEPT {return ::log2l(… ~~^
fatal error: too many errors emitted, stopping now
[-ferror-limit=] 20 errors generated.

I found it hard copying large text in termux but here we go.


#50

This looks like an issue with the Android NDK. Please ensure you have the latest versions of this installed with apt update and apt upgrade. It may also prove fruitful to Google these error messages to see if others have reported errors similar to these.


#51

Note: it may help to explicitly pass --target android-21 in makepanda (instead of just --target android) if you are running into these errors.


#52

How do i install android ndk in termux?


#53
pkg install ndk-stl ndk-sysroot

#54

Passing android-21 worked the errors dont come up anymore. The build terminates at 7% tho. This is what i get:

[ 7%] Building Interrogate database built/pandac/input/libp3dtoolbase.in
/data/data/com.termux/files/usr/bin/sh: 1: built/bin/interrogate: Permission denied
Storing dependency cache. Elapsed Time: 15 sec
The following command returned a non-zero value: built/bin/interrogate -srcdir dtool/src/dtoolbase -Idtool/src/dtoolbase -DCPPPARSER -D__STDC__=1 -D__cplusplus=201103L -D__attribute__(x)= -D__i386__ -D__ANDROID__ -oc built/tmp/libp3dtoolbase_igate.cxx -od built/pandac/input/libp3dtoolbase.in -fnames -string -refcount -assert -python-native -Sbuilt/include/parser-inc -Idtool/src/dtoolbase -Sbuilt/tmp -Sbuilt/include -S/data/data/com.termux/files/usr/include/python3.6m -DANDROID= -module panda3d.core -library libp3dtoolbase p3dtoolbase_composite1.cxx p3dtoolbase_composite2.cxx typeH
andle.h typeHandle_ext.h typeRegistry.h typedObject.h neverFreeMemory.h Build terminated.
build.sh: 4: build.sh: --threads: not found


#55

Sorry, discourse failed to notify me of replies to this thread.

The second error indicates that there is something wrong with your build.sh script. Probably there is a newline somewhere where it shouldn’t be, probably before the --threads argument. I would suggest deleting the built directory with rm -rf built to see if the first error will go away. If you still get the first error, try calling chmod +x built/bin/interrogate and re-run makepanda to see if that helps.


#56

Hi, I wanted to try to build (using the latest commit 1a94e65) on my nexus 5 android with these features (from makepanda.py output):

  • Version: 1.10.0
  • Using Python 3.6
  • Target OS: android (API level 21)
  • Target arch: armv7a

and after several attempts I came to this script (slightly modified than the original):

#!/bin/sh

export LD_LIBRARY_PATH=/system/lib:$LD_LIBRARY_PATH
rm -f panda3d.apk
export CXXFLAGS='-I/data/data/com.termux/files/usr/include -I/data/data/com.termux/files/usr/include/harfbuzz'
CXXFLAGS="$CXXFLAGS" makepanda/makepanda.py --everything --target android-21 --installer --threads 4 $@
if [ -f panda3d.apk ]; then
  cp panda3d.apk /sdcard/panda3d.apk
  xdg-open /sdcard/panda3d.apk
fi

and it works up to a certain point where it gives me this error

...
java.lang.NoClassDefFoundError: org.eclipse.jdt.internal.compiler.batch.-$$Lambda$ClasspathLocation$GQimjP-835AJ59yLyUnQopLF5GE
	at org.eclipse.jdt.internal.compiler.batch.ClasspathLocation.getModuleNames(ClasspathLocation.java:129)
	at org.eclipse.jdt.internal.compiler.batch.FileSystem.initializeModuleLocations(FileSystem.java:222)
	at org.eclipse.jdt.internal.compiler.batch.FileSystem.<init>(FileSystem.java:212)
	at org.eclipse.jdt.internal.compiler.batch.Main.getLibraryAccess(Main.java:3447)
	at org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main.java:4631)
	at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1771)
	at org.eclipse.jdt.internal.compiler.batch.Main.main(Main.java:1479)
The following command returned a non-zero value: ecj -cp built/classes -d built/classes panda/src/android/NativeIStream.java
Storing dependency cache.
Elapsed Time: 2 min 0 sec
Build process aborting.
Build terminated.

I’m absolutely not expert in the java build environment and, after some research, I tried to insert into the script:
export CLASSPATH=/data/data/com.termux/files/usr/share/java/android.jar:$CLASSPATH
but without success.


#57

This looks like a problem with your ecj build. There seems to be an issue report about it here:

It looks like the solution suggested at the end of the thread is this:

apt install ecj4.6

#58

This solved the problem, now the build is successful!


#59

After using the instructions on the deploy-ng branch which are:

pkg install python-dev termux-tools ndk-stl ndk-sysroot clang libvorbis-dev libopus-dev opusfile-dev openal-soft-dev freetype-dev harfbuzz-dev libpng-dev ecj4.6 dx patchelf aapt apksigner libcrypt-dev

python makepanda/makepanda.py --everything --target android-21 --installer
xdg-open panda3d.apk

I had to use these:

pkg install libunwind
LD_LIBRARY_PATH=/system/lib64:$PREFIX/lib python makepanda/makepanda.py --everything --target android-21 --installer xdg-open panda3d.apk

This was to get passed the errors mention here https://github.com/termux/termux-packages/issues/2416

05-10 14:17:55.382 27559 27559 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": cannot locate symbol "XzUnpacker_Construct" referenced by "/system/lib/libunwind.so"...
05-10 14:17:55.382 27559 27559 F libc    : Fatal signal 6 (SIGABRT), code 0 in tid 27559 (crash_dump32), pid 27559 (crash_dump32)
$ apt install libunwind
05-10 14:24:01.966 30508 30508 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": cannot locate symbol "_UPT_accessors" referenced by "/system/lib/libbacktrace.so"...
05-10 14:24:01.966 30508 30508 F libc    : Fatal signal 6 (SIGABRT), code 0 in tid 30508 (crash_dump32), pid 30508 (crash_dump32)