I installed freeradius 2.1.12 to my ubuntu machine:

apt-get install freeradius

Then I downloaded its source,

apt-get source freeradius

build the source:

cd freeradius-2.1.12+dfsg
./configure --prefix=/root/freeradius/freeradius-2.1.12

make fails:

        /root/freeradius-2.1.12+dfsg/src/lib/libfreeradius-radius.la -lnsl -lresolv  -lpthread -lssl -lcrypto
gcc -shared  .libs/eapcommon.o .libs/eapcrypto.o .libs/eapsimlib.o .libs/fips186prf.o  -Wl,--rpath -Wl,/root/freeradius-2.1.12+dfsg/src/lib/.libs -Wl,--rpath -Wl,/root/freeradius/freeradius-2.1.12/lib /root/freeradius-2.1.12+dfsg/src/lib/.libs/libfreeradius-radius.so -lnsl -lresolv -lpthread -lssl -lcrypto  -Wl,-soname -Wl,libfreeradius-eap-2.1.12.so -o .libs/libfreeradius-eap-2.1.12.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status

Then I wonder how come "apt-get install" can work, so I checked:

#type freeradius
freeradius is hashed (/usr/sbin/freeradius)

# ldd /usr/sbin/freeradius
        libfreeradius-radius-2.1.12.so => /usr/lib/freeradius/libfreeradius-radius-2.1.12.so (0x00007f3d6d1df000)
        libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f3d6c735000)

So libcrypto and libssl both exist at /lib/x86_64-linux-gnu.

Then how can I instruct configure to take /lib/x86_64-linux-gnu?

A more general question - if a package can be installed, what is the easiest way to build it from source? Can I somehow download a build script?


Since you're already using a package source, it's really easy: you're missing the development packages needed to build it. There might still be some other mandatory packages missing for a standard minimal package build environment. So first:

# apt-get install build-essential fakeroot devscripts

then for the package itself:

# apt-get build-dep freeradius

You'll notice that for each libfooX package needed to install the result, it will fetch as well libfoo-dev needed to build it,and most often, many more packages. Because the development libraries, as well as corresponding include files are packaged separately from the corresponding runtime libraries.

You can build back the package by running something like this in the new directory:

$ dpkg-buildpackage -us -uc -rfakeroot -b

If you didn't even need to alter anything then it can be combined into:

$ apt-get --build source freeradius

The package building won't require root access as long as the package fakeroot is installed. It can and should be done as a normal user. Other useful package: debian-keyring for Debian or ubuntu-keyring for Ubuntu which will be used by apt-get to validate the source download the same way apt-get validates a package download by using the contents of debian-archive-keyring or ubuntu-archive-keyring.

Just replace "freeradius" with any other package for the general case. You should really consult the debian building tutorial explaining all this.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.