这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@phcoder
Copy link
Contributor

@phcoder phcoder commented Aug 7, 2017

Full clang allows to have cross-compilations to other architectures

@phcoder
Copy link
Contributor Author

phcoder commented Aug 7, 2017

The failure is due to time limit

@fornwall
Copy link
Member

I guess this would need some other additions (like binutils) as well to be useful?

How large is the size increase in the package of enabling all targets? If it's not too big we could enable it in the normal clang/llvm package without splitting it up.

@phcoder
Copy link
Contributor Author

phcoder commented Aug 10, 2017

This makes libllvm about 3MiB larger. Other package sizes are unchanged. Yes, you're right, it's too small to be worth the hassle of splitted packages. Clang has integrated assembled and I'm working on adding lld, so that we have a linker for all the platforms. This is enough to compile standalone programs like libc, kernels and bootloaders (my goal, to use with qemu) but for userspace additional work would be required. I'll remake the branch

@phcoder phcoder force-pushed the crossclang branch 2 times, most recently from ba1b116 to 271ec20 Compare August 11, 2017 17:19
@phcoder
Copy link
Contributor Author

phcoder commented Aug 26, 2017

I updated this pull request. Now it has LLD and doesn't split anymore. I was able to compile GRUB on my phone with this (+update to svn snapshot of llvm which is subject of separate pull request)
BTW: could you have a look at your emails, thanks

patc allows clang to be used in cross-compilations. E.g. to compile 32-bit
binaries on 64-bit termux.
LLD is LLVM-based multi-platform linker. Together with cross-compiling
clang it can be used to create binaries for other platforms.
It allows compiling binaries for another android variant on termux.

E.g. to compile for arm on aarch64 do:

clang -m32 -o 1 1.c -fuse-ld=lld -L/system/lib -B$PREFIX/arm-linux-androideabi/lib

Hopefully with the time -L and -B will be eliminated
@joakim-noah
Copy link
Contributor

Nice work, I especially like the lld inclusion, which should finally obsolete binutils.

I want to try out cross-compiling for desktop/server platforms too, like Windows/x64 or linux/x64, whereas you seem to focus on other Android platforms with this pull. Do you know how much more would need to be added to get small desktop/server C executables built with the clang from this pull?

@phcoder
Copy link
Contributor Author

phcoder commented Sep 13, 2017

I don't think we can deprecate binutils just yet. Binutils has nm, objdump and strip. Later is needed by some programs to compile. As for desktop/server executables you needs libs and includes for the platform in question

@joakim-noah
Copy link
Contributor

I can get the libs and platform includes, especially easy for linux, and I guess the compiler includes should all be there because we're just building stock clang, not the NDK clang. I'll try it sometime.

@phcoder
Copy link
Contributor Author

phcoder commented Nov 10, 2017

Ping?

@shawnl
Copy link
Contributor

shawnl commented Nov 12, 2017

I want this for to make distccd useful (distcc is already useful, and easy to build)

@shawnl shawnl mentioned this pull request Nov 12, 2017
@fornwall fornwall merged commit 79191bb into termux:master Nov 16, 2017
@fornwall
Copy link
Member

@phcoder Thanks and sorry for the delay here! The updated llvm and clang packages are now available for installation (update with pkg up) at version 5.0.0-1.

@shawnl
Copy link
Contributor

shawnl commented Nov 17, 2017

$ clang
CANNOT LINK EXECUTABLE "clang": cannot locate symbol "LLVMInitializeAArch64TargetInfo" referenced by "/data/data/com.termux/files/usr/bin/clang-5.0"...
Aborted

@shawnl
Copy link
Contributor

shawnl commented Nov 17, 2017

This is on armv7 (32-bit)

@joakim-noah
Copy link
Contributor

joakim-noah commented Nov 17, 2017

Are you sure you have the latest clang? Seems to work for me.

Try running these two commands:

apt install binutils

readelf -sW ~/../usr/lib/libLLVM-5.0.0.so | grep LLVMInitializeAArch64TargetInfo

If you get a FUNC symbol defined after that, it's there.

@shawnl
Copy link
Contributor

shawnl commented Nov 18, 2017 via email

@fornwall
Copy link
Member

@shawnl No problem. Currently Termux package updated are very laxy with version qualifiers, generally assuming that all dependencies are at their latest versions. So the current best practice is to always update all packages (pkg up) instead of updating a single package (and also to update all packages before installing a new package).

@shawnl
Copy link
Contributor

shawnl commented Nov 19, 2017

Works with distcc #1785

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants