version 1.1, 2011/11/20 20:28:27
|
version 1.2, 2012/02/05 07:14:36
|
Line 1
|
Line 1
|
**This page should use cross references to avoid duplicate content. Please help us by cleaning it up. ?**
|
**This page should use cross references to avoid duplicate content. Please help us by cleaning it up. ?** |
|
|
**Contents**
|
**Contents** |
|
|
[[!toc levels=2]]
|
[[!toc levels=2]] |
|
|
#What is pkgsrc
|
#What is pkgsrc |
|
|
pkgsrc is the NetBSD build framework for third party software that works on a lot of Unix™ like platforms and of course on Linux. In this chapter, I will explain how to set up and use pkgsrc on Linux.
|
pkgsrc is the NetBSD build framework for third party software that works on a lot of Unix™ like platforms and of course on Linux. In this chapter, I will explain how to set up and use pkgsrc on Linux. |
#Software requirements
|
#Software requirements |
|
|
Before you can use pkgsrc, you need a few packages installed on your Linux system upfront.
|
Before you can use pkgsrc, you need a few packages installed on your Linux system upfront. |
|
|
* gcc (and libstdc++)
|
* gcc (and libstdc++) |
* libncurses-devel
|
* libncurses-devel |
* zlib and zlib-devel
|
* zlib and zlib-devel |
* openssl-devel (optional but required for some packages)
|
* openssl-devel (optional but required for some packages) |
|
|
The names may vary, depending on what Linux distribution you are using. Also be mindful of the platform you are using (eg. i686 vs. x86_64 - some have different pre-required packages). Also note that some very basic tools such as file, patch, sed, and others are required, as well.
|
The names may vary, depending on what Linux distribution you are using. Also be mindful of the platform you are using (eg. i686 vs. x86_64 - some have different pre-required packages). Also note that some very basic tools such as file, patch, sed, and others are required, as well. |
#Disk space requirements
|
#Disk space requirements |
|
|
Pkgsrc is growing continuesly each month and contains currently about 6387 packages. You will need a minimum of 170 MB disk space at the moment. The pkgsrc tree doesn't contain all the software, but the scripts to build them from the source code.
|
Pkgsrc is growing continuesly each month and contains currently about 6387 packages. You will need a minimum of 170 MB disk space at the moment. The pkgsrc tree doesn't contain all the software, but the scripts to build them from the source code. |
#Obtaining the pkgsrc tree
|
#Obtaining the pkgsrc tree |
|
|
For being able to use the pkgsrc framework, you have to get the pkgsrc tree first. The recommended way to do that and to keep your tree up to date is to use CVS. Alternatively you can use [cvsup|How_to_checkout_and_update_system_sources_and_pkgsrc_with_cvsup] or mercurial. But before you can check out the tree, you have to define where from. For that, please choose an anoncvs [mirror](http://www.de.netbsd.org/mirrors/#anoncvs) close to you. In this example I will use the german anoncvs mirror anoncvs.de.netbsd.org
|
For being able to use the pkgsrc framework, you have to get the pkgsrc tree first. The recommended way to do that and to keep your tree up to date is to use CVS. Alternatively you can use [cvsup|How_to_checkout_and_update_system_sources_and_pkgsrc_with_cvsup] or mercurial. But before you can check out the tree, you have to define where from. For that, please choose an anoncvs [mirror](http://www.de.netbsd.org/mirrors/#anoncvs) close to you. In this example I will use the german anoncvs mirror anoncvs.de.netbsd.org |
#Setting CVSROOT
|
#Setting CVSROOT |
|
|
Please set your CVSROOT Environment Variable
|
Please set your CVSROOT Environment Variable |
|
|
export CVSROOT=anoncvs@anoncvs.de.netbsd.org:/cvsroot
|
export CVSROOT=anoncvs@anoncvs.de.netbsd.org:/cvsroot |
|
|
or if you are using the csh:
|
or if you are using the csh: |
|
|
setenv CVSROOT anoncvs@anoncvs.de.netbsd.org:/cvsroot
|
setenv CVSROOT anoncvs@anoncvs.de.netbsd.org:/cvsroot |
|
|
#Setting CVS_RSH
|
#Setting CVS_RSH |
|
|
Unless otherwise noted, you have to set the CVS_RSH variable to use ssh
|
Unless otherwise noted, you have to set the CVS_RSH variable to use ssh |
|
|
export CVS_RSH=ssh
|
export CVS_RSH=ssh |
|
|
or if you are using csh
|
or if you are using csh |
|
|
setenv CVS_RSH ssh
|
setenv CVS_RSH ssh |
|
|
#Creating the pkgsrc directory
|
#Creating the pkgsrc directory |
|
|
This is a matter of taste, but the commonly used path for pkgsrc is /usr/pkgsrc/
|
This is a matter of taste, but the commonly used path for pkgsrc is /usr/pkgsrc/ |
|
|
# mkdir /usr/pkgsrc
|
# mkdir /usr/pkgsrc |
|
|
If you are checking out for the first time, change to /usr
|
If you are checking out for the first time, change to /usr |
|
|
# cd /usr
|
# cd /usr |
|
|
and check out the sources.
|
and check out the sources. |
|
|
# cvs checkout -PA pkgsrc
|
# cvs checkout -PA pkgsrc |
|
|
Checking out will take a while and a minimum of 170 MB of disk space. Please ensure enough free disk space, if you wish to work with pkgsrc. A minimum of 1024 MB should be available.
|
Checking out will take a while and a minimum of 170 MB of disk space. Please ensure enough free disk space, if you wish to work with pkgsrc. A minimum of 1024 MB should be available. |
|
|
You need to **checkout** only once. If you have already checked out, you only need to **update** the sources. The Options -d allows to create new directories and -P to prune old directories.
|
You need to **checkout** only once. If you have already checked out, you only need to **update** the sources. The Options -d allows to create new directories and -P to prune old directories. |
|
|
# cd /usr/pkgsrc
|
# cd /usr/pkgsrc |
# cvs update -dP
|
# cvs update -dP |
|
|
Please be aware, that updating your sources will take much more time than checking out. Please be patient when you're updating. If you wish to update regularly, say once a day, use [[basics/cron]] to do that for you.
|
Please be aware, that updating your sources will take much more time than checking out. Please be patient when you're updating. If you wish to update regularly, say once a day, use [[basics/cron]] to do that for you. |
#Building the toolchain
|
#Building the toolchain |
|
|
The toolchain contains the software that is needed to build bsd make (bmake) and other tools.
|
The toolchain contains the software that is needed to build bsd make (bmake) and other tools. |
|
|
Please change your directory to /usr/pkgsrc/bootstrap and run ./bootstrap
|
Please change your directory to /usr/pkgsrc/bootstrap and run ./bootstrap |
|
|
# cd /usr/pkgsrc/bootstrap
|
# cd /usr/pkgsrc/bootstrap |
# ./bootstrap
|
# ./bootstrap |
|
|
Pkgsrc will now determine what kind of operating system you are using and will build the toolchain.
|
Pkgsrc will now determine what kind of operating system you are using and will build the toolchain. |
<pre><code>
|
<pre><code> |
===========================================================================
|
=========================================================================== |
|
|
Please remember to add /usr/pkg/bin to your PATH environment variable
|
Please remember to add /usr/pkg/bin to your PATH environment variable |
and /usr/pkg/man to your MANPATH environment variable, if necessary.
|
and /usr/pkg/man to your MANPATH environment variable, if necessary. |
|
|
An example mk.conf file with the settings you provided to "bootstrap"
|
An example mk.conf file with the settings you provided to "bootstrap" |
has been created for you. It can be found in:
|
has been created for you. It can be found in: |
|
|
/usr/pkgsrc/bootstrap/work/mk.conf.example
|
/usr/pkgsrc/bootstrap/work/mk.conf.example |
|
|
Please copy it to /usr/pkg/etc/mk.conf to use it.
|
Please copy it to /usr/pkg/etc/mk.conf to use it. |
|
|
You can find extensive documentation of the NetBSD Packages Collection
|
You can find extensive documentation of the NetBSD Packages Collection |
in /usr/pkgsrc/doc/pkgsrc.txt and packages(7).
|
in /usr/pkgsrc/doc/pkgsrc.txt and packages(7). |
|
|
Hopefully everything is now complete.
|
Hopefully everything is now complete. |
Thank you
|
Thank you |
|
|
===========================================================================
|
=========================================================================== |
|
|
===> bootstrap started: Sun Dec 17 14:01:49 CET 2006
|
===> bootstrap started: Sun Dec 17 14:01:49 CET 2006 |
===> bootstrap ended: Sun Dec 17 14:02:50 CET 2006
|
===> bootstrap ended: Sun Dec 17 14:02:50 CET 2006 |
</code></pre>
|
</code></pre> |
It is now necessary to add /usr/pkg/bin to your PATH environment variable (/etc/profile) to be able to run bmake.
|
It is now necessary to add /usr/pkg/bin to your PATH environment variable (/etc/profile) to be able to run bmake. |
#Installing software
|
#Installing software |
|
|
Now, let's test pkgsrc, by installing a software package. The software is sorted by categories. I've chosen *figlet*, a small program to print big letters. Figlet is in the category misc. Change to the figlet directory
|
Now, let's test pkgsrc, by installing a software package. The software is sorted by categories. I've chosen *figlet*, a small program to print big letters. Figlet is in the category misc. Change to the figlet directory |
|
|
# cd /usr/pkgsrc/misc/figlet/
|
# cd /usr/pkgsrc/misc/figlet/ |
|
|
and build the software. Pkgsrc will download the sourcefile for figlet, uncompress it and build it.
|
and build the software. Pkgsrc will download the sourcefile for figlet, uncompress it and build it. |
|
|
# bmake
|
# bmake |
|
|
and clean the working directories afterwards
|
and clean the working directories afterwards |
|
|
# bmake clean
|
# bmake clean |
|
|
and clean all dependencies
|
and clean all dependencies |
|
|
# bmake clean-depends
|
# bmake clean-depends |
|
|
or short:
|
or short: |
|
|
# bmake install clean clean-depends
|
# bmake install clean clean-depends |
|
|
#Running the new software
|
#Running the new software |
|
|
When the software has been successfully installed, it will reside by default in */usr/pkg/bin/*. To run figlet just run:
|
When the software has been successfully installed, it will reside by default in */usr/pkg/bin/*. To run figlet just run: |
|
|
# figlet
|
# figlet |
|
|
You need the /usr/pkg/bin in your PATH Variable as described above to do that.
|
You need the /usr/pkg/bin in your PATH Variable as described above to do that. |
|
|
If you have already installed a linux version of figlet on your system, run pkgsrc figlet with the absolute path.
|
If you have already installed a linux version of figlet on your system, run pkgsrc figlet with the absolute path. |
|
|
# /usr/pkg/bin/figlet
|
# /usr/pkg/bin/figlet |
|
|
That's it. Have fun. Please write comments and questions to the pkgsrc user mailing list: pkgsrc-users@netbsd.org
|
That's it. Have fun. Please write comments and questions to the pkgsrc user mailing list: pkgsrc-users@netbsd.org |
#See also
|
#See also |
|
|
[README.Linux](ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Linux)
|
[README.Linux](ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Linux) |
#Troubleshooting bootstrap
|
#Troubleshooting bootstrap |
##Shell's echo command is not BSD-compatible
|
##Shell's echo command is not BSD-compatible |
|
|
If you see this error
|
If you see this error |
|
|
ERROR: Your shell's echo command is not BSD-compatible.
|
ERROR: Your shell's echo command is not BSD-compatible. |
|
|
This error is known to occur if /bin/sh is linked to /bin/dash (recent Ubuntu versions).
|
This error is known to occur if /bin/sh is linked to /bin/dash (recent Ubuntu versions). |
|
|
The fix is to issue the following before commencing bootstrap: export SH=/bin/bash
|
The fix is to issue the following before commencing bootstrap: export SH=/bin/bash |
##ARG_MAX undeclared
|
##ARG_MAX undeclared |
|
|
If bootstrap stops at
|
If bootstrap stops at |
|
|
In file included from glob.c:12:
|
In file included from glob.c:12: |
__glob13.c: In function globextend:
|
__glob13.c: In function globextend: |
__glob13.c:836: error: ARG_MAX undeclared (first use in this function)
|
__glob13.c:836: error: ARG_MAX undeclared (first use in this function) |
|
|
Then apply this patch [1](http://mail-index.netbsd.org/pkgsrc-bugs/2008/06/21/msg026977.html)
|
Then apply this patch [1](http://mail-index.netbsd.org/pkgsrc-bugs/2008/06/21/msg026977.html) |
##FORTIFY_SOURCE
|
##FORTIFY_SOURCE |
|
|
If bootstrap stops at
|
If bootstrap stops at |
|
|
/usr/pkgsrc/bootstrap/work/bmake/arch.c: In function 'Arch_Touch':
|
/usr/pkgsrc/bootstrap/work/bmake/arch.c: In function 'Arch_Touch': |
/usr/pkgsrc/bootstrap/work/bmake/arch.c:1038: warning: ignoring return
|
/usr/pkgsrc/bootstrap/work/bmake/arch.c:1038: warning: ignoring return |
value of 'fwrite', declared with attribute warn_unused_result
|
value of 'fwrite', declared with attribute warn_unused_result |
*** Error code 1
|
*** Error code 1 |
|
|
This error occurs because Linux uses -DFORTIFY_SOURCES by default. Bootstrap can be achieved by:
|
This error occurs because Linux uses -DFORTIFY_SOURCES by default. Bootstrap can be achieved by: |
|
|
CFLAGS="-U_FORTIFY_SOURCE" ./bootstrap
|
CFLAGS="-U_FORTIFY_SOURCE" ./bootstrap |
|
|
##libncurses not installed
|
##libncurses not installed |
|
|
If bootstrap stops at
|
If bootstrap stops at |
|
|
ERROR: This package has set PKG_FAIL_REASON:
|
ERROR: This package has set PKG_FAIL_REASON: |
ERROR: No usable termcap library found on the system.
|
ERROR: No usable termcap library found on the system. |
|
|
Then install the libncurses-dev package
|
Then install the libncurses-dev package |
|
|
On an RPM based system this might be via 'yum install ncurses-devel', and on a debia/ubuntu system 'apt-get install ncurses5-dev' |
On an RPM based system this might be via 'yum install ncurses-devel', and on a debia/ubuntu system 'apt-get install ncurses5-dev' |
|
|