Меnu:


The emacs23 is the 'speed of light' version of Emacs. When We are editing C code nothing beats emacs23. Would that affirmation be Right after trying gccemacs?.

installing gccemacs on archlinux arm aka alarm armv7h

Our distro is Archlinux and its springs which are arch32 and alarm. Which one was the easiest for trying gccemacs?. The answer is x86-64. On arch32 the task was completed also.

At 2020 We also failed on trying gccemacs on alarm. But libgccjit was compiled after several struggles.

--8<---------------cut here---------------start------------->8---
Name            : libgccjit
Version         : 10.2.0-2
Description     : Just-In-Time Compilation using GCC.
Architecture    : armv7h
URL             : https://gcc.gnu.org/wiki/JIT
Licenses        : GPL3
Groups          : None
Provides        : None
Depends On      : glibc  libmpc  zlib  gmp  mpfr  libmpc  gcc-libs=10.2.0
Optional Deps   : None
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 18.60 MiB
Packager        : anonymous2 <anonymous@anonimous.org>
Build Date      : Fri 09 Oct 2020 07:21:05 PM UTC
Install Date    : Sat 10 Oct 2020 02:55:49 PM UTC
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : None
--8<---------------cut here---------------end--------------->8---

But. When we tried compiling gccemacs compilation halted with the following error:

--8<---------------cut here---------------start------------->8---
checking for gcc_jit_context_acquire in -lgccjit... yes
checking for libgccjit.h... yes
configure: error: The installed libgccjit failed to compile and run a test program using
the libgccjit library; see config.log for the details of the failure.
The test program can be found here:
<https://gcc.gnu.org/onlinedocs/jit/intro/tutorial01.html>.
You can try compiling it yourself to investigate the issues.
Please report the issue to your distribution if libgccjit was installed
through that.
You can find the instructions on how to compile and install libgccjit from
source on this site:
<https://gcc.gnu.org/wiki/JIT>.
==> ERROR: A failure occurred in build().
    Aborting...
--8<---------------cut here---------------end--------------->8---

When we got the error above. We thought. We should stop here. And perhaps try the same later.

On Archlinux ARM aka alarm. There is a comment on the gcc PKGBUILD about which one is the path for compiling gcc11 at the time of writing this blog-post. A couple of requirements are glibc and binutils on that order. We are used to cross-compiling the linux-armv7 kernel on x86-64 CARCH. So We started trying cross-compiling gcc11 the same way We are used to for cross-compiling the kernel. When We tried installing the package the cc command was unable of compiling a simple program. The next logical step was trying to compile the package directly on the 'orange pi plus 2e' SBC. Compiling glibc was simple just a minor modification on the PKGBUILD.

When we tried compiling binutils compilation halted with the error below:

--8<---------------cut here---------------start------------->8---
/usr/include/c++/10.2.0/bits/stl_algo.h:1886:25: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, false>*, std::vector<gold::Output_reloc<9, true, 64, false>, std::allocator<gold::Output_reloc<9, true, 64, false> > > >’ changed in GCC 7.1
 1886 |    std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |    ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_algo.h:1891:23: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, false>*, std::vector<gold::Output_reloc<9, true, 64, false>, std::allocator<gold::Output_reloc<9, true, 64, false> > > >’ changed in GCC 7.1
 1891 |  std::__insertion_sort(__first, __last, __comp);
      |  ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_algo.h: In function ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, true>*, std::vector<gold::Output_reloc<9, true, 64, true>, std::allocator<gold::Output_reloc<9, true, 64, true> > > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<gold::Output_data_reloc_base<9, true, 64, true>::Sort_relocs_comparison>]’:
