termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.33k stars 3.06k forks source link

[Bug]: g++/gcc cannot detect precompiled headers #18965

Closed redaHBZ0 closed 10 months ago

redaHBZ0 commented 10 months ago

Problem description

after precompiling a header and then compiling main.cpp with -H option, it looks like the precompiled header isn't even detected. there is also no time decrease in compiling.

I tried install ubuntu with proot-distro and g++/gcc worked fine, so its definetly a termux version bug.

What steps will reproduce the bug?

g++ header.hpp -Wall g++ main.cpp -H -Wall

What is the expected behavior?

detect the precompiled header

System information

termux-info:

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=26698
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_VERSION=0.118.0
TERMUX__USER_ID=0
Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://is.mirror.flokinet.net/termux/termux-main stable main
# root-repo (sources.list.d/root.list)
deb https://is.mirror.flokinet.net/termux/termux-root root stable
# x11-repo (sources.list.d/x11.list)
deb https://is.mirror.flokinet.net/termux/termux-x11 x11 main
Updatable packages:
termux-api/stable 0.58.0 arm [upgradable from: 0.57]
termux-tools version:
1.40.5
Android version:
9
Kernel build information:
Linux localhost 3.18.91-19993241 #1 SMP PREEMPT Fri Apr 16 19:35:47 KST 2021 armv8l Android
Device manufacturer:
samsung
Device model:
SM-J330G
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.api versionCode:51
com.termux.x11 versionCode:14
redaHBZ0 commented 10 months ago

this problem also exists with clang/clang++

twaik commented 10 months ago

Attach contents of both main.cpp and header.hpp...

twaik commented 10 months ago

And what do you mean by "precompiled headers"?

licy183 commented 10 months ago

This is not a bug of Termux. gcc and g++ are symlinks to clang and clang++. See https://clang.llvm.org/docs/PCHInternals.html for how to use PCH with clang.

redaHBZ0 commented 10 months ago

This is not a bug of Termux. gcc and g++ are symlinks to clang and clang++. See https://clang.llvm.org/docs/PCHInternals.html for how to use PCH with clang.

peglib.hpp is a header-only library. Why is clang++ giving this error while g++ isn't? Screenshot_20240113-140038_Termux

redaHBZ0 commented 10 months ago

Attach contents of both main.cpp and header.hpp...

main.cpp:

#include "peglib.hpp"

int main() {
        return 0;
}

peglib.hpp: (I changed file name to .hpp to remove g++ warning) https://github.com/yhirose/cpp-peglib/blob/master/peglib.h

redaHBZ0 commented 10 months ago

And what do you mean by "precompiled headers"?

If a file is taking too long to compile, you can speed up compile time by compiling the included headers like any other file, which generates header.h.pch or .gch depending on compiler, then the compiler will use the precompiled header to skip compilation of headers. make sure that the generated header.h.pch or .gch is in the same folder as header.h

sylirre commented 10 months ago

Why is clang++ giving this error while g++ isn't?

Because of different arguments.

g++ is alias to clang++

Screenshot_20240113-151556_Termux

licy183 commented 10 months ago

If you want to compile PCH, you should use clang/gcc -x c-header test.h -o test..h.gch for C language or clang++/g++ -x c++-header test.hpp -o test.hpp.gch for C++ language.

redaHBZ0 commented 10 months ago

If you want to compile PCH, you should use clang/gcc -x c-header test.h -o test..h.gch for C language or clang++/g++ -x c++-header test.hpp -o test.hpp.gch for C++ language.

that just brings us to the first problem. g++/clang++ does not detect the presence of peglib.hpp.gch. Screenshot_20240113-142544_Termux If it did, the output would look like this: Screenshot_20240113-142639_Termux

licy183 commented 10 months ago

I believe this output is clang-specific and not a bug.

sylirre commented 10 months ago

g++/clang++ does not detect the presence of peglib.hpp.gch.

