This repository has been archived by the owner. It is now read-only.

Package nheko #900

Closed
ollieparanoid opened this Issue Nov 11, 2017 · 4 comments

Comments

Projects
None yet
1 participant
@ollieparanoid
Member

ollieparanoid commented Nov 11, 2017

nheko is a fine upcoming matrix client, that a few people from postmarketOS are interested in (I actually use it as daily driver although it misses some key features). By coincidence, it might actually become the matrix client for the Librem 5, which means it will get a dialing function among other things.

Thanks to nheko author @mujx for testing that it works in postmarketOS with Qemu, now we only need to package it properly!

@PureTryOut wrote:

this is very interesting. I'm packaging nheko (the Matrix client), however it crashes on launch with "Illegal instruction". however, if I build the package from within a running pmOS VM, it runs fine!

@PureTryOut: Could you put the APKBUILD in a branch in pmbootstrap?
https://github.com/PureTryOut/pmbootstrap/tree/nheko/aports/main/nheko

See also: mujx/nheko#102

@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Nov 12, 2017

Member

I have a clue what may have caused the "Illegal instruction" and why it only happened when building as package. With another version of the packaging script I have created (see below for details), when building it, abuild (Alpine's package building program, that we wrap) fails with:

>>> ERROR: nheko*: Has /home/... in rpath

And when entering the building chroot and looking at the generated nheko executable, it shows that libmatrix_events.so doesn't get properly linked against:

# pmbootstrap chroot
# cd /home/pmos/build/pkg/nheko/usr/bin
/home/pmos/build/pkg/nheko/usr/bin # ldd ./nheko
        /lib/ld-musl-x86_64.so.1 (0x6e6b00870000)
        libmatrix_events.so => /home/pmos/build/src/nheko-4a912a2dff31468468b6fd544653e25c82568157/libmatrix_events.so (0x6e6affe9b000)
        libQt5Widgets.so.5 => /usr/lib/libQt5Widgets.so.5 (0x6e6aff72b000)
        libQt5Network.so.5 => /usr/lib/libQt5Network.so.5 (0x6e6aff402000)
        libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0x6e6afeca2000)
        libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0x6e6afe597000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x6e6afe245000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x6e6afe033000)
        libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x6e6b00870000)
        libz.so.1 => /lib/libz.so.1 (0x6e6afde1c000)
        libssl.so.44 => /lib/libssl.so.44 (0x6e6afdbd0000)
        libcrypto.so.42 => /lib/libcrypto.so.42 (0x6e6afd82a000)
        libGL.so.1 => /usr/lib/libGL.so.1 (0x6e6afd5a3000)
        libpng16.so.16 => /usr/lib/libpng16.so.16 (0x6e6afd375000)
        libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x6e6afd103000)
        libicui18n.so.59 => /usr/lib/libicui18n.so.59 (0x6e6afccd4000)
        libicuuc.so.59 => /usr/lib/libicuuc.so.59 (0x6e6afc94f000)
        libpcre2-16.so.0 => /usr/lib/libpcre2-16.so.0 (0x6e6afc6cb000)
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x6e6afc3da000)
        libexpat.so.1 => /usr/lib/libexpat.so.1 (0x6e6afc1b9000)
        libxcb-dri3.so.0 => /usr/lib/libxcb-dri3.so.0 (0x6e6afbfb6000)
        libxcb-present.so.0 => /usr/lib/libxcb-present.so.0 (0x6e6afbdb3000)
        libxcb-sync.so.1 => /usr/lib/libxcb-sync.so.1 (0x6e6afbbac000)
        libxshmfence.so.1 => /usr/lib/libxshmfence.so.1 (0x6e6afb9aa000)
        libglapi.so.0 => /usr/lib/libglapi.so.0 (0x6e6afb75f000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0x6e6afb54f000)
        libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x6e6afb34c000)
        libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x6e6afb146000)
        libX11-xcb.so.1 => /usr/lib/libX11-xcb.so.1 (0x6e6afaf44000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0x6e6afac21000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0x6e6afa9fb000)
        libxcb-glx.so.0 => /usr/lib/libxcb-glx.so.0 (0x6e6afa7e1000)
        libxcb-dri2.so.0 => /usr/lib/libxcb-dri2.so.0 (0x6e6afa5dc000)
        libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0x6e6afa3d7000)
        libdrm.so.2 => /usr/lib/libdrm.so.2 (0x6e6afa1c7000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x6e6af9f19000)
        libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x6e6af9cf9000)
        libicudata.so.59 => /usr/lib/libicudata.so.59 (0x6e6af81e6000)
        libpcre.so.1 => /usr/lib/libpcre.so.1 (0x6e6af7f8b000)
        libintl.so.8 => /usr/lib/libintl.so.8 (0x6e6af7d7d000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0x6e6af7b7a000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x6e6af7974000)
        libbz2.so.1 => /usr/lib/libbz2.so.1 (0x6e6af7767000)
        libbsd.so.0 => /usr/lib/libbsd.so.0 (0x6e6af7555000)