/usr/include/c++/10.2.0/bits/stl_algo.h:1662:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, true>*, std::vector<gold::Output_reloc<9, true, 64, true>, std::allocator<gold::Output_reloc<9, true, 64, true> > > >’ changed in GCC 7.1
 1662 |     __heap_select(_RandomAccessIterator __first,
      |     ^~~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_algo.h:1662:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, true>*, std::vector<gold::Output_reloc<9, true, 64, true>, std::allocator<gold::Output_reloc<9, true, 64, true> > > >’ changed in GCC 7.1
/usr/include/c++/10.2.0/bits/stl_algo.h:1662:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, true>*, std::vector<gold::Output_reloc<9, true, 64, true>, std::allocator<gold::Output_reloc<9, true, 64, true> > > >’ changed in GCC 7.1
/usr/include/c++/10.2.0/bits/stl_algo.h:1662:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, true>*, std::vector<gold::Output_reloc<9, true, 64, true>, std::allocator<gold::Output_reloc<9, true, 64, true> > > >’ changed in GCC 7.1
/usr/include/c++/10.2.0/bits/stl_algo.h: In function ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, true>*, std::vector<gold::Output_reloc<9, true, 64, true>, std::allocator<gold::Output_reloc<9, true, 64, true> > > >; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<gold::Output_data_reloc_base<9, true, 64, true>::Sort_relocs_comparison>]’:
/usr/include/c++/10.2.0/bits/stl_algo.h:1945:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, true>*, std::vector<gold::Output_reloc<9, true, 64, true>, std::allocator<gold::Output_reloc<9, true, 64, true> > > >’ changed in GCC 7.1
 1945 |     __introsort_loop(_RandomAccessIterator __first,
      |     ^~~~~~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_algo.h:1945:5: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, true>*, std::vector<gold::Output_reloc<9, true, 64, true>, std::allocator<gold::Output_reloc<9, true, 64, true> > > >’ changed in GCC 7.1
/usr/include/c++/10.2.0/bits/stl_algo.h:1959:25: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, true>*, std::vector<gold::Output_reloc<9, true, 64, true>, std::allocator<gold::Output_reloc<9, true, 64, true> > > >’ changed in GCC 7.1
 1959 |    std::__introsort_loop(__cut, __last, __depth_limit, __comp);
      |    ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_algo.h:1937:25: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, true>*, std::vector<gold::Output_reloc<9, true, 64, true>, std::allocator<gold::Output_reloc<9, true, 64, true> > > >’ changed in GCC 7.1
 1937 |       std::__heap_select(__first, __middle, __last, __comp);
      |       ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_algo.h: In member function ‘void {anonymous}::Mips_output_data_reloc<sh_type, dynamic, size, big_endian>::do_write(gold::Output_file*) [with int sh_type = 9; bool dynamic = true; int size = 64; bool big_endian = true]’:
/usr/include/c++/10.2.0/bits/stl_algo.h:1974:25: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, true>*, std::vector<gold::Output_reloc<9, true, 64, true>, std::allocator<gold::Output_reloc<9, true, 64, true> > > >’ changed in GCC 7.1
 1974 |    std::__introsort_loop(__first, __last,
      |    ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
 1975 |     std::__lg(__last - __first) * 2,
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1976 |     __comp);
      |     ~~~~~~~
/usr/include/c++/10.2.0/bits/stl_algo.h:1886:25: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, true>*, std::vector<gold::Output_reloc<9, true, 64, true>, std::allocator<gold::Output_reloc<9, true, 64, true> > > >’ changed in GCC 7.1
 1886 |    std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |    ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_algo.h:1891:23: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<9, true, 64, true>*, std::vector<gold::Output_reloc<9, true, 64, true>, std::allocator<gold::Output_reloc<9, true, 64, true> > > >’ changed in GCC 7.1
 1891 |  std::__insertion_sort(__first, __last, __comp);
      |  ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
mv -f .deps/mips.Tpo .deps/mips.Po
/usr/include/c++/10.2.0/bits/stl_vector.h: In member function ‘void {anonymous}::Target_aarch64<size, big_endian>::scan_relocs(gold::Symbol_table*, gold::Layout*, gold::Sized_relobj_file<size, big_endian>*, unsigned int, unsigned int, const unsigned char*, size_t, gold::Output_section*, bool, size_t, const unsigned char*) [with int size = 64; bool big_endian = false]’:
/usr/include/c++/10.2.0/bits/stl_vector.h:1198:21: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<4, true, 64, false>*, std::vector<gold::Output_reloc<4, true, 64, false>, std::allocator<gold::Output_reloc<4, true, 64, false> > > >’ changed in GCC 7.1
 1198 |    _M_realloc_insert(end(), __x);
      |    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_vector.h:1198:21: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<4, true, 64, false>*, std::vector<gold::Output_reloc<4, true, 64, false>, std::allocator<gold::Output_reloc<4, true, 64, false> > > >’ changed in GCC 7.1
 1198 |    _M_realloc_insert(end(), __x);
      |    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_vector.h:1198:21: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<4, true, 64, false>*, std::vector<gold::Output_reloc<4, true, 64, false>, std::allocator<gold::Output_reloc<4, true, 64, false> > > >’ changed in GCC 7.1
 1198 |    _M_realloc_insert(end(), __x);
      |    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_vector.h:1198:21: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<4, true, 64, false>*, std::vector<gold::Output_reloc<4, true, 64, false>, std::allocator<gold::Output_reloc<4, true, 64, false> > > >’ changed in GCC 7.1
 1198 |    _M_realloc_insert(end(), __x);
      |    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_vector.h: In member function ‘void {anonymous}::Target_aarch64<size, big_endian>::scan_relocs(gold::Symbol_table*, gold::Layout*, gold::Sized_relobj_file<size, big_endian>*, unsigned int, unsigned int, const unsigned char*, size_t, gold::Output_section*, bool, size_t, const unsigned char*) [with int size = 64; bool big_endian = true]’:
/usr/include/c++/10.2.0/bits/stl_vector.h:1198:21: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<4, true, 64, true>*, std::vector<gold::Output_reloc<4, true, 64, true>, std::allocator<gold::Output_reloc<4, true, 64, true> > > >’ changed in GCC 7.1
 1198 |    _M_realloc_insert(end(), __x);
      |    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_vector.h:1198:21: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<4, true, 64, true>*, std::vector<gold::Output_reloc<4, true, 64, true>, std::allocator<gold::Output_reloc<4, true, 64, true> > > >’ changed in GCC 7.1
 1198 |    _M_realloc_insert(end(), __x);
      |    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_vector.h:1198:21: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<4, true, 64, true>*, std::vector<gold::Output_reloc<4, true, 64, true>, std::allocator<gold::Output_reloc<4, true, 64, true> > > >’ changed in GCC 7.1
 1198 |    _M_realloc_insert(end(), __x);
      |    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/usr/include/c++/10.2.0/bits/stl_vector.h:1198:21: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<gold::Output_reloc<4, true, 64, true>*, std::vector<gold::Output_reloc<4, true, 64, true>, std::allocator<gold::Output_reloc<4, true, 64, true> > > >’ changed in GCC 7.1
 1198 |    _M_realloc_insert(end(), __x);
      |    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
mv -f .deps/aarch64.Tpo .deps/aarch64.Po
make[4]: Leaving directory '/home/user/abs/binutils/src/binutils-build/gold'
make[3]: *** [Makefile:1157: all-recursive] Error 1
make[3]: Leaving directory '/home/user/abs/binutils/src/binutils-build/gold'
make[2]: *** [Makefile:897: all] Error 2
make[2]: Leaving directory '/home/user/abs/binutils/src/binutils-build/gold'
make[1]: *** [Makefile:6120: all-gold] Error 2
make[1]: Leaving directory '/home/user/abs/binutils/src/binutils-build'
make: *** [Makefile:854: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
--8<---------------cut here---------------end--------------->8---

If You guys have any tip to share about the error above. Share your tip with us.

After the fail compiling binutils We needed to re-evaluate our options. So an idea come out. After comparing gcc PKGBUILD for x86-64 with the gcc PKGBUILD for ARM. There were some changes that could be applied on libgccjit PKGBUILD. And We did that change. Compilation ended successfully after one hour of compilation time. We installed libgccjit package and fired-up gccemacs compilation. Gccemacs is installed and working.

Gccemacs compilation took three hours.

Those are the differences You would need to apply for compiling libgccjit on your 32bits ARM machine:

--8<---------------cut here---------------start------------->8---
diff -u /home/user/abs/libgccjit/PKGBUILD.as.it.was /home/user/abs/libgccjit/PKGBUILD
--- /home/user/abs/libgccjit/PKGBUILD.as.it.was 2021-11-08 23:57:13.249050172 +0000
+++ /home/user/abs/libgccjit/PKGBUILD   2021-11-09 00:22:01.793073903 +0000
@@ -4,7 +4,7 @@
 # Contributor: Jashandeep Sohi <jashandeep.s.sohi@gmail.com>

 pkgname=libgccjit
-pkgver=11.1.0
+pkgver=10.2.0
 pkgrel=1
 pkgdesc='Just-In-Time Compilation using GCC.'
 arch=(x86_64)
@@ -21,6 +21,11 @@
               D3A93CAD751C2AF4F8C7AD516C35B99309B5FA62) # Jakub Jelinek <jakub@redhat.com>
 sha256sums=('4c4a6fb8a8396059241c2e674b85b351c26a5d678274007f076957afa1cc9ddf'
             'SKIP')
+# ALARM: Specify build host types, triplet patch
+[[ $CARCH == "arm" ]] && CONFIGFLAG="--host=armv5tel-unknown-linux-gnueabi --build=armv5tel-unknown-linux-gnueabi --with-arch=armv5te --with-float=soft"
+[[ $CARCH == "armv6h" ]] && CONFIGFLAG="--host=armv6l-unknown-linux-gnueabihf --build=armv6l-unknown-linux-gnueabihf --with-arch=armv6 --with-float=hard --with-fpu=vfp"
+[[ $CARCH == "armv7h" ]] && CONFIGFLAG="--host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16"
+[[ $CARCH == "aarch64" ]] && CONFIGFLAG="--host=aarch64-unknown-linux-gnu --build=aarch64-unknown-linux-gnu --with-arch=armv8-a --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419"

 prepare() {
  cd "$srcdir/gcc-$pkgver"
@@ -29,7 +34,7 @@
  sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in

  # Arch Linux installs x86_64 libraries /lib
- sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64
+ [[ $CARCH == "x86_64" ]] && sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64

  # hack! - some configure tests for header files using "$CPP $CPPFLAGS"
  sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure
@@ -52,7 +57,6 @@
      --with-linker-hash-style=gnu \
      --with-system-zlib \
      --enable-__cxa_atexit \
-     --enable-cet=auto \
      --enable-checking=release \
      --enable-clocale=gnu \
      --enable-default-pie \
@@ -62,7 +66,6 @@
      --enable-install-libiberty \
      --enable-linker-build-id \
      --enable-lto \
-     --enable-multilib \
      --enable-plugin \
      --enable-shared \
      --enable-host-shared \
@@ -81,7 +84,8 @@
      --disable-libsanitizer \
      --disable-libstdcxx-pch \
      --disable-libunwind-exceptions \
-     --disable-werror
+     --disable-werror \
+     $CONFIGFLAG

  make
 }

Diff finished.  Fri Nov 12 01:10:16 2021
--8<---------------cut here---------------end--------------->8---

Those are the gccemacs compilation options:

--8<---------------cut here---------------start------------->8---
"--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --mandir=/usr/share/man
--with-gameuser=:games --with-sound=alsa --with-modules --without-gconf --without-gsettings
--with-wide-int --with-harfbuzz --with-json=yes --with-native-compilation
--enable-link-time-optimization --with-native-compilation --with-x-toolkit=lucid --with-xft
--with-xaw3d --without-compress-install '--program-transform-name=s/\\([ec]tags\\)/\\1.emacs/'
'CFLAGS= -flto -fuse-linker-plugin' CPPFLAGS=
LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
--8<---------------cut here---------------end--------------->8---

Some pictures:

Is gccemacs quicker than emacs23. There is no answer yet for that question. We would need to test both versions head to head. Probably in the near future. We are going to get an answer for that question.

Stay Healthy. Stay Safe

Last change: 20.11.2021 17:59

blog comments powered by Disqus