https://stackoverflow.com/a/28868128

redaHBZ0 commented 10 months ago

I believe this output is clang-specific and not a bug.

Yep. its a clang problem, not a termux version problem. Maybe the command is wrong? Screenshot_20240113-143527_Termux

redaHBZ0 commented 10 months ago

g++/clang++ does not detect the presence of peglib.hpp.gch.

https://stackoverflow.com/a/28868128

please read other comments, that command doesnt work

sylirre commented 10 months ago

I'm aware of other comments, but that's the only way to use precompiled header with clang.

The error is Termux-specific and points to a different issue rather than this one.

You can try using -include-pch without -cc1.

Screenshot_20240113-162625_Termux

Or try including precompiled header directly in source file.

licy183 commented 10 months ago

I still think the output is clang-specific and I think the pch file is successfully included.

On ubuntu:

~/test-pch# clang++-12 main.cpp -H
. ./test.hpp
.. /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/iostream
... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/c++config.h
.... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/os_defines.h
..... /usr/include/features.h
...... /usr/include/stdc-predef.h
...... /usr/include/x86_64-linux-gnu/sys/cdefs.h
....... /usr/include/x86_64-linux-gnu/bits/wordsize.h
....... /usr/include/x86_64-linux-gnu/bits/long-double.h
...... /usr/include/x86_64-linux-gnu/gnu/stubs.h
....... /usr/include/x86_64-linux-gnu/gnu/stubs-64.h
.... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/cpu_defines.h
... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ostream
.... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ios
..... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/iosfwd
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stringfwd.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/memoryfwd.h
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/postypes.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cwchar
........ /usr/include/wchar.h
......... /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
......... /usr/include/x86_64-linux-gnu/bits/floatn.h
.......... /usr/include/x86_64-linux-gnu/bits/floatn-common.h
........... /usr/include/x86_64-linux-gnu/bits/long-double.h
......... /usr/lib/llvm-12/lib/clang/12.0.0/include/stddef.h
......... /usr/lib/llvm-12/lib/clang/12.0.0/include/stdarg.h
......... /usr/include/x86_64-linux-gnu/bits/wchar.h
......... /usr/include/x86_64-linux-gnu/bits/types/wint_t.h
......... /usr/include/x86_64-linux-gnu/bits/types/mbstate_t.h
.......... /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h
......... /usr/include/x86_64-linux-gnu/bits/types/__FILE.h
......... /usr/include/x86_64-linux-gnu/bits/types/FILE.h
......... /usr/include/x86_64-linux-gnu/bits/types/locale_t.h
.......... /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h
..... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/exception
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/exception.h
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/exception_ptr.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/exception_defines.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/cxxabi_init_exception.h
........ /usr/lib/llvm-12/lib/clang/12.0.0/include/stddef.h
......... /usr/lib/llvm-12/lib/clang/12.0.0/include/__stddef_max_align_t.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/typeinfo
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/hash_bytes.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/new
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/exception
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/nested_exception.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/move.h
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/concept_check.h
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/type_traits
..... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/char_traits.h
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_algobase.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/functexcept.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/cpp_type_traits.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ext/type_traits.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ext/numeric_traits.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_pair.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_iterator_base_types.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_iterator_base_funcs.h
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/debug/assertions.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_iterator.h
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/ptr_traits.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/debug/debug.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/predefined_ops.h
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cwchar
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cstdint
....... /usr/lib/llvm-12/lib/clang/12.0.0/include/stdint.h
........ /usr/include/stdint.h
......... /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
......... /usr/include/x86_64-linux-gnu/bits/types.h
.......... /usr/include/x86_64-linux-gnu/bits/wordsize.h
.......... /usr/include/x86_64-linux-gnu/bits/timesize.h
.......... /usr/include/x86_64-linux-gnu/bits/typesizes.h
.......... /usr/include/x86_64-linux-gnu/bits/time64.h
......... /usr/include/x86_64-linux-gnu/bits/wordsize.h
......... /usr/include/x86_64-linux-gnu/bits/stdint-intn.h
......... /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h
..... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/localefwd.h
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/c++locale.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/clocale
........ /usr/include/locale.h
......... /usr/lib/llvm-12/lib/clang/12.0.0/include/stddef.h
......... /usr/include/x86_64-linux-gnu/bits/locale.h
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cctype
....... /usr/include/ctype.h
........ /usr/include/x86_64-linux-gnu/bits/endian.h
......... /usr/include/x86_64-linux-gnu/bits/endianness.h
..... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/ios_base.h
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ext/atomicity.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/gthr.h
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/gthr-default.h
......... /usr/include/pthread.h
.......... /usr/include/sched.h
........... /usr/lib/llvm-12/lib/clang/12.0.0/include/stddef.h
........... /usr/include/x86_64-linux-gnu/bits/types/time_t.h
........... /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h
........... /usr/include/x86_64-linux-gnu/bits/sched.h
............ /usr/include/x86_64-linux-gnu/bits/types/struct_sched_param.h
........... /usr/include/x86_64-linux-gnu/bits/cpu-set.h
.......... /usr/include/time.h
........... /usr/lib/llvm-12/lib/clang/12.0.0/include/stddef.h
........... /usr/include/x86_64-linux-gnu/bits/time.h
............ /usr/include/x86_64-linux-gnu/bits/timex.h
............. /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h
........... /usr/include/x86_64-linux-gnu/bits/types/clock_t.h
........... /usr/include/x86_64-linux-gnu/bits/types/struct_tm.h
........... /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h
........... /usr/include/x86_64-linux-gnu/bits/types/timer_t.h
........... /usr/include/x86_64-linux-gnu/bits/types/struct_itimerspec.h
.......... /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h
........... /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h
............ /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h
............. /usr/include/x86_64-linux-gnu/bits/wordsize.h
............ /usr/include/x86_64-linux-gnu/bits/struct_mutex.h
............ /usr/include/x86_64-linux-gnu/bits/struct_rwlock.h
.......... /usr/include/x86_64-linux-gnu/bits/setjmp.h
........... /usr/include/x86_64-linux-gnu/bits/wordsize.h
.......... /usr/include/x86_64-linux-gnu/bits/wordsize.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/atomic_word.h
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/locale_classes.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/string
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/allocator.h
......... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/c++allocator.h
.......... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ext/new_allocator.h
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/ostream_insert.h
......... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/cxxabi_forced.h
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_function.h
......... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/backward/binders.h
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/range_access.h
......... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/initializer_list
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/basic_string.h
......... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ext/alloc_traits.h
.......... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/alloc_traits.h
......... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ext/string_conversions.h
.......... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cstdlib
........... /usr/include/stdlib.h
............ /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
............ /usr/lib/llvm-12/lib/clang/12.0.0/include/stddef.h
............ /usr/include/x86_64-linux-gnu/bits/waitflags.h
............ /usr/include/x86_64-linux-gnu/bits/waitstatus.h
............ /usr/include/x86_64-linux-gnu/sys/types.h
............. /usr/lib/llvm-12/lib/clang/12.0.0/include/stddef.h
............. /usr/include/endian.h
.............. /usr/include/x86_64-linux-gnu/bits/byteswap.h
.............. /usr/include/x86_64-linux-gnu/bits/uintn-identity.h
............. /usr/include/x86_64-linux-gnu/sys/select.h
.............. /usr/include/x86_64-linux-gnu/bits/select.h
............... /usr/include/x86_64-linux-gnu/bits/wordsize.h
.............. /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h
............... /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h
............ /usr/include/alloca.h
............. /usr/lib/llvm-12/lib/clang/12.0.0/include/stddef.h
............ /usr/include/x86_64-linux-gnu/bits/stdlib-float.h
........... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_abs.h
.......... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cwchar
.......... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cstdio
........... /usr/include/stdio.h
............ /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
............ /usr/lib/llvm-12/lib/clang/12.0.0/include/stddef.h
............ /usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h
............ /usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h
............ /usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h
............ /usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h
............ /usr/include/x86_64-linux-gnu/bits/stdio_lim.h
............ /usr/include/x86_64-linux-gnu/bits/sys_errlist.h
.......... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cerrno
........... /usr/include/errno.h
............ /usr/include/x86_64-linux-gnu/bits/errno.h
............. /usr/include/linux/errno.h
.............. /usr/include/x86_64-linux-gnu/asm/errno.h
............... /usr/include/asm-generic/errno.h
................ /usr/include/asm-generic/errno-base.h
............ /usr/include/x86_64-linux-gnu/bits/types/error_t.h
......... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/functional_hash.h
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/basic_string.tcc
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/locale_classes.tcc
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/system_error
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/error_constants.h
........ /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cerrno
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/stdexcept
..... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/streambuf
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/streambuf.tcc
..... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/basic_ios.h
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/locale_facets.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cwctype
........ /usr/include/wctype.h
......... /usr/include/x86_64-linux-gnu/bits/wctype-wchar.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/cctype
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/ctype_base.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/streambuf_iterator.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/ctype_inline.h
....... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/locale_facets.tcc
...... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/basic_ios.tcc
.... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/ostream.tcc
... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/istream
.... /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/istream.tcc
sylirre commented 10 months ago

