Bug 191943 - lang/python34 won't build in jail if software and kernel versions doesn't match
Summary: lang/python34 won't build in jail if software and kernel versions doesn't match
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-python (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-18 10:00 UTC by Eir Nym
Modified: 2014-10-01 13:32 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eir Nym 2014-07-18 10:00:54 UTC
Python3.4 version $FreeBSD: head/lang/python34/Makefile 361574 2014-07-11 18:09:01Z sbz $

Environment:

Host system 10 Stable with kernel version (`uname -K`) 1000710, Jail software version (`uname -U`) 1100020.

So Makefile in ports believes that OS version is 1100020, but Python build system believes that OS version is 1000710, so we have bug that

pkg-static: lstat(/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd11/IN.py): No such file or directory

But there is other file on FS: /usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd10/IN.py
Comment 1 John Marino freebsd_committer freebsd_triage 2014-07-20 14:57:37 UTC
over to maintainer
Comment 2 Marcus von Appen freebsd_committer freebsd_triage 2014-08-13 20:08:55 UTC
fix assignment
Comment 3 Bryan Drewery freebsd_committer freebsd_triage 2014-08-13 21:57:27 UTC
Technically it is not supported to build ports in a jail newer than the host like this.

Do you have all of OSVERSION, UNAME_r, UNAME_v set in the jail's environment for FreeBSD 11? These are required for proper cross-release-building.
Comment 4 Bryan Drewery freebsd_committer freebsd_triage 2014-08-13 21:59:05 UTC
Also see Bug #192449
Comment 5 Eir Nym 2014-09-02 21:47:08 UTC
Thank you, Bryan. But same here:


# cat /etc/make.conf 

UNAME_R="11-CURRENT"
UNAME_V="11-CURRENT"
OSVERSION=1100020

# cd /usr/ports/lang/python34
... cutted ...
Compiling '/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd10/IN.py'...
... cutted ...
===>   Registering installation for python34-3.4.1_1
pkg-static: lstat(/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd11/IN.py): No such file or directory
pkg-static: lstat(/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd11/__pycache__/IN.cpython-34.pyc): No such file or directory
pkg-static: lstat(/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd11/__pycache__/IN.cpython-34.pyo): No such file or directory
pkg-static: lstat(/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd11/regen): No such file or directory
pkg-static: lstat(/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd11/__pycache__/): No such file or directory
pkg-static: lstat(/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd11/): No such file or directory
*** Error code 74

Stop.
make[1]: stopped in /usr/ports/lang/python34
*** Error code 1


after setting UNAME_K= 1100020 I'll got same.
Comment 6 Eir Nym 2014-09-02 21:51:19 UTC
setting environment variables doesn't make sense.
Comment 7 Eir Nym 2014-09-02 21:57:45 UTC
From configure output:

configure: loading site script /usr/ports/Templates/config.site
checking build system type... amd64-portbld-freebsd10.0
checking host system type... amd64-portbld-freebsd10.0
Comment 8 Eir Nym 2014-09-02 22:15:52 UTC
found documentation for uname(1) and fixed with variables UNAME_r & UNAME_v. But it doesn't help at the end at all.

# uname -a
FreeBSD builder.local 11-CURRENT 11-CURRENT amd64

# make install
... skip ...
configure: loading site script /usr/ports/Templates/config.site
checking build system type... amd64-portbld-freebsd11
checking host system type... amd64-portbld-freebsd11
... skip ...
cc -c -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -O2 -pipe   -fno-strict-aliasing     -I. -IInclude -I./Include -I/usr/local/include -fPIC -DPy_BUILD_CORE -DPLATFORM='"freebsd11-CURRENT"' -o Python/getplatform.o ./Python/getplatform.c
... skip ...
--- Modules/getpath.o ---
cc -c -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -O2 -pipe   -fno-strict-aliasing     -I. -IInclude -I./Include -I/usr/local/include -fPIC -DPy_BUILD_CORE -DPYTHONPATH='":plat-freebsd11-CURRENT"'  -DPREFIX='"/usr/local"'  -DEXEC_PREFIX='"/usr/local"'  -DVERSION='"3.4"'  -DVPATH='""'  -o Modules/getpath.o ./Modules/getpath.c
... skip ...
mkdir ./Lib/plat-freebsd11-CURRENT
cp ./Lib/plat-generic/regen ./Lib/plat-freebsd11-CURRENT/regen
export PATH; PATH="`pwd`:$PATH";  export PYTHONPATH; PYTHONPATH="`pwd`/Lib";  export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`";  export EXE; EXE="";  if [ -n "" ]; then export MULTIARCH; MULTIARCH=; fi;  export PYTHON_FOR_BUILD;  if [ "amd64-portbld-freebsd11" = "amd64-portbld-freebsd11" ]; then  PYTHON_FOR_BUILD="python";  else  PYTHON_FOR_BUILD="./python -E";  fi;  cd ./Lib/plat-freebsd11-CURRENT; LD_LIBRARY_PATH=/usr/ports/lang/python34/work/Python-3.4.1 ./regen
eval $PYTHON_FOR_BUILD ../../Tools/scripts/h2py.py -i "'(u_long)'" /usr/include/netinet/in.h
... skip ...
Creating directory /usr/local/lib/python3.4/plat-freebsd11-CURRENT
... skip ...
install -o root -g wheel -m 644 build/lib.freebsd-11-CURRENT-amd64-3.4/_sysconfigdata.py /usr/local/lib/python3.4
... skip ...
install -o root -g wheel -m 644 ./Lib/plat-freebsd11-CURRENT/IN.py /usr/local/lib/python3.4/plat-freebsd11-CURRENT
install -o root -g wheel -m 555 ./Lib/plat-freebsd11-CURRENT/regen /usr/local/lib/python3.4/plat-freebsd11-CURRENT
... skip ...
===>   Registering installation for python34-3.4.1_5
pkg-static: lstat(/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd11/IN.py): No such file or directory
pkg-static: lstat(/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd11/__pycache__/IN.cpython-34.pyc): No such file or directory
pkg-static: lstat(/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd11/__pycache__/IN.cpython-34.pyo): No such file or directory
pkg-static: lstat(/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd11/regen): No such file or directory
pkg-static: lstat(/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd11/__pycache__/): No such file or directory
pkg-static: lstat(/usr/ports/lang/python34/work/stage/usr/local/lib/python3.4/plat-freebsd11/): No such file or directory
*** Error code 74
Comment 9 Kubilay Kocak freebsd_committer freebsd_triage 2014-09-05 15:19:53 UTC
Canonicalise python@ assignment.
Comment 10 commit-hook freebsd_committer freebsd_triage 2014-09-30 16:22:58 UTC
A commit references this bug:

Author: bdrewery
Date: Tue Sep 30 16:22:06 UTC 2014
New revision: 369644
URL: https://svnweb.freebsd.org/changeset/ports/369644

Log:
  If either of OSVERSION or UNAME_r is improperly set when building in a
  jail/chroot, a number of unexpected errors can occur.

    1. autotools fixup may not run when needed. This could be avoided by always
       running it [PR 177980, 177403].
    2. Not having UNAME_r set will cause many unknown
       errors. Many ports use OSREL (derived from UNAME_r) to determine the name
       of files. This is usually also due to the port build itself using uname -r
       to derive filenames or 'built for' messages. [PR 192449, 191943] Without
       having these sanity checks it is very easy for users to get into
       situations where "everything worked" until they touch a certain port that
       reads uname(1) output or OSVERSION. It has always been necessary to define
       all of the UNAME_ vars and OSVERSION (or have a proper sys/param.h
       present), but many users do not know this.

  Remove the fallback on the kernel for kern.osreldate as it easily gets the
  answer wrong.

  I have added sanity checks to ensure OSVERSION==OSREL==UNAME_r as these are the
  most critical vars to have set properly.

  Differential Revision:	https://reviews.freebsd.org/D869
  PR:			177980, 177403, 192449, 191943
  Reviewed by:		antoine, bapt, gjb
  With hat:		portmgr

Changes:
  head/CHANGES
  head/Mk/bsd.port.mk
Comment 11 Eir Nym 2014-09-30 20:50:07 UTC
Thank you! This fixes issue... but

Why can't I pass UNAME_r in /etc/make.conf ?
Comment 12 Bryan Drewery freebsd_committer freebsd_triage 2014-09-30 20:52:20 UTC
(In reply to Eir Nym from comment #11)
> Thank you! This fixes issue... but
> 
> Why can't I pass UNAME_r in /etc/make.conf ?

You can, see /usr/ports/CHANGES for example:

OSVERSION+=     1100036
UNAME_ENV+=     OSVERSION=${OSVERSION}
UNAME_ENV+=     UNAME_s=FreeBSD
UNAME_ENV+=     UNAME_r=11.0-CURRENT
UNAME_ENV+=     UNAME_v="${UNAME_s} ${UNAME_r}"
.MAKEFLAGS:     ${UNAME_ENV}
MAKE_ENV+=      ${UNAME_ENV}
CONFIGURE_ENV+= ${UNAME_ENV}
SCRIPTS_ENV+=   ${UNAME_ENV}


Perhaps I should make it simpler so that setting UNAME_* auto propagates to the environment.
Comment 13 Eir Nym 2014-10-01 13:32:15 UTC
I think it better to has less hijacking to set this variables this way.