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

fix arm issues with gdb, aria2 and libhdf5 (octave) and mpd #3452

Closed
wants to merge 4 commits into from

Conversation

its-pointless
Copy link
Contributor

No description provided.

@tomty89
Copy link
Contributor

tomty89 commented Mar 5, 2019

I would strongly recommend building our own zlib (#3455) instead patching Makefiles if the former also avoid the same problem the latter addresses.

@tomty89
Copy link
Contributor

tomty89 commented Mar 5, 2019

Also, we should probably consistently use CPPFLAGS as it appears that we want the flags to be used for both clang and clang++?

@its-pointless
Copy link
Contributor Author

I need feedback from testing though since some interactions are only going to show up on further testing.
CPPFLAGS ? Yeah good point.
I will look into it later

@tomty89
Copy link
Contributor

tomty89 commented Mar 7, 2019

Should we just ditch this condition and always use -Oz?

if [ $TERMUX_ARCH = arm ]; then
CFLAGS+=" -Os"
else
CFLAGS+=" -Oz"
fi

Also can we have -fexception by default, for at least arm maybe?

@@ -16,7 +16,11 @@ termux_step_configure() {

termux_step_make() {
cd src/
make cli
if [ $TERMUX_ARCH = "arm" ]; then
make cli LIBS=" -lunwind -L/data/data/com.termux/files/usr/lib -lfftw3 -lfftw3_threads -lcurl -lpng16 -lz -ljpeg -ltiff -lGraphicsMagick++ -lGraphicsMagick"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to say this is no better than #2588, sorry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not meant to be better its the only way iv gotten gmic to run properly on arm. Using zlib from your pr didn't work even if built with -fexceptions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Didn't work" doesn't really tell anything. You need to at least show that gmic is and is only linked to libz.so.1 (or maybe the symlink libtermuz.so) but segfault still originates from it (the zlib). The former may not be the case if some hardcoded -lz is used at the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't originate there its caused because the static libunwind.a isn't linked propertly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not even sure what you mean. Actually there is even a note seeming to hint that we should avoid linking libraries against libgcc.a and libunwind.a (and now we may only need to exclude libgcc.a as it's a linker script to both the real libgcc and libunwind).

And still you are not showing any log (on what linkage the gmic has and how things have/have not changed with a zlib built by ourselves).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current gmic
Program received signal SIGSEGV, Segmentation fault.
0xf7189c3c in __gnu_Unwind_Resume () from /system/lib/libz.so
built on your zlib branch
Program received signal SIGSEGV, Segmentation fault.
0xf7407020 in __gnu_Unwind_Resume () from /system/lib/libm.so

its not linking properly since it looks kind of like this.
android/ndk#889

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well you gmic was still linked against /system/lib/libz.so, so

@its-pointless
Copy link
Contributor Author

Should we just ditch this condition and always use -Oz?
termux-packages/scripts/build/termux_step_setup_toolchain.sh

Lines 51 to 55 in 61785d9

if [ $TERMUX_ARCH = arm ]; then
CFLAGS+=" -Os"
else
CFLAGS+=" -Oz"
fi

Also can we have -fexception by default, for at least arm maybe?

Don't recommend -fexceptions as default as it increases install size. We need to keep things small especially for arm.
About -Oz vs -Os ... i don't know yet.

@its-pointless its-pointless mentioned this pull request Mar 14, 2019
@its-pointless
Copy link
Contributor Author

its-pointless commented Mar 18, 2019

there is another fix for this. adding -Wl,--exclude-libs,libgcc_real.a to LDFLAGS
as in LDFLAGS for all arm libs...

also if you want to see and understand what is happening for yourself in an easy to do manner.
arm-linux-androideabi-clang -Wl,-u,__aeabi_memset -Wl,-u,__aeabi_idiv -shared -o test.so && nm test.so | grep Unw

@its-pointless
Copy link
Contributor Author

well you then ask "how could this affect mpd?"
mpd uses exceptions so it needs the libunwind.a versions of these functions. Because some libs are exporting these functions using libgcc_real.a versions mpd gets libgcc_real.a version of those functions at link time instead of libunwind.a. which is why putting -lunwind before those libs that export libgcc_real.a versions fixes it.

@its-pointless
Copy link
Contributor Author

android/ndk#379
explains this situation

@ghost ghost mentioned this pull request May 6, 2019
@ghost ghost closed this May 18, 2019
This pull request was closed.
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.

2 participants