@licy183 strace doesn't confirm that precompiled header is included/read/accessed by Termux clang.

-include-pch is needed.

redaHBZ0 commented 10 months ago

I confirm that adding -include-pch reduced compile time. Screenshot_20240113-160803_Termux However, I will use g++ inside ubuntu because the compilation time is way faster. Screenshot_20240113-160503_Termux

Which brings me to ask: can you add the real gcc/g++ to Termux as a package? having to install ubuntu just for g++/gcc is a hassle.

redaHBZ0 commented 10 months ago

I also belive that gcc/g++ being symlinks to clang/clang++ can generate confusion and errors. What if a shell script uses gcc/g++ specific options?

sylirre commented 10 months ago

What if a shell script uses gcc/g++ specific options?

Clang tends to add as much as possible gcc options for compatibility. As far I know, we never had issues from this side and lack of gcc and g++ symlinks brings more problems than solves - it's common gcc/g++ is hardcoded in makefiles.

If there is a gcc option not supported/implemented in clang, I believe that its usage extremely rare.

But behavior of clang and gcc differ and this can cause issues. Although if clang can't compile something, this usually indicate problems with code rather than with compiler. Just clang is much more stricter than gcc.

redaHBZ0 commented 10 months ago

I see. But why is g++ compilation significantly faster than clang++ in this case? would that imply faster code?

sylirre commented 10 months ago

In Termux g++ and clang++ are same utility. IDK what you are referring too.

Screenshot_20240113-190514_Termux

(Note: don't consider deviations less than 0.1 second as sign of performance difference.)

Real GCC would give different result. Clang is LLVM frontend and its machine code generation procedure is different from GCC.

redaHBZ0 commented 10 months ago

i am referring to Termux's clang++ and proot ubuntu's g++ https://github.com/termux/termux-packages/issues/18965#issuecomment-1890483635

sylirre commented 10 months ago

20-30 seconds compilation time is not normal.

With peglib hpp and code from https://github.com/termux/termux-packages/issues/18965#issuecomment-1890453542 I can't get more than 5s.

redaHBZ0 commented 10 months ago

Do you think something is wrong with clang on my device?

i also tried with clang inside ubuntu, and it gave me same result as Termux's.

I have always felt compilation time was slow with termux. Would it be possible that my device is too slow? I can give the specs if needed. My device is rooted BTW