Project

General

Profile

Help Learning to build from source

ryry - over 4 years ago -

Hi All
I am looking to learn how to build packages from source a skill which is long overdue for me to learn and would like some help please?

Here goes, I have profanity in mind, specifically enabling omemo support on armv7 and x, I have followed this upstream, given that its from arch and there has been a ticket open on it, but is as of August has yet to be actioned, so I though it would be a possible candidate to build in myself.

I believe that it requires rebuilding with the --omemo-enabled flag in the PKGBUILD and that I would need to build libsignal-protocol-c. I have a few questions around this given I haven't ever built a package before at all. With the profanity package, Do I get the PKGBUILD with the 'asp export profanity' command?, Secondly do only make two changes to this, being adding the --omemo-enabled flag and adding the 'libsignal-protocol-c' in the depends section?

Secondly, the package 'libsignal-protocol-c' in not in the repo's so I am presuming (and please say if I am misgiven) that I would have to create a PKBUILD or build with out one? As such what is the best way to approach this?

Finally, what is the best way, when building 100% libre/freedom respecting packages to spot a source (other than perhaps the licences), that they might be incompatible with a completely free system/OS?

Any help with this is much appreciated, as I say I'd much like to learn how to do this.

Thanks


Replies (11)

RE: Help Learning to build from source - freemor - over 4 years ago -

I'd use

  asp checkout profanity

that'll created a dir structure with all the profanity build files.
The directory structure isn't important right now just the build files
PKGBUILD and any patches or alpm-hooks etc.

anything in your depends has to be packaged already. So if you need to depend
'libsignal-protocol-c' then you'll need to package that first. and then probably
add it to a personal repo or you could just: pacman -U if after you build is as then
it would be available for the building on profanify with omemo enabled

man PKGBUILD

and

man makepkg

Are well worth the read. There is also a linter 'namcap' that'll check your PKGBUILD
and point out problems.

RE: Help Learning to build from source - ryry - over 4 years ago -

Thanks for the info and help, freemor, I managed to build my first package, I built profanity as is, as a test:) . So a success in the first part, now I can build with changes once I have sorted out libsignal-protocol-c.

As for libsignal-protocol-c, I have started to try producing the PKGBUILD using a template, but have stalled, I think it requires some extra parts concerning Cmake (I have seen this on Arch's PKGBUILD that is in AUR), but this currently is beyond me and I didn't want to rely on the the AUR PKGBUILD in case that caused issues with security/freedom etc. I ran my PKGBUILD and it runs to a point, but is missing some probably obvious parts, but as this is all new to me. I have added the txt for the PKGBUILD, any pointers in the right direction would be much appreciated.

Thanks for the continued help.

RE: Help Learning to build from source - ryry - over 4 years ago -

Further to my previous post, I managed to get it to build with the attached PKGBUILD below, It doesn't seem to produce errors while building, however running namcap as suggested produces outputs similar to "libsignal-protocol-c W: File (usr/local/) exists in a non-standard directory". While it did build I can't help thinking I am missing something?

This for me is a step but interesting learning curve.

RE: Help Learning to build from source - bill-auger - over 4 years ago -

you can omit any unused vars and empty functions - the check() function in that PKGBUILD does nothing; so you can omit checkdepends() and the check() function also

parabola has three arches, so assuming that this program will compile on all three arches, the arch() array should be:

arch=('x86_64' 'i686' 'armv7h')

i ran namcap on that PKGBUILD, and it did not give any warnings

RE: Help Learning to build from source - ryry - over 4 years ago -

bill-auger wrote:

you can omit any unused vars and empty functions - the check() function in that PKGBUILD does nothing; so you can omit checkdepends() and the check() function also

parabola has three arches, so assuming that this program will compile on all three arches, the arch() array should be:

arch=('x86_64' 'i686' 'armv7h')

i ran namcap on that PKGBUILD, and it did not give any warnings

Thanks for the extra help, I cleaned it up/changed it and then also added in the flag (which i discovered after some further research and looking the AUR example, that it was needed):

-DCMAKE_INSTALL_PREFIX=/usr \

which prevented the non standard usr/local/ locations on build which namcap was suggesting. It seems to have built and installed without any issue on x86_64, and after rebuilding profanity with the --enable-omemo flag, compiles and runs as expected. :) I will try building on armv7h later today.

Once again thanks to you both for the help in building my first packages.

RE: Help Learning to build from source - ryry - over 4 years ago -

I managed to compile libsignal-protocol-c on armv7h, however when I try to compile profanity, I get this error:

-----------------------------------------------------------------------------------------------------------------------------------
/usr/bin/ld: /usr/lib/libsignal-protocol-c.a(hkdf.c.o): undefined reference to symbol 'ceil@@GLIBC_2.4'
/usr/bin/ld: /usr/lib/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make1: * [Makefile:1550: profanity] Error 1
make1: Leaving directory '/home/me/abs/profanity/src/profanity-0.7.1'
make: *
[Makefile:1179: all] Error 2
==> ERROR: A failure occurred in build().
Aborting...

Am I missing something obvious? I am assuming it has something to do with the different architecture as this error wasn't present when I compiled on X86_64.

Many thanks

RE: Help Learning to build from source - freemor - over 4 years ago -

Did you pacman -U libsignal-protocol-c.armv7h.<version>.tar.xz A.K.A install the package
after you built it and before trying to build profanity.

you need to either istall the package (easiest and as you probably want to use profanity
necessary at some point) or more the package to a personal repo that you've told pacman
about (more work). I'd personally only bother with the second option if you were building
a lot of libs that you'd need for a bunch of other stuff you wanted to build. but weren't
planning to personally use any of it

if you have installed it then prehaps the libs or headers ended up in a strange place.

pacman -Ql libsignal-protocol-c

will show you what got installed where.

RE: Help Learning to build from source - bill-auger - over 4 years ago -

presumably, ryry is building these with libremakepkg? - packages
built with libremakepkg are readily available in the chroot for
the next package to depend on - so if the library is built first,
and specified in the {make,}depends() of the client package, then
it will be installed in the chroot while building the client
package

RE: Help Learning to build from source - ryry - over 4 years ago -

freemor wrote:

Did you pacman -U libsignal-protocol-c.armv7h.<version>.tar.xz A.K.A install the package
after you built it and before trying to build profanity.

It was installed before I built profanity and also lib-signal-protcol-c built and installed fine on armv7h, both packages built fine on x86_64 and profanity appears to work with omemo etc there, but refuses to build on armv7h.

bill-auger wrote:

presumably, ryry is building these with libremakepkg?

I used makepkg, but as with above, the build was successful on x86_64, which has me perplexed.

Sorry if I am being a pain :)

RE: Help Learning to build from source - ryry - over 4 years ago -

Is there a chance that this has something to do with the glibc version in the repos being used as the armv7h version is glibc 2.29-1 and the x86_64 and i686 is 2.30? I have seen a few bug on other forums talking about a mismatch of versions used causing similar errors.

RE: Help Learning to build from source - ryry - over 4 years ago -

All sorted, it appears that I missed off libsignal-protocol-c in makedepends from and for some reason didn't throw any errors on the X86_64 build but did on the armv7h. Works like a charm. Thanks All

    (1-11/11)