Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

Version 1 Next »

NOTE: DRAFT / WORK-IN-PROGRESS / INCOMPLETE

I built these two package on Ubuntu Focal (as that’s what our Travis build server uses for linux builds) and will outline some of my journey below.

Building packages is a fickle process, many build attempts, many errors, and googling of errors and working around things. So while I share the tweaks I found myself needing in my journey, you may find yourself needing various other tweaks on your journey 😄

  • Much of my learnings stemmed from the following pages:

  • Install the debian package building scripts with:

    • sudo apt install devscripts

  • Install mingw compilers with:

    • sudo apt install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64

  • cd ~

  • mkdir debs

  • cd debs

  • I’ll now retrieve Ubuntu’s libusb and .dsc (source package) file with:

    • Run software-properties-gtk

    • Under the Ubuntu software tab, check (x) Source code

    • Click ‘OK’ button

    • Back in a console, then type:
      apt source libusb-1.0-0

      This will retrieve the following:

      • libusb-1.0-1.0.23/… (lots of files in here)

      • libusb-1.0_1.0.23.orig.tar.bz2

      • libusb-1.0_1.0.23-2build1.debian.tar.xz

      • libusb-1.0_1.0.23-2build1.dsc

  • cd libusb-1.0-1.0.23

  • Edit the debian/rules file and add the following stuff in green:

    CFLAGS="$(CFLAGS) -Os" CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ dh_auto_configure --builddirectory build-udeb -- --libdir=\$${prefix}/lib/

  • Run debuild -us -uc and make note of any errors spotted there. E.g. for me:

    dpkg-checkbuilddeps: error: Unmet build dependencies: debhelper (>= 12.4) libudev-dev doxygen

  • In this case, I just needed to install a few dependencies:

    sudo apt install debhelper libudev-dev doxygen

  • If you get an error like this:

    /usr/bin/x86_64-w64-mingw32-ld: unrecognized option '-z'

    • Edit the following files and remove and reference to -Wl,-z,relro

      • build-deb/Makefile

      • build-deb/tests/Makefile

      • build-deb/libusb/Makefile

      • build-deb/examples/Makefile

      • build-deb/doc/Makefile

  • No labels