3

I want to install libgflags-dev. According to this launchpad link, it is present in the ubuntu repositories : https://launchpad.net/ubuntu/+source/gflags and http://packages.ubuntu.com/raring/libdevel/libgflags-dev

But when i try to sudo apt-get install it, I get E: Unable to locate package libgflags-dev Why is this happening ? I have all multiverse and universe enabled from software center.

How to install it from apt-get ?

P.S. I know i can simply download the binary and make install it, but I want to know how to do this from apt-get.

Chani
  • 787
  • It's not available for 12.04 in the repositories. I'm writing a more detailed answer (and a way to build the package yourself if that works - testing now). – gertvdijk Jun 24 '13 at 16:41
  • @gertvdijk thanks man. waiting for your answer :) – Chani Jun 24 '13 at 16:45
  • @gertvdijk for now i downloaded the deb packages from https://code.google.com/p/gflags/downloads/list and installed using dpkg. I hope I do not face any issues using it. Please share your insights about this method and your method as well. – Chani Jun 24 '13 at 17:02
  • That will also work, yes. However, those do not contain any Ubuntu-specific patches/features if any. – gertvdijk Jun 24 '13 at 17:06

2 Answers2

6

Not packaged for Precise

As you can see on the packages.ubuntu.com site with a query, this isn't available in Precise (12.04), but only for Quantal (12.10) and newer.

Rather than installing from source, here's how to build your own package from the sources of Quantal.

Manual package build (backport)

This is a very very verbose description - for anyone building a package for the first time.

  1. Install basic packages to build software and packages: build-essential Install build-essential and devscripts Install devscripts.

  2. Go to the source package (gflags) page at Launchpad: https://launchpad.net/ubuntu/+source/gflags

  3. Unfold the section for "The Quantal Quetzal (supported) 2.0-1" version.

  4. Locate the source package description file (.dsc extension). At the time of writing this is https://launchpad.net/ubuntu/+archive/primary/+files/gflags_2.0-1.dsc

  5. Copy the link to your clipboard.

  6. Open a terminal and download the source package using dget:

    dget https://launchpad.net/ubuntu/+archive/primary/+files/gflags_2.0-1.dsc
    

    This will fail the first time:

    gpg: Signature made Thu 31 May 2012 14:48:41 CEST using RSA key ID 8AE09345
    gpg: Can't check signature: public key not found
    Validation FAILED!!
    
  7. Install the required RSA key as in the error message above:

    gpg --keyserver keyserver.ubuntu.com --recv-key 8AE09345
    
  8. Configure the DPKG development scripts to use your GPG keyring:

    echo 'DSCVERIFY_KEYRINGS="/etc/apt/trusted.gpg:~/.gnupg/pubring.gpg"' > ~/.devscripts
    

    See Added key, but dget still shows "gpg: Can't check signature: public key not found" for why.

  9. Run the earlier dget command again. This should now succeed.

  10. Hop into the directory created:

    cd gflags-2.0/
    
  11. Try building the package.

    debuild -uc -us
    

    Explanation for the options: unsigned changes file, unsigned new .dsc file. As you are not redistributing the package, there's no need to sign anything.

    This may fail due to missing build dependencies, e.g.:

    dpkg-checkbuilddeps: Unmet build dependencies: debhelper
    

    Note this is really system specific.

  12. Install the build dependencies (satisfy all above from the output you get), e.g.:

    sudo apt-get install debhelper
    
  13. Try building the package again:

    debuild -uc -us
    
  14. One directory below, you'll find your packages, e.g.:

    $ cd ..
    $ ls -al *gflags*.deb
    -rw-r--r-- 1 gert gert 108450 Jun 24 18:59 libgflags2_2.0-1_amd64.deb
    -rw-r--r-- 1 gert gert 147590 Jun 24 18:59 libgflags-dev_2.0-1_amd64.deb
    -rw-r--r-- 1 gert gert  14778 Jun 24 18:59 libgflags-doc_2.0-1_all.deb
    
  15. Install them:

    sudo dpkg -i *gflags*.deb
    

    In case this fails because of binary dependencies not satisfied, run

    sudo apt-get install -f
    

Done!

You can remove or update them any time, like any other package.

The next time you will build any package you will not have to go through all the hoops... in general the recipe is like:

  1. dget <.dsc-file>

  2. cd thefolder

  3. debuild -uc -us

  4. sudo dpkg -i ../*somepattern*.deb

gertvdijk
  • 67,947
0

As can be seen in the launchpad page, gflags have a unofficial PPA that provides perbuild binaries for precise. I've used ppa:fcitx-team/nightly and it looks to be working fine.

Guss
  • 3,535