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 ubuntu 21.10 build #391

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions 1000-fix-build-python3.9.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Fix error building gdb-7.10 with python 3.9 (e.g. on Ubuntu 21.10), by fixing gdb to not use an internal-only API.

As suggested by canardos in their 2018-08-28 comment on https://github.com/pfalcon/esp-open-sdk/issues/339
applying (by hand) this patch: https://sourceware.org/legacy-ml/gdb-patches/2018-05/msg00863.html
to gdb/python.c fixed the issue. This patch is the diff that resulted.

--- gdb-7.10/gdb/python/python.c~ 2015-08-28 14:22:07.000000000 -0700
+++ gdb-7.10/gdb/python/python.c 2022-01-06 12:44:24.136568791 -0800
@@ -1622,6 +1622,14 @@
}
#endif

+#ifdef IS_PY3K
+PyMODINIT_FUNC
+PyInit__gdb (void)
+{
+ return PyModule_Create (&python_GdbModuleDef);
+}
+#endif
+
/* Provide a prototype to silence -Wmissing-prototypes. */
extern initialize_file_ftype _initialize_python;

@@ -1743,6 +1751,9 @@
remain alive for the duration of the program's execution, so
it is not freed after this call. */
Py_SetProgramName (progname_copy);
+
+ /* Define _gdb as a built-in module. */
+ PyImport_AppendInittab ("_gdb", PyInit__gdb);
#else
Py_SetProgramName (progname);
#endif
@@ -1752,9 +1763,7 @@
PyEval_InitThreads ();

#ifdef IS_PY3K
- gdb_module = PyModule_Create (&python_GdbModuleDef);
- /* Add _gdb module to the list of known built-in modules. */
- _PyImport_FixupBuiltin (gdb_module, "_gdb");
+ gdb_module = PyImport_ImportModule ("_gdb");
#else
gdb_module = Py_InitModule ("_gdb", python_GdbMethods);
#endif
17 changes: 17 additions & 0 deletions 1001-fix-reload1-compile-error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Avoid gcc/reload1.c compile error when building with newer gcc (e.g. gcc 11.2 on Ubuntu 21.10).

The error was:

.../esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.5/gcc/reload1.c:89:24: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17

--- gcc-4.8.5/gcc/reload1.c~ 2013-01-21 06:55:05.000000000 -0800
+++ gcc-4.8.5/gcc/reload1.c 2022-01-05 17:18:10.148547719 -0800
@@ -440,7 +440,7 @@

while (memory_address_p (QImode, tem))
{
- spill_indirect_levels++;
+ spill_indirect_levels = 1;
tem = gen_rtx_MEM (Pmode, tem);
}

7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ toolchain $(TOOLCHAIN)/bin/xtensa-lx106-elf-gcc $(TOOLCHAIN)/xtensa-lx106-elf/sy

crosstool-NG/.built: crosstool-NG/ct-ng
cp -f 1000-mforce-l32.patch crosstool-NG/local-patches/gcc/4.8.5/
cp -f 1001-fix-reload1-compile-error.patch crosstool-NG/local-patches/gcc/4.8.5/
mkdir -p crosstool-NG/local-patches/gdb/7.10/
cp -f 1000-fix-build-python3.9.patch crosstool-NG/local-patches/gdb/7.10/
$(MAKE) -C crosstool-NG -f ../Makefile _toolchain
touch $@

Expand All @@ -142,11 +145,13 @@ _toolchain:
crosstool-NG: crosstool-NG/ct-ng

crosstool-NG/ct-ng: crosstool-NG/bootstrap
test -s crosstool-NG/scripts/build/companion_libs/121-isl.sh.orig || $(PATCH) -p1 -i ctng-fix-isl-url.patch
test -s crosstool-NG/scripts/build/companion_libs/210-expat.sh.orig || $(PATCH) -p1 -i ctng-fix-expat-url.patch
$(MAKE) -C crosstool-NG -f ../Makefile _ct-ng

_ct-ng:
./bootstrap
./configure --prefix=`pwd`
./configure --prefix=`pwd` --with-bash=/bin/bash
$(MAKE) MAKELEVEL=0
$(MAKE) install MAKELEVEL=0

Expand Down
26 changes: 26 additions & 0 deletions ctng-fix-expat-url.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Fix to get expat-2.1.0.tar.gz from a different location, since it is no longer
available from the one that had been used.

NOTE: The reason the old location didn't work is that expat-2.1.0.tar.gz on
sourceforge had been renamed to
"expat-2.1.0-RENAMED-VULNERABLE-PLEASE-USE-2.3.0-INSTEAD.tar.gz"... I
considered seeing if it would work using 2.3.0 as suggested, but 2.3.0
similarly redirects to 2.4.1, and the immediate goal is to get this stuff to
build with minimally intrusive changes.

However, it would probably be wise to switch to a newer expat!

diff --git a/scripts/build/companion_libs/210-expat.sh b/scripts/build/companion_libs/210-expat.sh
index 304482cd..dc1085d2 100644
--- a/crosstool-NG/scripts/build/companion_libs/210-expat.sh
+++ b/crosstool-NG/scripts/build/companion_libs/210-expat.sh
@@ -10,7 +10,8 @@ if [ "${CT_EXPAT_TARGET}" = "y" -o "${CT_EXPAT}" = "y" ]; then

do_expat_get() {
CT_GetFile "expat-${CT_EXPAT_VERSION}" .tar.gz \
- http://downloads.sourceforge.net/project/expat/expat/${CT_EXPAT_VERSION}
+ https://src.fedoraproject.org/repo/pkgs/expat/expat-${CT_EXPAT_VERSION}.tar.gz/dd7dab7a5fea97d2a6a43f511449b7cd
+ # http://downloads.sourceforge.net/project/expat/expat/${CT_EXPAT_VERSION}
}

do_expat_extract() {
18 changes: 18 additions & 0 deletions ctng-fix-isl-url.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Fix to get isl-0.14.tar.bz2 from a different location, since isl.gforge.inria.fr seems to no longer work.

This is from: https://github.com/pfalcon/esp-open-sdk/issues/386

diff --git a/scripts/build/companion_libs/121-isl.sh b/scripts/build/companion_libs/121-isl.sh
index a93d1aad..ca0a7f16 100644
--- a/crosstool-NG/scripts/build/companion_libs/121-isl.sh
+++ b/crosstool-NG/scripts/build/companion_libs/121-isl.sh
@@ -14,7 +14,8 @@ if [ "${CT_ISL}" = "y" ]; then
# Download ISL
do_isl_get() {
CT_GetFile "isl-${CT_ISL_VERSION}" \
- http://isl.gforge.inria.fr
+ http://gcc.gnu.org/pub/gcc/infrastructure
+ # http://isl.gforge.inria.fr
}

# Extract ISL