Linuxbrew / brew

:beer::penguin: The Homebrew package manager for Linux
https://linuxbrew.sh
BSD 2-Clause "Simplified" License
2.66k stars 237 forks source link

Android dynamic linker doesn't support DT_RPATH #598

Closed bukzor closed 6 years ago

bukzor commented 6 years ago

I've been tinkering with getting Linuxbrew working under termux under Android under Chromebook. The final missing link is that the android linker has absolutely no support for rpath.

How would I go about instructing homebrew to use --enable-new-dtags when compiling for Android? This will cause it to create runpath entries, which the android linker does support.

I would propose we do this (--enable-new-dtags) for all of homebrew, if I had any idea of whether it would work, or what the effect would be.

sjackman commented 6 years ago

Check out this wiki page: https://github.com/Linuxbrew/brew/wiki/Chromebook-Install-Instructions I've never run Linuxbrew on Chromebook, and these instructions may be out of date.

sjackman commented 6 years ago

Wow. I had no idea that ld use RPATH by default. I assumed that is used RUNPATH. Thanks for teaching me something!

We use patchelf to modify the RPATH of installed binaries, and by default it changes RPATH to RUNPATH. So, executables installed from source will use RPATH and executables in poured bottles use RUNPATH. That's inconsistent and a bit weird. I prefer the behaviour of RPATH which overrides LD_LIBRARY_PATH. An incorrectly set LD_LIBRARY_PATH can break Linuxbrew executables. patchelf has an option --force-rpath to use RPATH than RUNPATH.

I'm surprised that Android OS doesn't support RPATH. Is that documented somewhere?

sjackman commented 6 years ago

See https://github.com/termux/termux-packages/issues/2071#issuecomment-364566718

bukzor commented 6 years ago

Apologies for the wallotext. I got excited.

1) @sjackman Thanks for the replies! I didn't notice them till now D: Could you advice me on the original question? How do I add an Android homebrew flavor that uses CFLAGS=-Wl,--enable-new-dtags?

2) If I set up a github repo that, when run in circleci, allows you to ssh to Android, would you use it? It would take me several hours to get it running smoothly, but I don't mind.

3) Although I personally have no opinion on RPATH vs RUNPATH, these are facts: All upstream maintainers prefer RUNPATH, and RPATH has been "deprecated" for ten years. Today, both Ubuntu and Arch compilers use RUNPATH by default, and of course the Android linker has no RPATH support. See also the patchelf default behavior. I believe their argument goes: LD_LIBRARY_PATH "should" be a user override for the linker, and RPATH was a design mistake.

Given that bottles use RUNPATH already, is that sufficient to prove that using RUNPATH rather than RPATH works fine for both Linuxbrew and the wider Homebrew? IMHO it would be a smart choice from a future-proofing perspective, but again, I don't feel strongly. I just want Linuxbrew for Android!

4) Re the Linuxbrew-chromebook wiki: It requires switching to dev mode which isn't an option for me, as I want to maintain corporate trust on this machine.

sjackman commented 6 years ago

How do I add an Android homebrew flavor that uses CFLAGS=-Wl,--enable-new-dtags?

For now, modify this code to add -Wl,--enable-new-dtags. Once you get it working, open a PR, and we can talk about how to get it into Linuxbrew.

https://github.com/Linuxbrew/brew/blob/8ccb999ac04fa9fcb4df521004be5eeff9fd8ba6/Library/Homebrew/shims/linux/super/cc#L258

If I set up a github repo that, when run in circleci, allows you to ssh to Android, would you use it?

As much as I'd like to say yes, I'm afraid that I don't have the time to take on this project myself. I'm happy to answer questions though.

I believe their argument goes: LD_LIBRARY_PATH "should" be a user override for the linker, and RPATH was a design mistake.