@mujx: I think this is an upstream issue, could you take a look at it? You should be able to reproduce this with

cd ~/code/pmbootstrap
git checkout feature/nheko
pmbootstrap log
# in a new terminal:
pmbootstrap build nheko

EDIT: also @mujx, could you start tagging release versions? I've also asked for lmdb++.

packaging related

I have given it a try here:
https://github.com/postmarketOS/pmbootstrap/tree/feature/nheko

Heavily based on @PureTryOut's work with the following changes:

  • put the _commit in the APKBUILDs, so we can easily upgrade them
  • generate the CMake APKBUILD with Alpine's newakpbuild, so we use their CMake specific template code
  • remove -dev dependencies from depends, they only go in makedepends and the libraries it links against get detected automatically.
  • renamed lmdbxx to lmdb++, because Alpine has ++ in other package names, and that seems to be the official name
Member

ollieparanoid commented Nov 12, 2017

I have a clue what may have caused the "Illegal instruction" and why it only happened when building as package. With another version of the packaging script I have created (see below for details), when building it, abuild (Alpine's package building program, that we wrap) fails with:

>>> ERROR: nheko*: Has /home/... in rpath

And when entering the building chroot and looking at the generated nheko executable, it shows that libmatrix_events.so doesn't get properly linked against:

# pmbootstrap chroot
# cd /home/pmos/build/pkg/nheko/usr/bin
/home/pmos/build/pkg/nheko/usr/bin # ldd ./nheko
        /lib/ld-musl-x86_64.so.1 (0x6e6b00870000)
        libmatrix_events.so => /home/pmos/build/src/nheko-4a912a2dff31468468b6fd544653e25c82568157/libmatrix_events.so (0x6e6affe9b000)
        libQt5Widgets.so.5 => /usr/lib/libQt5Widgets.so.5 (0x6e6aff72b000)
        libQt5Network.so.5 => /usr/lib/libQt5Network.so.5 (0x6e6aff402000)
        libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0x6e6afeca2000)
        libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0x6e6afe597000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x6e6afe245000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x6e6afe033000)
        libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x6e6b00870000)
        libz.so.1 => /lib/libz.so.1 (0x6e6afde1c000)
        libssl.so.44 => /lib/libssl.so.44 (0x6e6afdbd0000)
        libcrypto.so.42 => /lib/libcrypto.so.42 (0x6e6afd82a000)
        libGL.so.1 => /usr/lib/libGL.so.1 (0x6e6afd5a3000)
        libpng16.so.16 => /usr/lib/libpng16.so.16 (0x6e6afd375000)
        libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x6e6afd103000)
        libicui18n.so.59 => /usr/lib/libicui18n.so.59 (0x6e6afccd4000)
        libicuuc.so.59 => /usr/lib/libicuuc.so.59 (0x6e6afc94f000)
        libpcre2-16.so.0 => /usr/lib/libpcre2-16.so.0 (0x6e6afc6cb000)
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x6e6afc3da000)
        libexpat.so.1 => /usr/lib/libexpat.so.1 (0x6e6afc1b9000)
        libxcb-dri3.so.0 => /usr/lib/libxcb-dri3.so.0 (0x6e6afbfb6000)
        libxcb-present.so.0 => /usr/lib/libxcb-present.so.0 (0x6e6afbdb3000)
        libxcb-sync.so.1 => /usr/lib/libxcb-sync.so.1 (0x6e6afbbac000)
        libxshmfence.so.1 => /usr/lib/libxshmfence.so.1 (0x6e6afb9aa000)
        libglapi.so.0 => /usr/lib/libglapi.so.0 (0x6e6afb75f000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0x6e6afb54f000)
        libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x6e6afb34c000)
        libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x6e6afb146000)
        libX11-xcb.so.1 => /usr/lib/libX11-xcb.so.1 (0x6e6afaf44000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0x6e6afac21000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0x6e6afa9fb000)
        libxcb-glx.so.0 => /usr/lib/libxcb-glx.so.0 (0x6e6afa7e1000)
        libxcb-dri2.so.0 => /usr/lib/libxcb-dri2.so.0 (0x6e6afa5dc000)
        libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0x6e6afa3d7000)
        libdrm.so.2 => /usr/lib/libdrm.so.2 (0x6e6afa1c7000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x6e6af9f19000)
        libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x6e6af9cf9000)
        libicudata.so.59 => /usr/lib/libicudata.so.59 (0x6e6af81e6000)
        libpcre.so.1 => /usr/lib/libpcre.so.1 (0x6e6af7f8b000)
        libintl.so.8 => /usr/lib/libintl.so.8 (0x6e6af7d7d000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0x6e6af7b7a000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x6e6af7974000)
        libbz2.so.1 => /usr/lib/libbz2.so.1 (0x6e6af7767000)
        libbsd.so.0 => /usr/lib/libbsd.so.0 (0x6e6af7555000)

