pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkgsrc on OpenBSD



Hi forks,

I struggled to let pkgsrc work on OpenBSD.  I'm not an OpenBSD user but had to
set up an OpenBSD box with pkgsrc.  I experienced some problems which could be
improved.

I use up-to-date OpenBSD/amd64.


  $ uname -a
  OpenBSD openbsd00.local 6.2 GENERIC#132 amd64


After putting CVS head of pkgsrc, simple bootstrapping fails.


  # cd /usr/pkgsrc/bootstrap
  # ./bootstrap
  :
  ===> running: (cd /usr/pkgsrc/pkgtools/cwrappers && /usr/pkgsrc/bootstrap/work/bin/bmake  MAKE_JOBS=1 PKG_COMPRESSION=none MAKECONF=/usr/pkgsrc/bootstrap/work/mk.conf install)
  malloc() warning: unknown char in MALLOC_OPTIONS
  ===> Installing dependencies for cwrappers-20180325
  => Build dependency gcc3-c>=3.3.5nb1: NOT found
  => Verifying reinstall for ../../lang/gcc3-c
  malloc() warning: unknown char in MALLOC_OPTIONS
  => Bootstrap dependency digest>=20010302: NOT found
  => Verifying reinstall for ../../pkgtools/digest
  malloc() warning: unknown char in MALLOC_OPTIONS
  ===> Installing dependencies for digest-20160304
  => Build dependency cwrappers>=20150314: NOT found
  => Verifying reinstall for ../../pkgtools/cwrappers
  malloc() warning: unknown char in MALLOC_OPTIONS
  ERROR: This package has set PKG_FAIL_REASON:
  ERROR: Circular dependency detected


As the log above, pkgtools/cwrappers tries to install lang/gcc3-c and it
causes a circular dependency.  With a short survey, I found /usr/bin/cc is
Clang.


  $ /usr/bin/cc --version
  OpenBSD clang version 4.0.0 (tags/RELEASE_400/final) (based on LLVM 4.0.0)
  Target: amd64-unknown-openbsd6.2
  Thread model: posix
  InstalledDir: /usr/bin


Designating Clang as pkgsrc compiler resolves this problem but another arises.


  # env PKGSRC_COMPILER=clang CLANGBASE=/usr ./bootstrap
  :
  cc -lssl -lcrypto -L/usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/bzip2 -L/usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/libarchive/.libs -L/usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/libfetch -L/usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/netpgp -L/usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/libnbcompat -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -L../lib -o pkg_add main.o perform.o -linstall -lnetpgpverify -larchive -lbz2 -lz -lfetch -lssl -lcrypto -lcrypto -lbz2 -lz -lnbcompat -lnbcompat
  /usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/libarchive/.libs/libarchive.a(archive_read_open_filename.o): In function `archive_read_open_filenames':
  libarchive/archive_read_open_filename.c:(.text+0x11b): warning: warning: strcpy() is almost always misused, please use strlcpy()
  /usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/libarchive/.libs/libarchive.a(archive_acl.o): In function `append_entry_w':
  libarchive/archive_acl.c:(.text+0xcd3): warning: warning: wcscpy() is almost always misused, please use wcslcpy()
  ../lib/libinstall.a(var.o): In function `var_get':
  var.c:(.text+0x2a0): warning: warning: sprintf() is often misused, please use snprintf()
  /usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/libarchive/.libs/libarchive.a(archive_check_magic.o): In function `__archive_check_magic':
  libarchive/archive_check_magic.c:(.text+0x174): warning: warning: strcat() is almost always misused, please use strlcat()
  ../lib/libinstall.a(pkcs7.o): In function `easy_pkcs7_verify':
  pkcs7.c:(.text+0x15f): undefined reference to `X509_get_extended_key_usage'
  pkcs7.c:(.text+0x173): undefined reference to `X509_get_extension_flags'
  ../lib/libinstall.a(pkcs7.o): In function `easy_pkcs7_sign':
  pkcs7.c:(.text+0x48f): undefined reference to `X509_get_extended_key_usage'
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  *** [pkg_add] Error code 1

  bmake[1]: stopped in /usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/pkg_install-20180325/add
  1 error

  bmake[1]: stopped in /usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/pkg_install-20180325/add
  *** [all] Error code 1

  bmake: stopped in /usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/pkg_install-20180325
  1 error

  bmake: stopped in /usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/pkg_install-20180325
  *** Error code 2

  Stop.
  bmake[1]: stopped in /usr/pkgsrc/pkgtools/pkg_install
  malloc() warning: unknown char in MALLOC_OPTIONS
  *** Error code 1

  Stop.
  bmake: stopped in /usr/pkgsrc/pkgtools/pkg_install
  ===> exited with status 1
  aborted.


This is because pkg_install isn't compatible with OpenBSD's SSL library (aka
LibreSSL).  Following README.OpenBSD instruction resolves this issue by
building pkg_install without SSL support and bootstrapping succeeds.


  # env PKGSRC_COMPILER=clang CLANGBASE=/usr ./bootstrap --prefer-pkgsrc=openssl


However pkgsrc doesn't work fine yet.  It selects net/tnftp as fetch command.
Nowadays fetch command must be compliant with HTTPS for sites such as GitHub.
SSL-enabled net/tnftp depends on security/openssl because we preferred
pkgsrc's openssl to resolve pkg_install issue.  And of course security/openssl
depends on net/tnftp as fetch command.  Another circular dependency arises
here.

Fortunately /usr/bin/ftp can handle both HTTP and HTTPS (it seems tnftp by the
way), designating /usr/bin/ftp as fetch command resolves this dependency.

Resulting addtional lines to mk.conf are:


  USE_NATIVE_GCC=         yes
  PKGSRC_COMPILER=        clang
  CLANGBASE=              /usr
  PREFER_PKGSRC=          openssl
  TOOLS_IGNORE.ftp=       yes
  TOOLS_PATH.ftp=         /usr/bin/ftp


Set aside pkg_install issue, cc and fetch command issues seem to be improved.


Regards,
  Kogule, Ryo

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail



Home | Main Index | Thread Index | Old Index