I do understand the argument. For the purposes of Linuxbrew, however, I prefer RPATH to RUNPATH, because of how LD_LIBRARY_PATH is often used on high performance computing (HPC) systems. It's common to have LD_LIBRARY_PATH set globally (which in my opinion should never ever be done) to specify the locations of the system's compiler libraries, OpenBLAS, and other such libraries. Setting LD_LIBRARY_PATH in this way would however break all of the Linuxbrew executables, which would then use the HPC system libraries rather than the Linuxbrew libraries. That breakage is not what the user desires. Unsetting LD_LIBRARY_PATH would mean that all of the host executables would stop working. The only solution that I see is to use RPATH rather than RUNPATH so that Linuxbrew executables ignore LD_LIBRARY_PATH (which shouldn't be set anyway, but here we are).

Re the Linuxbrew-chromebook wiki: It requires switching to dev mode which isn't an option for me, as I want to maintain corporate trust on this machine.

Feel free to update the Linuxbrew Wiki with instructions that do not require dev mode. That'd be quite useful I think to other Android users.

bukzor commented 6 years ago

Once you get it working, open a PR, and we can talk about how to get it into Linuxbrew.

Can do! :meseeks:

LD_LIBRARY_PATH is often used on high performance computing (HPC) systems.

You'll have an easier time convincing the HPC maintainers to switch to the (demonstrably better) system of using --prefix or rpath than to reverse the rpath->runpath migration. Again, I don't myself have any opinion on the matter, but those are facts. I maintained the blas/lapack installation at ATI (AMD), and I did it using --prefix. I think that qualifies as HPC? I maintained a whole bunch of shell scripts with inlined patches which amounted to a poor man's linuxbrew. It's why I'm excited about Linuxbrew.

Feel free to update the Linuxbrew Wiki with instructions that do not require dev mode. That'd be quite useful I think to other Android users.

This ticket is blocks such a thing from existing :D I'll do such when I get it working.

sjackman commented 6 years ago

Can do! :meseeks:

Great!

You'll have an easier time convincing the HPC maintainers to switch

I don't unfortunately have the time to convince each HPC admin to stop globally setting LD_LIBRARY_PATH, and its use is widespread. I agree that using either RPATH or RUNPATH is miles better than setting LD_LIBRARY_PATH globally.

system of using --prefix

I'm not sure what you mean by this exactly. Using ./configure --prefix doesn't usually set the RPATH/RUNPATH of an executable. There are exceptions of course, but it's not the default behaviour.

than to reverse the rpath->runpath migration

Since RUNPATH is still not the default behaviour of ld, it look to me as though that migration is ongoing.

It's why I'm excited about Linuxbrew.

Great! ☺️

emanresusername commented 6 years ago

@sjackman continuing from this thread

sadly i don't think it adds much to the investigation

brew install -s hello || brew gist-logs hello
Updating Homebrew...
CANNOT LINK EXECUTABLE "/usr/bin/gcc-7": library "libandroid-support.so" not found
CANNOT LINK EXECUTABLE "/usr/bin/clang": library "libLLVM-5.0.so" not found
Error: hello cannot be built with any available compilers.
Install Clang or brew install gcc
Error: No logs.

you were right, it was undoing my changes in brew update (just put exit 0 at the top of update.sh locally) but then even after that no change :(

i did notice that when i put a random println in /data/data/com.termux/files/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super/cc

near this patch, it never got printed, maybe there a different file i should be modifying or some other interaction in the ecosystem i'm not accounting for?

sjackman commented 6 years ago

Try…

export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_ENV_FILTERING=1
emanresusername commented 6 years ago

no dice :cry:

but just as a sanity check, i put a exit 1 right at the top of this script and it didn't seem to affect anything

is there maybe something upstream that's looking at the $OSTYPE and linux-android doesn't match so it doesn't make it into .../linux/super/cc or something like that?

sjackman commented 6 years ago

Try…

❯❯❯ brew irb <<<'superenv?'
#<Pathname:/home/sjackman/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super>

See https://github.com/Linuxbrew/brew/blob/294f3392fefc6335b24730dd981d13826e204ea8/Library/Homebrew/extend/ENV.rb#L6-L8

emanresusername commented 6 years ago

Yeah that seems right

rb(main):002:0> superenv?
=> #<Pathname:/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super>

Maybe just the ldflags method isn't getting called?

sjackman commented 6 years ago

Check the files ~/.cache/Homebrew/Logs/hello/*.cc to see what superenv did or didn't do. What error message are you seeing with brew install -s hello ?

emanresusername commented 6 years ago

Same output from brew install -s hello as here But interestingly there's no ~/.cache/Homebrew/Logs at all 😲 Any other directories to check or might we be venturing into termux/termux-chroot specific special behavior?

# UPDATE: output from `brew install -sd hello`
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/hello.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::AliasLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/perkeep.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/build.rb (Formulary::FromPathLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/hello.rb
CANNOT LINK EXECUTABLE "/usr/bin/gcc-7": library "libandroid-support.so" not found
CANNOT LINK EXECUTABLE "/usr/bin/clang": library "libLLVM-5.0.so" not found
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/build.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/llvm.rb
Error: hello cannot be built with any available compilers.
Install Clang or brew install gcc
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/compilers.rb:127:in `compiler'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/compilers.rb:109:in `select_for'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/ENV/shared.rb:176:in `compiler'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/ENV/super.rb:40:in `setup_build_environment'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/build.rb:85:in `install'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/build.rb:202:in `<main>'
sjackman commented 6 years ago

Use…

export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_ENV_FILTERING=1

and remove LD_LIBRARY_PATH from here: https://github.com/Linuxbrew/brew/blob/ed30aa3789a127f03b8fffe07ee1391550797ec4/Library/Homebrew/extend/ENV/shared.rb#L28

emanresusername commented 6 years ago

aww yiss. motha! fuckin! progress! s/breadcrumbs/progress/

/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/hello.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::AliasLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/perkeep.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/build.rb (Formulary::FromPathLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/hello.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/build.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/binutils.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/build.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/make.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/build.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/python.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/build.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gcc.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/build.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/glibc.rb
==> Downloading https://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz
####################################################################################################################################### 100.0%
tar: gzip: Cannot exec: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Error: Failure while executing: tar xzf /home/.cache/Homebrew/hello-2.10.tar.gz
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/utils.rb:296:in `safe_system'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/download_strategy.rb:77:in `safe_system'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/download_strategy.rb:239:in `stage'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/resource.rb:115:in `block in unpack'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/fileutils.rb:14:in `block in mktemp'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/fileutils.rb:74:in `block in run'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/fileutils.rb:74:in `chdir'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/fileutils.rb:74:in `run'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/fileutils.rb:13:in `mktemp'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/resource.rb:114:in `unpack'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/resource.rb:92:in `stage'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:1872:in `stage'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:1090:in `brew'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/build.rb:124:in `block in install'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/utils.rb:554:in `with_env'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/build.rb:121:in `install'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/build.rb:202:in `<main>'

... then pkg install gzip ... then

Already downloaded: /home/.cache/Homebrew/hello-2.10.tar.gz
==> ./configure --disable-silent-rules --prefix=/data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10
Last 15 lines from /home/.cache/Homebrew/Logs/hello/01.configure:
configure: WARNING: unrecognized options: --disable-debug
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... no
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc-7
checking whether the C compiler works... no
configure: error: in `/usr/tmp/hello-20180215-3532-do4wrh/hello-2.10':
configure: error: C compiler cannot create executables
See `config.log' for more details
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/debrew.rb:11:in `raise'
FormulaUnavailableError: No available formula with the name "xorg"
1. raise
2. ignore
3. backtrace
4. irb
5. shell
Choose an action:

(awaiting my input ... what do i do?!?)

sjackman commented 6 years ago

😂

sjackman commented 6 years ago

Please report the output of…

brew install -s hello
brew gist-logs hello
emanresusername commented 6 years ago

https://gist.github.com/anonymous/b4b0ffe4cb58771ff4489ac0186a3c57 (i still have some of the random exit 1 and throw "this error if you ever execute this" changes in linux/super/cc (as well as the original --enable-new-dtags patch), doesn't seem like those are affecting anything, should i remove them all anyway?

sjackman commented 6 years ago

I was hoping that there'd be a useful error message in config.log, but no such luck. Just this:

configure:4014: checking whether the C compiler works
configure:4036: gcc-7    conftest.c  >&5
configure:4040: $? = 1
configure:4078: result: no

https://gist.github.com/anonymous/b4b0ffe4cb58771ff4489ac0186a3c57#file-config-log-L71

I'd suggest starting an interactive Brew shell with brew sh and trying to compile a simple program like "Hello, world!" in that shell, and see if it works.

I see that Termux sets LD_PRELOAD.

Warning: Setting LD_* vars can break dynamic linking.
Set variables:
  LD_LIBRARY_PATH: /data/data/com.termux/files/usr/lib
  LD_PRELOAD: /data/data/com.termux/files/usr/lib/libtermux-exec.so

https://gist.github.com/anonymous/b4b0ffe4cb58771ff4489ac0186a3c57#file-00-doctor-out-L8

Try removing LD_LIBRARY_PATH and LD_PRELOAD from this list: https://github.com/Linuxbrew/brew/blob/ed30aa3789a127f03b8fffe07ee1391550797ec4/Library/Homebrew/extend/ENV/shared.rb#L28

sjackman commented 6 years ago

You'll likely also have to add /data/data/com.termux/files/usr/lib to Linuxbrew's list of RPATH. https://github.com/Linuxbrew/brew/blob/80394bd391d5dc6d2cd7f8f1f0576a8eb5c2ebe1/Library/Homebrew/extend/os/linux/extend/ENV/super.rb#L41

emanresusername commented 6 years ago

good news

more progress!

bad news

brew sh wasn't happy :(

Your shell has been configured to use Homebrew's build environment;
this should help you build stuff. Notably though, the system versions of
gem and pip will ignore our configuration and insist on using the
environment they were built under (mostly). Sadly, scons will also
ignore our configuration.
When done, type `exit'.
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super/git: line 88: which: command not found
zsh: segmentation fault

news ?

this might be relevant to it not finding awk and which?

termux-chroot "which which awk"
/data/data/com.termux/files/usr/bin/applets/which
/data/data/com.termux/files/usr/bin/applets/awk

but the PATH doesn't include /data/data/com.termux/files/usr/bin/applets 🤔

sjackman commented 6 years ago

Scientific progress goes boink

sjackman commented 6 years ago

With export HOMEBREW_NO_ENV_FILTERING=1 your PATH should be preserved. See https://github.com/Linuxbrew/brew/blob/80394bd391d5dc6d2cd7f8f1f0576a8eb5c2ebe1/bin/brew#L67-L69

That should get you past ./config.status: 1790: ./config.status: awk: not found

zsh: segmentation fault

¯\_(ツ)_/¯ What does /bin/sh point to? Can you use a shell other than zsh to get past this error?

emanresusername commented 6 years ago

hrm something's not coming through, is there some other env var to set, or somewhere i can hardcode/patch in the applets to the PATH? 🤔

(
> export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_ENV_FILTERING=1
> echo $PATH
> brew --env
> )
/data/data/com.termux/files/home/linuxbrew/.linuxbrew/bin:/data/data/com.termux/files/home/linuxbrew/.linuxbrew/sbin:/data/data/com.termux/files/home/.zplug/repos/zplug/zplug/bin:/data/data/com.termux/files/home/.zplug/bin:/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/data/data/com.termux/files/home/linuxbrew/.linuxbrew/bin:/data/data/com.termux/files/home/linuxbrew/.linuxbrew/sbin
HOMEBREW_CC: cc
HOMEBREW_CXX: c++
MAKEFLAGS: -j1
CMAKE_PREFIX_PATH: /data/data/com.termux/files/home/linuxbrew/.linuxbrew
HOMEBREW_GIT: /data/data/com.termux/files/usr/bin/git
GIT: /data/data/com.termux/files/usr/bin/git
PATH: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super:/usr/bin:/bin
LD_LIBRARY_PATH: /data/data/com.termux/files/usr/lib
LD_PRELOAD: /data/data/com.termux/files/usr/lib/libtermux-exec.so
sjackman commented 6 years ago

Add /data/data/com.termux/files/usr/bin/applets to here: https://github.com/Linuxbrew/brew/blob/80394bd391d5dc6d2cd7f8f1f0576a8eb5c2ebe1/Library/Homebrew/extend/os/linux/extend/ENV/super.rb#L16-L17

emanresusername commented 6 years ago

even MOAR progress!! looks like something with different/busybox versions of ar ?

sjackman commented 6 years ago

Woohoo! I sense that we're getting close… I'd suggest using ar from binutils rather than busybox. Try pkg install binutils (assuming termux provides binutils. I have no idea.)

emanresusername commented 6 years ago

FTR: the binuitls version was there already, but the busybox version is in the applets dir i added to the homebrew_extra_paths and looks like those get prepended to PATH? just added /data/data/com.termux/files/usr/bin to the front for now. is there a similar function that appends the paths to PATH?

emanresusername commented 6 years ago

so close!

brew install -s hello 
==> Downloading https://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz
Already downloaded: /home/.cache/Homebrew/hello-2.10.tar.gz
==> ./configure --disable-silent-rules --prefix=/data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10
==> make install
\U0001f37a  /data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10: 11 files, 211.1KB, built in 10 minutes 9 seconds
# awwwww yeah!
hello 
WARNING: linker: /data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10/bin/hello: unused DT entry: type 0xf arg 0x13d
Segmentation fault
# FFFFFFFUUUUUUUUUUUU
sjackman commented 6 years ago

This issue is going to go down in Linuxbrew history. 😹

sjackman commented 6 years ago
hello: unused DT entry: type 0xf arg 0x13d

Type 0xf is DT_RPATH, so it looks like it's using RPATH rather than RUNPATH as desired for Android. brew gist-logs hello and we'll see if Superenv was doing its job properly. Try also…

brew linkage hello
brew linkage --reverse hello
ldd /data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10/bin/hello
readelf -d /data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10/bin/hello | egrep 'NEEDED|RPATH|RUNPATH'
readelf -l /data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10/bin/hello | grep interpreter
emanresusername commented 6 years ago

gist-logs

(                                                                                              \ue0b2 \u2714 \ue0b2 317 \ue0b2 15:12:50 
subsh> brew linkage hello
brew linkage --reverse hello
ldd /data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10/bin/hello
readelf -d /data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10/bin/hello | egrep 'NEEDED|RPATH|RUNPATH'
readelf -l /data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10/bin/hello | grep interpreter
subsh> )
libc.so
libdl.so
 0x0000000000000001 (NEEDED)             Shared library: [libc.so]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so]
 0x000000000000000f (RPATH)              Library rpath: [/data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10/lib:/data/data/com.termux/files/home/linuxbrew/.linuxbrew/lib:/data/data/com.termux/files/usr/lib]
      [Requesting program interpreter: /data/data/com.termux/files/home/linuxbrew/.linuxbrew/lib/ld.so]
sjackman commented 6 years ago
superenv added:    -isystem/data/data/com.termux/files/home/linuxbrew/.linuxbrew/include -Wl,--dynamic-linker=/data/data/com.termux/files/home/linuxbrew/.linuxbrew/lib/ld.so -B/data/data/com.termux/files/home/linuxbrew/.linuxbrew/opt/glibc/lib -L/data/data/com.termux/files/home/linuxbrew/.linuxbrew/lib -Wl,-rpath=/data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10/lib -Wl,-rpath=/data/data/com.termux/files/home/linuxbrew/.linuxbrew/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib

https://gist.github.com/anonymous/eca6c22a0a02d58000a2a6d9fdde2b96#file-02-make-cc-L90

There's no --enable-new-dtags option in there, so that's why ld is using DT_RPATH rather than DT_RUNPATH. Check that your --enable-new-dtags patch is working as expected. That'll fix the unused DT entry: type 0xf warning, but I don't think that it explains the segfault.

Please report…

ls -l /data/data/com.termux/files/home/linuxbrew/.linuxbrew/lib/ld.so
/data/data/com.termux/files/home/linuxbrew/.linuxbrew/lib/ld.so
ldd /data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10/bin/hello
emanresusername commented 6 years ago

ahhh right, i forgot i undid that, reinstalled with that in and the warning did go away now it just segfaults 😭

( 
ls -l /data/data/com.termux/files/home/linuxbrew/.linuxbrew/lib/ld.so
/data/data/com.termux/files/home/linuxbrew/.linuxbrew/lib/ld.so
ldd /data/data/com.termux/files/home/linuxbrew/.linuxbrew/Cellar/hello/2.10/bin/hello
)
lrwxrwxrwx 1 u0_a288 u0_a288 20 Feb 15 12:07 /data/data/com.termux/files/home/linuxbrew/.linuxbrew/lib/ld.so -> /system/bin/linker64
libc.so
libdl.so
sjackman commented 6 years ago

Total shot in the dark, but try…

/system/bin/linker64 /data/data/com.termux/files/home/linuxbrew/.linuxbrew/bin/hello
emanresusername commented 6 years ago

Segfaults as well :sob:

sjackman commented 6 years ago

Try…

brew install patchelf
emanresusername commented 6 years ago

https://gist.github.com/6aee66948e494786a207a32551475402

sjackman commented 6 years ago
./configure: getconf: not found

https://gist.github.com/anonymous/6aee66948e494786a207a32551475402#file-01-configure-L35

Any chance there's a Termux package for getconf?

Try…

brew install tree
emanresusername commented 6 years ago

there is a termux getconf. installing that and rerunning brew install patchelf will try brew install tree after that, pending you screaming

NOOOOO STAHHHHPP!!!!! GOOD GOD MAN!!! WHAT ARE YOU DOING?!?!?!? ABORT!!!!! ABORT!!! STOP INSTALLING PATCHELF AND INSTALL TREE RIGHT THIS INSTANT!!!!

or something of the like...

emanresusername commented 6 years ago

brew install patchelf: take 2 🎬 brew install tree underway...

emanresusername commented 6 years ago

brew install -v tree

sjackman commented 6 years ago

brew install patchelf

g++-7 -Wall -static-libgcc -static-libstdc++   -o patchelf patchelf.o  
/data/data/com.termux/files/usr/bin/ld: cannot find -lc++_shared

https://gist.github.com/anonymous/3bd4a9255fd5c7be6f299ce768d69ee5#file-02-make-L10

sjackman commented 6 years ago

brew install tree

tree.h:55:10: fatal error: langinfo.h: No such file or directory

https://gist.github.com/anonymous/d1a70ae4d526d679c24216c4ab37cb77#file-01-make-L14

sjackman commented 6 years ago

Try…

brew install emojify
emojify :tada:
sjackman commented 6 years ago

Try…

brew install pstree
emanresusername commented 6 years ago

well, as i was pkg installing <things> to avoid embarrassing myself when i said "i already tried installing all those", turns out there was a lc++ package i didn't install (-‸ლ) (i tried all the other permutations lc, lc_shared, lc++_shared) pkg install lc++; brew install patchelf: in progress brew install emojify pstree: pending ...

emanresusername commented 6 years ago

pkg install lc++; brew install patchelf

emanresusername commented 6 years ago

holy shit!

holy shit EMOJIFY WORKED!!!

emojify :astonished: 
😲 

less-holy 💩

brew install pstree