@mujx: I think this is an upstream issue, could you take a look at it? You should be able to reproduce this with

cd ~/code/pmbootstrap
git checkout feature/nheko
pmbootstrap log
# in a new terminal:
pmbootstrap build nheko

EDIT: also @mujx, could you start tagging release versions? I've also asked for lmdb++.

packaging related

I have given it a try here:
https://github.com/postmarketOS/pmbootstrap/tree/feature/nheko

Heavily based on @PureTryOut's work with the following changes:

  • put the _commit in the APKBUILDs, so we can easily upgrade them
  • generate the CMake APKBUILD with Alpine's newakpbuild, so we use their CMake specific template code
  • remove -dev dependencies from depends, they only go in makedepends and the libraries it links against get detected automatically.
  • renamed lmdbxx to lmdb++, because Alpine has ++ in other package names, and that seems to be the official name
@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Nov 16, 2017

Member

Here's the cmake command we're using to build it:

cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=True \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_C_FLAGS="$CFLAGS" \
${CMAKE_CROSSOPTS}
make

Member

ollieparanoid commented Nov 16, 2017

Here's the cmake command we're using to build it:

cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=True \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_C_FLAGS="$CFLAGS" \
${CMAKE_CROSSOPTS}
make

@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Dec 31, 2017

Member

