Defect #630
closedFailed to build version 0.0.37 using clang-15
100%
Description
I try to build ecs in android termux environment (clang-15), but failed:
~/ecs $ make all In file included from cdopt.cpp:22: In file included from ./cdgenerator.hpp:22: ./code.hpp:206:25: fatal error: use of class template 'TypeModel' requires template arguments using Value = typename TypeModel::Value; ^ ./code.hpp:134:19: note: template is declared here struct ECS::Code::TypeModel : Type ^ 1 error generated. make: *** [makefile:668: tools/cdopt.o] Error 1
Files
Updated by Florian Negele over 2 years ago
- File clang15.patch added
This seems to be a defect of the newest clang version. The attached patch file should fix the problem in the meantime:
patch -p0 < clang15.patch
Updated by Sergey Durmanov over 2 years ago
patching file tools/cdemittercontext.hpp
Hunk #1 FAILED at 300.
1 out of 1 hunk FAILED -- saving rejects to file tools/cdemittercontext.hpp.rej
Updated by Florian Negele over 2 years ago
- File clang15.patch added
Please find the fixed patch file attached.
Updated by Sergey Durmanov over 2 years ago
make all
In file included from cdoptimizer.cpp:19:
./cdoptimizer.hpp:50:12: fatal error: private field 'platform' is not used [-Wunused-private-field]
Platform& platform;
^
1 error generated.
make: *** [makefile:668: tools/cdoptimizer.o] Error 1
Updated by Sergey Durmanov over 2 years ago
make all
cdoptimizer.cpp:33:19: fatal error: private field 'optimizer' is not used [-Wunused-private-field]
const Optimizer& optimizer;
^
1 error generated.
make: *** [makefile:668: tools/cdoptimizer.o] Error 1
Updated by Florian Negele over 2 years ago
- File clang15.patch clang15.patch added
The attached patch file works with clang 15.0.2. There seems to be an issue with libc++ such that make all
fails for some runtime environments. Please use make hosttarget
instead.
Updated by Sergey Durmanov over 2 years ago
clang -v
clang version 15.0.6
Target: armv7a-unknown-linux-android24
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin
~/ecs $ make arma32linuxtarget
In file included from cpparma32.drv:7:
In file included from ./compiler.cpp:224:
In file included from ./cppparser.hpp:22:
In file included from ./cppchecker.hpp:22:
./cpp.hpp:564:3: fatal error: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
struct {const Type* elementType; CPP::Unsigned bound;} array;
^
1 error generated.
make: *** [makefile:671: tools/cpparma32.o] Error 1
Updated by Florian Negele over 2 years ago
Please remove -Werror from the makefile. That should at least compile.
Updated by Sergey Durmanov over 2 years ago
Yes, it worked (a lot of warnings), the ecsd starts, although nothing works because of the foreignness of the environment (there is also another elf interpreter). The problem is also that the link gcc to the clang is set and the compiler is defined as both gcc and clang)
Updated by Sergey Durmanov over 2 years ago
another problem: unname -m in termux for armeabi-v7a prints armv8l instead of armv7l and is not defined in the makefile.
Updated by Florian Negele over 2 years ago
That is only necessary for make to find its own environment. You can always use an explicit target like "make arma32linuxtarget" or "make arma64linuxtarget". I don't know whether the resulting binaries will run on termux, since I have not tested that system.
Updated by Sergey Durmanov over 2 years ago
I have installed android termux environvent for arm64 and will build make all. After build, utilities/ecsd, tools/obrun works. The simplest test module on Oberon is compiled/interpreted. The program outputted a string to the console (via TRACE, it was not possible to import the Out module)
Updated by Florian Negele over 2 years ago
The interpreter needs the source code of all imported modules [1]. Assuming you are using bash, use the following command:
tools/obrun libraries/oberon/{math,out}.mod test.mod
Updated by Florian Negele over 2 years ago
I have installed termux using F-Droid [1] on android-x64 [2] using a Qemu virtual machine and could at least reproduce your build problems. uname naturally reports x86_64 so I am not quite sure what armv8l means. Android armeabi-v7a seems to be 32-bit only [3], but did I understand correctly that you were also successfully compiling/executing using arma64linux as target?
[1] https://f-droid.org/
[2] https://www.android-x86.org/
[3] https://developer.android.com/ndk/guides/abis#v7a
Updated by Sergey Durmanov over 2 years ago
Initially, I had a 32-bit version of termux (armeabi-v7a) installed on my Android(aarch64) mobile phone, since I use some programs for armv7. uname -m returns armv8l (maybe because it works on top of aarch64, but I'm not sure).
I then reinstalled termux using the arm64-v8a version of the package. And I build the ecs using make all (make arma64linux also works). uname -m returns aarch64.
New versions of termux are distributed via github:
https://github.com/termux/termux-app/releases
Updated by Florian Negele over 2 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
The newest version fixes the problems with clang-15, see Version 0.0.38 available. Make sure to select the correct toolchain when building:
make toolchain=clang