Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

building for termux on android #746

Open
numberokta opened this issue Apr 19, 2024 · 4 comments
Open

building for termux on android #746

numberokta opened this issue Apr 19, 2024 · 4 comments
Labels
buildfail Does not compile duplicate This issue or pull request already exists

Comments

@numberokta
Copy link

numberokta commented Apr 19, 2024

I want to build ksh93 for termux on android but it gives me this error (compiling with clang)

+ cc -D_BLD_DLL -fPIC -D_BLD_ast -Os -I. -I/data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/src/lib/libast -Icomp -I/data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/src/lib/libast/comp -Iinclude -I/data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/src/lib/libast/include -Istd -I/data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/src/lib/libast/std -c /data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/src/lib/libast/comp/catopen.c
/data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/src/lib/libast/comp/catopen.c:103:17: error: call to undeclared function 'catopen'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  103 |                 if (s && (d = catopen(s, flag)) != (nl_catd)(-1) || !(s = 0) && (d = catopen(name, flag)) != (nl_catd)(-1))
      |                               ^
/data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/src/lib/libast/comp/catopen.c:103:15: error: incompatible integer to pointer conversion assigning to 'nl_catd' (aka 'void *') from 'int' [-Wint-conversion]
  103 |                 if (s && (d = catopen(s, flag)) != (nl_catd)(-1) || !(s = 0) && (d = catopen(name, flag)) != (nl_catd)(-1))
      |                             ^ ~~~~~~~~~~~~~~~~
/data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/src/lib/libast/comp/catopen.c:103:70: error: incompatible integer to pointer conversion assigning to 'nl_catd' (aka 'void *') from 'int' [-Wint-conversion]
  103 |                 if (s && (d = catopen(s, flag)) != (nl_catd)(-1) || !(s = 0) && (d = catopen(name, flag)) != (nl_catd)(-1))
      |                                                                                    ^ ~~~~~~~~~~~~~~~~~~~
/data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/src/lib/libast/comp/catopen.c:107:5: error: call to undeclared function 'catclose'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  107 |                                 catclose(d);
      |                                 ^
/data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/src/lib/libast/comp/catopen.c:115:6: error: call to undeclared function 'catclose'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  115 |                                         catclose(d);
      |                                         ^
/data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/src/lib/libast/comp/catopen.c:148:16: error: call to undeclared function 'catgets'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  148 |                 msg = (char*)catgets(((Cc_t*)cat)->cat, set, num, msg);
      |                              ^
/data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/src/lib/libast/comp/catopen.c:148:9: warning: cast to 'char *' from smaller integer type 'int' [-Wint-to-pointer-cast]
  148 |                 msg = (char*)catgets(((Cc_t*)cat)->cat, set, num, msg);
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/src/lib/libast/comp/catopen.c:175:10: error: call to undeclared function 'catclose'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  175 |                 return catclose(((Cc_t*)cat)->cat);
      |                        ^
1 warning and 7 errors generated.
mamake [lib/libast]: *** exit code 1 making catopen.o
mamake: *** exit code 1 making lib/libast
mamake: *** exit code 1 making all
package: make failed at Fri Apr 19 11:14:10 +0330 2024 in /data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh-1.0.8/arch/linux.arm64-64

See full build log here

@McDutchie
Copy link

Thanks for the report. This should already have been fixed in commit c3fec93, so the upcoming 1.0.9 release should build on Termux. In the meantime, please try building the current git code and let me know if it works for you:

git clone -b 1.0 https://github.com/ksh93/ksh
cd ksh
bin/package make
bin/package use

@McDutchie McDutchie added duplicate This issue or pull request already exists buildfail Does not compile labels Apr 19, 2024
@numberokta
Copy link
Author

Thanks for your replay, I tested that and it gives this error

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: libandroid_shmget
>>> referenced by /data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh/arch/android.arm64-64/dyn/lib/libast.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: libandroid_shmat
>>> referenced by /data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh/arch/android.arm64-64/dyn/lib/libast.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: libandroid_shmdt
>>> referenced by /data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh/arch/android.arm64-64/dyn/lib/libast.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: libandroid_shmctl
>>> referenced by /data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh/arch/android.arm64-64/dyn/lib/libast.so
cc: error: linker command failed with exit code 1 (use -v to see invocation)
mamake [cmd/builtin]: *** exit code 1 making /data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh/arch/android.arm64-64/dyn/bin/pty
mamake: *** exit code 1 making cmd/builtin
mamake: *** exit code 1 making all
package: make failed at Fri Apr 19 19:08:06 +0330 2024 in /data/data/com.termux/files/home/neuctl/build/termux/ksh/ksh/arch/android.arm64-64

@McDutchie
Copy link

McDutchie commented Apr 19, 2024

Strange. I cannot reproduce that at all. :(

What Android version are you using, and what version of termux, and what version of clang, and did you set CCFLAGS and/or LDFLAGS, and if so, to what values?

@numberokta
Copy link
Author

That error happened on Termux 0.118.0+8e3a898
Now i tested with this
Android 13
Termux 0.118.0+2f40df9
env: TERMUX_APP__TARGET_SDK="28"

clang -v
Clang version 18.1.3
Target: aarch64-unknown-linux-android24
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin

I didn't set CCFLAGS and/or LDFLAGS
It gives me error (log file)
I think the issue is related to the target because i saw --target=armv8l-linux-android26 in log file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buildfail Does not compile duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants