4

I'm new to NetBSD, although often using pkgsrc on ubuntu. I can build and install packages from source without any effect ubuntu's package dependencies.

For example, even if ruby 2.2 is installed by apt-get, I can build and install ruby 2.3 into $HOME/pkg/bin by pkgsrc. I can use ruby 2.3 without any dependency problems.

This feature have been very helpful to me and that is why I love pkgsrc so far.

Now I installed NetBSD 7.1 to my another PC. I want to download pkgsrc as my own package manager and want to build packages into my home directory($HOME/pkg/bin), without any system-wide effect as I'm doing on ubuntu, even though NetBSD itself uses pkgsrc.

When I tried ./bootstrap --unpriviledged in the home directory, it didn't work. Before I ask why with detail error messages, let me ask whether NetBSD is designed or considered that downloading and using another pkgsrc for each user without any effect to the system environment.

P.S English is not my native language; please excuse typing, grammar or/and word selecting errors.

UPDATE(2017/04/08)

Thanks to Greg A. Woods's answer, I understood I have to show detail error messages.

At first, I had always installed from binary using pkg_add with root account.

-bash-4.4$ uname -a
NetBSD hello-netbsd 7.1 NetBSD 7.1 (GENERIC.201703111743Z) amd64


-bash-4.4$ pkg_info -a
sudo-1.8.17p1       Allow others to run commands as root
bash-4.4.012        The GNU Bourne Again Shell
cvs-1.12.13nb4      Concurrent Versions System
gcc6-6.3.0          The GNU Compiler Collection (GCC) - 6 Release Series

Then I logined as a non root user, downloaded pkgsrc and bootstrap.

-bash-4.4$ cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2017Q1 -P pkgsrc
-bash-4.4$ cd pkgsrc/bootstrap
-bash-4.4$ ./bootstrap --unprivileged
...
...
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home/vagrant/pkgsrc/bootstrap/work/bmake':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
===> exited with status 1
aborted.

I modified $PATH.

-bash-4.4$ vi ~/.profile
PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin:/usr/X11R6/bin:/usr/pkg/bin
PATH=${PATH}:/usr/pkg/sbin:/usr/games:/usr/local/bin:/usr/local/sbin
GCC_PATH=/usr/pkg/gcc6/bin
PATH=${PATH}:${GCC_PATH}

-bash-4.4$  . ~/.profile
-bash-4.4$  echo $PATH
/home/vagrant/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin:/usr/X11R6/bin:/usr/pkg/bin:/usr/pkg/sbin:/usr/games:/usr/local/bin:/usr/local/sbin:/usr/pkg/gcc6/bin

then tried again.

-bash-4.4$ rm -fr work 
-bash-4.4$ ./bootstrap --unprivileged
...
...
checking for gcc... gcc
checking for C compiler default output file name... 
configure: error: in `/home/vagrant/pkgsrc/bootstrap/work/bmake':
configure: error: C compiler cannot create executables
See `config.log' for more details.
===> exited with status 77
aborted.

config.log was like this:

-bash-4.4$ view work/bmake/config.log

      1 This file contains any messages produced by compilers while
      2 running configure, to aid debugging if configure makes a mistake.
      3 
      4 It was created by bmake configure 20140214, which was
      5 generated by GNU Autoconf 2.64.  Invocation command line was
      6 
      7   $ configure --prefix=/home/vagrant/pkgsrc/bootstrap/work --with-default-sys-path=/home/vagrant/pkgsrc/bootstrap/work
/share/mk --with-machine-arch=x86_64
      8 
      9 ## --------- ##
     10 ## Platform. ##
     11 ## --------- ##
     12
     13 hostname = hello-netbsd
     14 uname -m = amd64
     15 uname -r = 7.1
     16 uname -s = NetBSD
     17 uname -v = NetBSD 7.1 (GENERIC.201703111743Z)
     18
     19 /usr/bin/uname -p = x86_64
     20 /bin/uname -X     = unknown
     21
     22 /bin/arch              = unknown
     23 /usr/bin/arch -k       = unknown
     24 /usr/convex/getsysinfo = unknown
     25 /usr/bin/hostinfo      = unknown
     26 /bin/machine           = unknown
     27 /usr/bin/oslevel       = unknown
     28 /bin/universe          = unknown
     29
     30 PATH: /home/vagrant/pkg/bin
     31 PATH: /home/vagrant/pkg/sbin
     32 PATH: .
     33 PATH: /home/vagrant/bin
     34 PATH: /bin
     34 PATH: /bin
     35 PATH: /sbin
     36 PATH: /usr/bin
     37 PATH: /usr/sbin
     38 PATH: /usr/X11R7/bin
     39 PATH: /usr/X11R6/bin
     40 PATH: /usr/pkg/bin
     41 PATH: /usr/pkg/sbin
     42 PATH: /usr/games
     43 PATH: /usr/local/bin
     44 PATH: /usr/local/sbin
     45 PATH: /usr/pkg/gcc6/bin
     46 PATH: /sbin
     47 PATH: /usr/sbin
     48
     49 
     50 ## ----------- ##
     51 ## Core tests. ##
     52 ## ----------- ##
     53 
     54 configure:2371: checking for gcc
     55 configure:2387: found /usr/pkg/gcc6/bin/gcc
     56 configure:2398: result: gcc
     57 configure:2627: checking for C compiler version
     58 configure:2636: gcc --version >&5
     59 gcc (GCC) 6.3.0
     60 Copyright (C) 2016 Free Software Foundation, Inc.
     61 This is free software; see the source for copying conditions.  There is NO
     62 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     63 
     64 configure:2647: $? = 0
     65 configure:2636: gcc -v >&5
     66 Using built-in specs.
     67 COLLECT_GCC=gcc
     68 COLLECT_LTO_WRAPPER=/usr/pkg/gcc6/libexec/gcc/x86_64--netbsd/6.3.0/lto-wrapper
     69 Target: x86_64--netbsd
     70 Configured with: ../gcc-6.3.0/configure --disable-libstdcxx-pch --enable-nls --with-libiconv-prefix=/usr --enable-__cx
a_atexit --with-gxx-include-dir=/usr/pkg/gcc6/include/c++/ --enable-languages='c obj-c++ objc fortran c++' --enable-shared --e
nable-long-long --with-local-prefix=/usr/pkg/gcc6 --disable-libssp --enable-threads=posix --with-boot-ldflags='-static-libstdc
++ -static-libgcc -Wl,-R/usr/pkg/lib ' --with-arch=nocona --with-tune=nocona --with-fpmath=sse --with-gnu-ld --with-ld=/usr/bi
n/ld --with-gnu-as --with-as=/usr/bin/as --prefix=/usr/pkg/gcc6 --build=x86_64--netbsd --host=x86_64--netbsd --infodir=/usr/pk
g/gcc6/info --mandir=/usr/pkg/gcc6/man
     71 Thread model: posix
     72 gcc version 6.3.0 (GCC)
     73 configure:2647: $? = 0
     74 configure:2636: gcc -V >&5
     75 gcc: error: unrecognized command line option '-V'
     76 gcc: fatal error: no input files
     77 compilation terminated.
     78 configure:2647: $? = 1
     79 configure:2636: gcc -qversion >&5
     80 gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
     81 gcc: fatal error: no input files
     82 compilation terminated.
     83 configure:2647: $? = 1
     84 configure:2669: checking for C compiler default output file name
     85 configure:2691: gcc    conftest.c  >&5
     86 In file included from conftest.c:9:0:
     87 /usr/pkg/gcc6/lib/gcc/x86_64--netbsd/6.3.0/include-fixed/stdio.h:54:23: fatal error: sys/cdefs.h: No such file or dire
ctory
     88  #include <sys/cdefs.h>
     89                        ^
     90 compilation terminated.
     91 configure:2695: $? = 1
     92 configure:2732: result:
     93 configure: failed program was:
     94 | /* confdefs.h */
     95 | #define PACKAGE_NAME "bmake"
     96 | #define PACKAGE_TARNAME "bmake"
     97 | #define PACKAGE_VERSION "20140214"
     98 | #define PACKAGE_STRING "bmake 20140214"
     99 | #define PACKAGE_BUGREPORT "sjg@NetBSD.org"
    100 | #define PACKAGE_URL ""
    101 | /* end confdefs.h.  */
    102 | #include <stdio.h>
    103 | int
    104 | main ()
    105 | {
    106 | FILE *f = fopen ("conftest.out", "w");
    107 |  return ferror (f) || fclose (f) != 0;
    108 |
    109 |   ;
    110 |   return 0;
    111 | }
    112 configure:2738: error: in `/home/vagrant/pkgsrc/bootstrap/work/bmake':
    113 configure:: error: C compiler cannot create executables
    114 See `config.log' for more details.
    115
    116 ## ---------------- ##
    117 ## Cache variables. ##
    118 ## ---------------- ##
    119
    120 ac_cv_env_CC_set=
    121 ac_cv_env_CC_value=
    122 ac_cv_env_CFLAGS_set=
    123 ac_cv_env_CFLAGS_value=
    124 ac_cv_env_CPPFLAGS_set=
    125 ac_cv_env_CPPFLAGS_value=
    126 ac_cv_env_CPP_set=
    127 ac_cv_env_CPP_value=
    128 ac_cv_env_LDFLAGS_set=
    129 ac_cv_env_LDFLAGS_value=
    130 ac_cv_env_LIBS_set=
    131 ac_cv_env_LIBS_value=
    132 ac_cv_env_build_alias_set=
    133 ac_cv_env_build_alias_value=
    134 ac_cv_env_host_alias_set=
    135 ac_cv_env_host_alias_value=
    136 ac_cv_env_target_alias_set=
    137 ac_cv_env_target_alias_value=
    138 ac_cv_prog_ac_ct_CC=gcc
    139
    140 ## ----------------- ##
    141 ## Output variables. ##
    142 ## ----------------- ##
    143
    144 CC='gcc'
    145 CFLAGS=''
    146 CPP=''
    147 CPPFLAGS=''
    148 DEFS=''
    149 ECHO_C=''
    150 ECHO_N='-n'
    151 ECHO_T=''
    152 EGREP=''
    153 EXEEXT=''
    154 GCC=''
    155 GREP=''
    156 INSTALL=''
    157 INSTALL_DATA=''
    158 INSTALL_PROGRAM=''
    159 INSTALL_SCRIPT=''
    160 LDFLAGS=''
    161 LIBOBJS=''
    162 LIBS=''
    163 LTLIBOBJS=''
    164 OBJEXT=''
    165 PACKAGE_BUGREPORT='sjg@NetBSD.org'
    166 PACKAGE_NAME='bmake'
    167 PACKAGE_STRING='bmake 20140214'
    168 PACKAGE_TARNAME='bmake'
    169 PACKAGE_URL=''
    170 PACKAGE_VERSION='20140214'
    171 PATH_SEPARATOR=':'
    172 SHELL='/bin/sh'
    173 ac_ct_CC='gcc'
    174 ac_exe_suffix=''
    175 bindir='${exec_prefix}/bin'
    176 bmake_path_max=''
    177 build_alias=''
    178 datadir='${datarootdir}'
    179 datarootdir='${prefix}/share'
    180 default_sys_path=''
    181 diff_u=''
    182 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
    183 dvidir='${docdir}'
    184 exec_prefix='NONE'
    185 filemon_h='no'
    186 force_machine=''
    187 host_alias=''
    188 htmldir='${docdir}'
    189 includedir='${prefix}/include'
    190 infodir='${datarootdir}/info'
    191 libdir='${exec_prefix}/lib'
    192 libexecdir='${exec_prefix}/libexec'
    193 localedir='${datarootdir}/locale'
    194 localstatedir='${prefix}/var'
    195 machine=''
    196 machine_arch=''
    197 mandir='${datarootdir}/man'
    198 mksrc=''
    199 oldincludedir='/usr/include'
    200 pdfdir='${docdir}'
    201 prefix='/home/vagrant/pkgsrc/bootstrap/work'
    202 program_transform_name='s,x,x,'
    203 psdir='${docdir}'
    204 sbindir='${exec_prefix}/sbin'
    205 sharedstatedir='${prefix}/com'
    206 sysconfdir='${prefix}/etc'
    207 target_alias=''
    208 use_meta='yes'
    209
    210 ## ----------- ##
    211 ## confdefs.h. ##
    212 ## ----------- ##
    213
    214 /* confdefs.h */
    215 #define PACKAGE_NAME "bmake"
    216 #define PACKAGE_TARNAME "bmake"
    217 #define PACKAGE_VERSION "20140214"
    218 #define PACKAGE_STRING "bmake 20140214"
    219 #define PACKAGE_BUGREPORT "sjg@NetBSD.org"
    220 #define PACKAGE_URL ""
    221
    222 configure: exit 77

I guessed some files were missing, but couldn't understand what to do.

update2(2017/04/11) the following is the result of `gcc -v'

-bash-4.4$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/pkg/gcc6/libexec/gcc/x86_64--netbsd/6.3.0/lto-wrapper
Target: x86_64--netbsd
Configured with: ../gcc-6.3.0/configure --disable-libstdcxx-pch --enable-nls --with-libiconv-prefix=/usr --enable-__cxa_atexit --with-gxx-include-dir=/usr/pkg/gcc6/include/c++/ --enable-languages='c obj-c++ objc fortran c++' --enable-shared --enable-long-long --with-local-prefix=/usr/pkg/gcc6 --disable-libssp --enable-threads=posix --with-boot-ldflags='-static-libstdc++ -static-libgcc -Wl,-R/usr/pkg/lib ' --with-arch=nocona --with-tune=nocona --with-fpmath=sse --with-gnu-ld --with-ld=/usr/bin/ld --with-gnu-as --with-as=/usr/bin/as --prefix=/usr/pkg/gcc6 --build=x86_64--netbsd --host=x86_64--netbsd --infodir=/usr/pkg/gcc6/info --mandir=/usr/pkg/gcc6/man
Thread model: posix
gcc version 6.3.0 (GCC) 

And I chose minimum install at the installation process. Is that wrong?

  • 1
    It continues to look like you didn't install the comp set when you installed NetBSD. Without the comp.tgz set, you don't have the necessary include files or shared libraries for building executables. To verify which sets you installed, look in /etc/mtree, and see if the file set.comp exists. – Eric Schnoebelen Apr 10 '17 at 23:12
  • 1
    The config.log you've posted above shows that you've apparently installed a version of GCC from a package collection (i.e. you have /usr/pkg/gcc6/bin/gcc). As Eric says, you've not yet installed the comp.tgz set yet, so you don't have a system compiler, nor any system headers (i.e. you do not have /usr/bin/cc). Reboot from your install media and install the comp.tgz set -- or better yet reinstall with everything -- the minimal install is not suitable for a system to be used for software development and/or testing -- you will want all parts of the system installed. – Greg A. Woods Apr 12 '17 at 2:16
2

Always supply detailed error messages! (or at least more than enough to give a clue as to what actual problem is being encountered as this avoids unnecessary extra exchanges -- many folks will simply ignore questions if there's not enough information to provide any meaningful direction)

Anyway, ./bootstrap --unprivileged should work on a NetBSD host (it worked for me).

I'm not sure it's a good idea though. Some things won't (and cannot) be installed in unprivileged mode, since they must either modify system files, or be installed setuid, etc.

I build packages as a normal user, but always install them as root.

2

looks like you didn't install the "comp" set for netbsd, which is the C compiler (etc.). Try running "gcc -v".

FWIW, the best NetBSD and pkgsrc help is achieved via the Mailing lists, I only saw this here by accident, via http://netbsd.fi/

  • 1
    Welcome to Stack Exchange. You should edit both your answers into a single one. – Glorfindel Apr 8 '17 at 11:51
  • thanks. but how can I do gcc -v with ./bootstrap ? I might be wrong, but I couldn't find any options to bootstrap for debug ones like verbose keyword. (I checked ./bootstrap --help) – cul8er Apr 8 '17 at 12:08
  • @hubertf is saying to attempt to run "gcc -v " from the command line. GCC is part of the comp.tgz set that can be installed when NetBSD is installed. If you don't have gcc (a C ompiler) you're not going to be able to bootstrap pkgsrc. – Eric Schnoebelen Apr 9 '17 at 3:58
2

I finally solved this problem. As they said, what I should do was to download comp.tgz and unpack it. In addition, There was a FAQ in NetBSD website.

# cd /
# ftp ftp://ftp.netbsd.org (as an anonymous user)
> cd pub/NetBSD/NetBSD-7.1/amd64/binary/sets
> get comp.tgz
> exit
# tar --unlink -zxvpf comp.tgz

After doing this, ./bootstrap --unprivileged worked in my home directory(as a non-root user).

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.