1

I tried to build a plugin for DNSCrypt, but it keeps telling me that it needs some other files.

I need to know how I can build it, and I've never compiled a package from scratch. I've always been able to use a repository.

I use Ubuntu 14.04 (64 bit) with gcc on CodeAnywhere

Here is the link to the plugin: GeoIP Plugin

Here is the link to dnscrypt: DNSCrypt

Here is what I get when I try to compile:

cabox@box-codeanywhere:~/workspace$ cmake . && make                                                                                                            
CMake Error: The source directory "/home/cabox/workspace" does not appear to contain CMakeLists.txt.                                                           
Specify --help for usage, or press the help button on the CMake GUI.                                                                                           
cabox@box-codeanywhere:~/workspace$ cd plugin                                                                                                                  
cabox@box-codeanywhere:~/workspace/plugin$ cmake . && make                                                                                                     
-- Configuring done                                                                                                                                            
-- Generating done                                                                                                                                             
-- Build files have been written to: /home/cabox/workspace/plugin                                                                                              
[100%] Building C object CMakeFiles/geoip-block.dir/geoip-block.c.o                                                                                            
/home/cabox/workspace/plugin/geoip-block.c:14:29: fatal error: dnscrypt/plugin.h: No such file or directory                                                    
 #include <dnscrypt/plugin.h>                                                                                                                                  
                             ^                                                                                                                                 
compilation terminated.                                                                                                                                        
make[2]: *** [CMakeFiles/geoip-block.dir/geoip-block.c.o] Error 1                                                                                              
make[1]: *** [CMakeFiles/geoip-block.dir/all] Error 2                                                                                                          
make: *** [all] Error 2                         

If more info is needed, I will add it as soon as possible.


Dnscrypt build was all fine but i still get http://pastebin.com/MeU4Q24W

poqdavid
  • 121

1 Answers1

2

Update

It looks like terdon added and updated some commands over the Thanksgiving Holiday. These add extra and or needed functionality. I want to thank him for adding these.

Task

First, let's start with a clean slate.

cd ~ && rm -Rv workspace

Now, we make sure we have the right tools for Ubuntu:

sudo apt-get update  ## run make sure you get all things right
sudo apt-get install build-essential checkinstall
sudo apt-get install cmake wget software-properties-common python-software-properties autoconf
sudo add-apt-repository ppa:shnatsel/dnscrypt
sudo add-apt-repository ppa:maxmind/ppa
sudo apt-get update
sudo apt-get install libtool openssl libssl-dev

Then, in case you want a package in Source Control, we need to add more tools. DNScrypt doesn't need it, but in case you ever build an item from source again:

sudo apt-get install cvs subversion git-core mercurial

You should be in your home directory, so now we need the actual source tarball for dnscrypt-proxy:

  • Download the libsodium (if you don't have it installed)

    wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.1.tar.gz
    tar xzf libsodium-1.0.1.tar.gz && cd libsodium-1.0.1 && ./configure
    make && make check && sudo make install
    sudo ldconfig && ./configure && cd ..
    
  • Download the geoip api (if you don't have it installed)

    wget https://github.com/maxmind/geoip-api-c/archive/v1.6.3.tar.gz
    tar xzf v1.6.3.tar.gz && cd geoip-api-c-1.6.3
    sh bootstrap && ./configure
    make && make check && sudo make install && cd ..
    
  • Download the ldns (if you don't have it installed)

    wget http://www.nlnetlabs.nl/downloads/ldns/ldns-1.6.17.tar.gz
    tar xzf ldns-1.6.17.tar.gz && cd ldns-1.6.17
    ./configure && make && sudo make install && cd ..
    
  • Download the DNSCrypt-Proxy Version 1.4.1 Tar.bz2 File. For the Ubuntu Way, add this DNSCrypt-PPA Please note, that this PPA is dated (the most recent version is 1.4.0 for 13.10), therefore we will install from source

    tar -xvjpf dnscrypt-proxy-1.4.1.tar.bz2 && cd dnscrypt-proxy-1.4.1
    ./configure && make && sudo make install
    
    • Since we deleted Plugin, we need to redownload the Zip File From the GitHub Repo. The directory we create will be called master

      sudo apt-get install zip unzip Tar won't extract zips, so we need new tools. You may already have these.

      unzip master.zip && cd master

    • Once you unzipped the file go to the folder and edit CMakeLists.txt and add this lines

include_directories(/home/cabox/workspace/dnscrypt-proxy-1.4.1/src/include) include_directories(/home/cabox/workspace/geoip-api-c-1.6.3/libGeoIP) include_directories(/home/cabox/workspace/ldns-1.6.17/ldns)

  • Then, run

    cmake . && make
    cd .. && cp -v master/nameofplugin.ext /some/dir/where/you/store/plugins
    

Why Your Error is Occurring

The Header File for DNSCrypt plugin.h is only installed in /usr/include/dnscrypt after you sucessfully compile DNSCrypt itself. You couldn't compile DNSCrypt for two Reasons:

  1. You did not have the source tarball.
  2. Cross-Make, or CMake for short is an independent Build system that doesn't use the standard Linux Build Process. Clients that use it include KDE,and Poppler.

References

  1. Gentoo User. We build from Source routinely. Every update, in fact.
  2. The Ubuntu EasyCompilingHOWTO
eyoung100
  • 6,252
  • 23
  • 53