I did a minimal install of NetBSD 6.1.2 and thought it would be easy to install a working gcc package. But even after pkg_add -r gcc48 gcc48-libs and adding gcc to the path, gcc is still not able to compile simple programs.

Which packages do I need and which additional config steps are necessary ?

  • 4
    If you installed the comp package, you should have gcc. You say that "gcc is still not able to compile simple programs." What does that mean? What errors do you encounter?
    – schaiba
    Jan 2, 2014 at 17:01
  • pkg_add didn't find a 'comp' package. One error I'm getting from including stdio.h that sys/cdefs.h is missing. Jan 2, 2014 at 17:32
  • 1
    It's not a pkg_add package. It's one of the system packages.
    – schaiba
    Jan 2, 2014 at 17:59

2 Answers 2


You installed system gcc compiler. Your original question was how to install gcc-4.8xx. If you are using pkgsrc the easiest thing is

cd /usr/pkgsrc/lang/gcc48
make install clean clean-depens

Note that NetBSD has multiple versions of gcc compiler the 2.9.5 probably the most useful and the last truly portable gcc version. The first place to check for pkgsrc package is


you also want to read documentation on pkgsrc


NetBSD also has new binary packaging system pkgin which is very similar to Yum and apt-get but I am not a regular NetBSD user so you would want to check documentation how to use pkgng

  • Any gcc version is fine by me. At first I didn't realize there are so many versions to choose from. Thanks for your explanation for gcc 4.8! Jan 3, 2014 at 17:20

Installing the comp package did the trick and added gcc 4.5.3.

tar -C / -xpzf /path/to/comp.tgz


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .