Closed tomoqv closed 7 months ago
I'm not familiar with PostmarketOS, so I can't tell you how to fix this problem. But the problem itself is clear: the GTK3 development package is missing.
The package installation lines from my Raspbian build instructions,
# apt install libgtk-3-dev # apt install libasound2-dev
are for Debian-based distributions, including Raspbian and Ubuntu. The package names for PostmarketOS may be different.
Ok, I came a bit further by installing these two packages:
apk add gtk+3.0-dev
apk add alsa-lib-dev
However, now the build ends with this error:
In file included from src/bid_internal.h:39,
from src/bid_strtod.h:35,
from src/strtod32.c:30:
src/bid_functions.h:46:15: error: conflicting types for 'wchar_t'; have 'int'
46 | typedef int wchar_t;
| ^~~~~~~
In file included from /usr/include/stdlib.h:21,
from /usr/include/fortify/stdlib.h:23,
from src/bid_strtod.h:32:
/usr/include/bits/alltypes.h:15:18: note: previous declaration of 'wchar_t' with type 'wchar_t' {aka 'unsigned int'}
15 | typedef unsigned wchar_t;
| ^~~~~~~
gmake[1]: *** [makefile:356: strtod32.o] Error 1
gmake[1]: Leaving directory '/home/user/Dokument/Kod/free42/gtk/IntelRDFPMathLib20U1/LIBRARY'
mv: can't rename 'libbid.a': No such file or directory
ln -s IntelRDFPMathLib20U1/TESTS/readtest.c
ln: readtest.c: File exists
make: *** [Makefile:137: gcc111libbid.a] Error 1
An error while trying to build the Intel library, apparently wchar_t is predefined and the build does not expect that. Hmm, I don't think I've seen that before.
Try adding -D_WCHAR_T_DEFINED in line 16 of intel-lib-unknown-32bit.patch and/or intel-lib-unknown-64bit.patch (whichever one is relevant to your build, or both). Then do make cleaner and try a new build.
Thanks for helping out.
Just to be clear, I changed this line (in both files):
! _CFLAGS_CC := -fsigned-char -DBID_SIZE_LONG=8
to
_CFLAGS_CC := -fsigned-char -DBID_SIZE_LONG=8 -D_WCHAR_T_DEFINED
Here are the last lines of the most recent build:
patching file LIBRARY/float128/dpml_exception.c
patching file TESTS/readtest.c
patching file LIBRARY/src/bid128_hypot.c
patch: **** context mangled in hunk at line 4
gmake[1]: Entering directory '/home/user/Dokument/Kod/free42/gtk/IntelRDFPMathLib20U1/LIBRARY'
makefile.iml_head:356: *** Unknown host architecture aarch64. Stop.
gmake[1]: Leaving directory '/home/user/Dokument/Kod/free42/gtk/IntelRDFPMathLib20U1/LIBRARY'
mv: can't rename 'libbid.a': No such file or directory
ln -s IntelRDFPMathLib20U1/TESTS/readtest.c
g++ -o free42dec shell_main.o shell_skin.o skins.o keymap.o shell_loadimage.o shell_spool.o core_main.o core_commands1.o core_commands2.o core_commands3.o core_commands4.o core_commands5.o core_commands6.o core_commands7.o core_display.o core_globals.o core_helpers.o core_keydown.o core_linalg1.o core_linalg2.o core_math1.o core_math2.o core_phloat.o core_sto_rcl.o core_tables.o core_variables.o audio_alsa.o gcc111libbid.a -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -lpthread -ldl
/usr/lib/gcc/aarch64-alpine-linux-musl/13.2.1/../../../../aarch64-alpine-linux-musl/bin/ld: cannot find gcc111libbid.a: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:107: free42dec] Error 1
Oh, and here are some additional warnings early in the build:
shell_main.cc: In function 'int main(int, char**)':
shell_main.cc:386:57: warning: 'G_APPLICATION_FLAGS_NONE' is deprecated: Use 'G_APPLICATION_DEFAULT_FLAGS' instead [-Wdeprecated-declarations]
386 | app = gtk_application_new("com.thomasokken.free42", G_APPLICATION_FLAGS_NONE);
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/glib-2.0/gio/giotypes.h:30,
from /usr/include/glib-2.0/gio/gio.h:28,
from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:28,
from /usr/include/gtk-3.0/gdk/gdk.h:32,
from /usr/include/gtk-3.0/gtk/gtk.h:30,
from shell_main.cc:18:
/usr/include/glib-2.0/gio/gioenums.h:1545:3: note: declared here
1545 | G_APPLICATION_FLAGS_NONE GIO_DEPRECATED_ENUMERATOR_IN_2_74_FOR(G_APPLICATION_DEFAULT_FLAGS),
| ^~~~~~~~~~~~~~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option '-Wno-unknown-warning-option' may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option '-Wno-sometimes-uninitialized' may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option '-Wno-constant-conversion' may have been intended to silence earlier diagnostics
From your post, it looks like you didn't just add the option I suggested, but you also deleted the exclamation point at the start of that line.
That's not going to work. You have only add that one option on line 16, and make no other changes. You can tell from the output you posted that patch couldn't make sense of the modified file. The format of a patch is very specific, everything in it is important, even line endings.
Ok, I think I tried it with the exclamation mark first and didn't get it to work.
Now the line reads exactly like this:
! _CFLAGS_CC := -fsigned-char -DBID_SIZE_LONG=8 -D_WCHAR_T_DEFINED
but I still get this error:
In file included from src/bid_internal.h:39,
from src/bid_strtod.h:35,
from src/strtod32.c:30:
src/bid_functions.h:46:15: error: conflicting types for 'wchar_t'; have 'int'
46 | typedef int wchar_t;
| ^~~~~~~
In file included from /usr/include/stdlib.h:21,
from /usr/include/fortify/stdlib.h:23,
from src/bid_strtod.h:32:
/usr/include/bits/alltypes.h:15:18: note: previous declaration of 'wchar_t' with type 'wchar_t' {aka 'unsigned int'}
15 | typedef unsigned wchar_t;
| ^~~~~~~
gmake[1]: *** [makefile:356: strtod32.o] Error 1
gmake[1]: Leaving directory '/home/user/Dokument/Kod/free42/gtk/IntelRDFPMathLib20U1/LIBRARY'
mv: can't rename 'libbid.a': No such file or directory
I don't know how to fix this, I'm afraid. It's not an issue I've run into on the Linux distros I've worked with, and I don't know of any work-arounds for wchar_t issues other than the one I suggested.
Ok, I understand. I have been fiddling around a bit with the file bid_functions.h
, trying to understand what is going on with the error message. After a sudo make cleaner, the file is only found here on my system:
/home/user/Dokument/Kod/free42/common/bid_functions.h
So, I tried commenting out the following that the build stumbles on, as it seems to be not applicable to my build:
// Fix system header issue on Sun solaris and define required type by ourselves
#if !defined(_WCHAR_T) && !defined(_WCHAR_T_DEFINED) && !defined(__QNX__)
typedef int wchar_t;
#endif
After a fresh build with sudo make BCD_MATH=1 AUDIO_ALSA=1
I end up with three bid_functions.h
:
/home/user/Dokument/Kod/free42/common/bid_functions.h
/home/user/Dokument/Kod/free42/gtk/bid_functions.h
/home/user/Dokument/Kod/free42/gtk/IntelRDFPMathLib20U1/LIBRARY/src/bid_functions.h
the latter from July 12, 2011. I don't understand where it gets that version of the file from?? That file still contains the suspicious code I wanted to comment out.
Do you think it would work if that code was commented out, and if so, how can I do that?
Thanks for your patience!
The bid_functions.h in 'common' is a copy of the bid_functions.h from IntelRDFPMathLib20U1.tar.gz. The one in 'common' is used when compiling the Free42 sources; the one in IntelRDFPMathLib20U1.tar.gz is used when building the Intel library. In order to modify the latter, you'll have to create a diff from the original version to your modified one, and add that to intel-lib-linux.patch. (Take a look at build-intel-lib.sh to get a better idea what takes place when that library is built.)
Like this:
Actually, I don't understand why adding -D_WCHAR_T_DEFINED wouldn't achieve the same thing, but it can't hurt to give it a try...
Come to think of it, did the -D_WCHAR_T_DEFINED show up in the compiler flags while the Intel library was being built? I just realized that if the output from uname -m isn't one of armv7, armv7l, i386, ppc, aarch64, arm64, or i86pc, neither intel-lib-unknown-32bit.patch nor intel-lib-unknown-64bit.patch will be applied, and so the change I suggested will have no effect. What do you get when you run uname -m ?
Hello again, I finally succeeded! This is what I did:
1) Extracted ..free42/inteldecimal/IntelRDFPMathLib20U1.tar.gz
2) Edited line 46 in IntelRDFPMathLib20U1/LIBRARY/src/bid_functions.h
from
typedef int wchar_t;
to
typedef unsigned wchar_t;
3) Copied the new bid_functions.h into IntelRDFPMathLib20U1/LIBRARY/src/
4) Made a new archive with tar -czf IntelRDFPMathLib20U1.tar.gz IntelRDFPMathLib20U1
5) cd back to ..free42/gtk
3) sudo make cleaner
4) make BCD_MATH=1 AUDIO_ALSA=1
Nice. Congratulations!
Hi, I really like the Free42 calculator and have been using it on various Linux distros, including mobile Linux. I am currently running Postmarket OS with Gnome-mobile on a OnePlus 6 as my main phone and would like to install it there too.
I came this far on the phone: $ apk add libgtk-3-dev (not available on PMOS) $ apk add libasound2-dev (not available on PMOS) $ git clone https://github.com/thomasokken/free42.git $ cd free42/gtk $ make BCD_MATH=1 AUDIO_ALSA=1 Getting the following build errors:
I would really like to know how to build this, so any advice or hint is welcome!
Thanks again for this great software!