Aerdan from Adelie (which is also based on Alpine) created the following APKBUILD (thanks a lot!). The unpack() isn't nice, but that should not be necessary anymore if upstream provided the submodules' contents in the release archive (mujx/nheko#189). That is also why it will not be upstreamed to Alpine in the current version. -DCMAKE_SKIP_RPATH=True fixes the rpath problem.

    # Contributor: Kiyoshi Aman <[email protected]>
    # Maintainer: Kiyoshi Aman <[email protected]>
    pkgname=nheko
    pkgver=0.1.0
    _pkgver=3ce505b00ed8e7fab77ce88f829fbd76e07e3018
    pkgrel=0
    pkgdesc="Qt5-based client for Matrix protocol"
    url="https://github.com/mujx/nheko"
    arch="all"
    license="GPL-3.0+"
    depends=""
    depends_dev=""
    makedepends="git cmake qt5-qtbase-dev qt5-qttools-dev qt5-qtmultimedia-dev lmdb-dev $depends_dev"
    install=""
    #source="nheko-$pkgver.zip::https://github.com/mujx/nheko/archive/$_pkgver.zip"
    builddir="$srcdir/nheko"
     
    unpack() {
            cd "$srcdir"
            git clone --recursive https://github.com/mujx/nheko
            cd "$builddir"
            git checkout $_pkgver
    }
     
    build() {
            cd "$builddir"
            if [ "$CBUILD" != "$CHOST" ]; then
                    CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
            fi
            mkdir -p build
            cd "$builddir"/build
            cmake \
                    -DCMAKE_INSTALL_PREFIX=/usr \
                    -DCMAKE_INSTALL_LIBDIR=lib \
                    -DBUILD_SHARED_LIBS=True \
                    -DCMAKE_SKIP_RPATH=True \
                    -DCMAKE_BUILD_TYPE=RelWithDebugInfo \
                    -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
                    -DCMAKE_C_FLAGS="$CFLAGS" \
                    ${CMAKE_CROSSOPTS} ..
            make
    }
     
    check() {
            cd "$builddir"/build
            CTEST_OUTPUT_ON_FAILURE=TRUE ctest
    }
     
    package() {
            cd "$builddir"/build
            #make DESTDIR="$pkgdir" install
            install -D -m755 nheko "$pkgdir"/usr/bin/nheko
            install -D -m644 libs/matrix-structs/libmatrix_structs.so "$pkgdir"/usr/lib/libmatrix_structs.so
            install -D -m644 ../resources/nheko-256.png "$pkgdir"/usr/share/pixmaps/nheko-256.png
            install -D -m644 ../resources/nheko.desktop "$pkgdir"/usr/share/applications/nheko.desktop
           
            local size dir
            for size in 16 32 48 64 128 256 512; do
                    dir="$pkgdir"/usr/share/icons/hicolor/${size}x${size}/apps
                    install -D -m644 ../resources/nheko-${size}.png "$dir"/nheko.png;
            done
    }
Member

ollieparanoid commented Dec 31, 2017

Aerdan from Adelie (which is also based on Alpine) created the following APKBUILD (thanks a lot!). The unpack() isn't nice, but that should not be necessary anymore if upstream provided the submodules' contents in the release archive (mujx/nheko#189). That is also why it will not be upstreamed to Alpine in the current version. -DCMAKE_SKIP_RPATH=True fixes the rpath problem.

    # Contributor: Kiyoshi Aman <[email protected]>
    # Maintainer: Kiyoshi Aman <[email protected]>
    pkgname=nheko
    pkgver=0.1.0
    _pkgver=3ce505b00ed8e7fab77ce88f829fbd76e07e3018
    pkgrel=0
    pkgdesc="Qt5-based client for Matrix protocol"
    url="https://github.com/mujx/nheko"
    arch="all"
    license="GPL-3.0+"
    depends=""
    depends_dev=""
    makedepends="git cmake qt5-qtbase-dev qt5-qttools-dev qt5-qtmultimedia-dev lmdb-dev $depends_dev"
    install=""
    #source="nheko-$pkgver.zip::https://github.com/mujx/nheko/archive/$_pkgver.zip"
    builddir="$srcdir/nheko"
     
    unpack() {
            cd "$srcdir"
            git clone --recursive https://github.com/mujx/nheko
            cd "$builddir"
            git checkout $_pkgver
    }
     
    build() {
            cd "$builddir"
            if [ "$CBUILD" != "$CHOST" ]; then
                    CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
            fi
            mkdir -p build
            cd "$builddir"/build
            cmake \
                    -DCMAKE_INSTALL_PREFIX=/usr \
                    -DCMAKE_INSTALL_LIBDIR=lib \
                    -DBUILD_SHARED_LIBS=True \
                    -DCMAKE_SKIP_RPATH=True \
                    -DCMAKE_BUILD_TYPE=RelWithDebugInfo \
                    -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
                    -DCMAKE_C_FLAGS="$CFLAGS" \
                    ${CMAKE_CROSSOPTS} ..
            make
    }
     
    check() {
            cd "$builddir"/build
            CTEST_OUTPUT_ON_FAILURE=TRUE ctest
    }
     
    package() {
            cd "$builddir"/build
            #make DESTDIR="$pkgdir" install
            install -D -m755 nheko "$pkgdir"/usr/bin/nheko
            install -D -m644 libs/matrix-structs/libmatrix_structs.so "$pkgdir"/usr/lib/libmatrix_structs.so
            install -D -m644 ../resources/nheko-256.png "$pkgdir"/usr/share/pixmaps/nheko-256.png
            install -D -m644 ../resources/nheko.desktop "$pkgdir"/usr/share/applications/nheko.desktop
           
            local size dir
            for size in 16 32 48 64 128 256 512; do
                    dir="$pkgdir"/usr/share/icons/hicolor/${size}x${size}/apps
                    install -D -m644 ../resources/nheko-${size}.png "$dir"/nheko.png;
            done
    }
@ollieparanoid

This comment has been minimized.

Show comment
Hide comment
@ollieparanoid

ollieparanoid Jan 2, 2018

Member

Thanks @Aerdan for bringing this to Alpine in alpinelinux/aports#3005!

Member

ollieparanoid commented Jan 2, 2018

Thanks @Aerdan for bringing this to Alpine in alpinelinux/aports#3005!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.