Bug 237911 - lang/spidermonkey24: 'make configure' fails if devel/py-setuptools_scm is installed
Summary: lang/spidermonkey24: 'make configure' fails if devel/py-setuptools_scm is ins...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Koop Mast
Keywords: needs-qa
Depends on:
Reported: 2019-05-15 12:51 UTC by John Hein
Modified: 2019-05-18 18:46 UTC (History)
4 users (show)

See Also:
koobs: maintainer-feedback? (kwm)


Note You need to log in before you can comment on or make changes to this bug.
Description John Hein 2019-05-15 12:51:56 UTC
'make -C devel/py-setuptools_scm configure' fails if devel/py-setuptools_scm is installed:

checking how to run the C preprocessor... cpp
checking how to run the C++ preprocessor... c++ -E
checking for sb-conf... no
checking for ve... no
checking for a BSD compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for tar archiver... checking for gnutar... no
checking for gtar... no
checking for tar... tar
checking for minimum required perl version >= 5.006... 5.028001
checking for full perl installation... yes
Using Python from environment variable $PYTHON
Creating Python environment
New python executable in /usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/_virtualenv/bin/python2.7
Also creating executable in /usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/_virtualenv/bin/python
Installing setuptools............done.
Installing pip..............
  Complete output from command /usr/ports/l...ualenv/bin/python2.7 -x /usr/ports/l...env/bin/easy_install /usr/ports/l...ort/pip-1.2.1.tar.gz:
  Processing pip-1.2.1.tar.gz
Running pip-1.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-cf5pcO/pip-1.2.1/egg-dist-tmp-HANx5v
error: Setup script exited with error: SandboxViolation: open('/dev/null', 'wb') {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.
...Installing pip...done.
Traceback (most recent call last):
  File "/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/python/virtualenv/virtualenv.py", line 2563, in <module>
  File "/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/python/virtualenv/virtualenv.py", line 964, in main
  File "/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/python/virtualenv/virtualenv.py", line 1076, in create_envir
    install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
  File "/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/python/virtualenv/virtualenv.py", line 667, in install_pip
  File "/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/python/virtualenv/virtualenv.py", line 1042, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /usr/ports/l...ualenv/bin/python2.7 -x /usr/ports/l...env/bin/easy_install /usr/ports/l...ort/pip-1.2.1.tar.gz failed with error code 1
Traceback (most recent call last):
  File "/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/build/virtualenv/populate_virtualenv.py", line 384, in <module>
  File "/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/build/virtualenv/populate_virtualenv.py", line 103, in ensure
    return self.build()
  File "/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/build/virtualenv/populate_virtualenv.py", line 315, in build
  File "/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/build/virtualenv/populate_virtualenv.py", line 122, in create
    raise Exception('Error creating virtualenv.')
Exception: Error creating virtualenv.
------ config.log ------
configure:3021: cc -c -O2 -pipe  -DJS_C_STRINGS_ARE_UTF8 -fstack-protector -fno-strict-aliasing  -I/usr/local/include conftest.c 1>&5
configure:3017:1: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Wimplicit-function-declaration]
exit (42);
configure:3017:1: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
1 warning generated.
configure:3040: checking for ranlib
configure:3072: checking for as
configure:3126: checking for ar
configure:3161: checking for ld
configure:3196: checking for strip
configure:3231: checking for windres
configure:3751: checking how to run the C preprocessor
configure:3831: checking how to run the C++ preprocessor
configure:3849: c++ -E -I/usr/local/include conftest.C >/dev/null 2>conftest.out
configure:3908: checking for sb-conf
configure:3908: checking for ve
configure:3970: checking for a BSD compatible install
configure:4023: checking whether ln -s works
configure:4045: checking for tar archiver
configure:4051: checking for gnutar
configure:4051: checking for gtar
configure:4051: checking for tar
configure:4089: checking for minimum required perl version >= 5.006
configure:4100: checking for full perl installation
===>  Script "configure" failed unexpectedly.
Please report the problem to kwm@FreeBSD.org [maintainer] and attach the

Noticed on 11-stable/amd64.

I don't have a fix at the moment, but perhaps PYTHONPATH could be set to look in ${WRKSRC} only (or before LOCALBASE).
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-05-15 12:59:33 UTC
Thanks for the report John

The port really shouldn't be creating a Python environment/virtualenv or fetching things to do so, and should (only) be using the system Python environment and *_DEPEND'ing on the requisite python packages it needs (if any).

To confirm again, this behaviour *does not* occur if setuptools_scm port is not installed?

Is this a regression after a particular version, or did you just happen to notice it after something requiring setuptools_scm was installed?

Is the issue contingent/dependent on an OPTION or other condition?
Comment 2 John Hein 2019-05-15 16:07:46 UTC
(In reply to Kubilay Kocak from comment #1)
I'm not sure about a regression.  I just noticed it when trying to build spidermonkey24 after its PORTREVISION was bumped.

Previous (successful) build of spidermonkey24 was 24.2.0_9 (built 20181220).  At that time py-setuptools_scm was at 1.15.5, but I have not tried to determine if that particular combination (vs py-setuptools_scm 3.1.0 now) is relevant.  It's possible there is a regression (dependent on py-setuptools_scm version).

I suspect you're right that the spidermonkey24 port could / should be convinced to use the system install of python but that may not fix this problem.  I don't know yet how to get the spidermonkey24 port to do that.

Yes (re: "to confirm again"), I can build before py-setuptools_scm is installed, and not after.  I used poudriere testport with -i to build successfully.  Then while still in the jail (due to the -i), I remove spidermonkey24's work dir, do 'make -C /usr/ports/devel/py-setuptools_scm install', then 'make -C /usr/ports/lang/spidermonkey24 configure' (which now fails).

I also don't know if the options combination is important (I suspect not), but for the record the options I have are set like so (which I think is the default + UTF8):

Comment 3 John Hein 2019-05-15 16:12:35 UTC
(In reply to John Hein from comment #2)
I just installed py-setuptools_scm PORTVERSION 1.17.0 in the poudriere jail (after deleting the installed 3.1.0), and 'make -C /usr/ports/lang/spidermonkey24 configure' succeeds.
Comment 4 John Hein 2019-05-15 16:21:41 UTC
(In reply to Kubilay Kocak from comment #1)
Also regarding whether to use virtualenv or not, I don't necessarily think it's bad for spidermonkey24 to use virtualenv, particularly if it only needs it for building (vs. a run-time dependency).  Having a port isolate itself from the installed environment can be a reasonable strategy.  Yes, pros / cons exist, and we don't need to get too deep into that here, I think.

Ultimately, I could use someone with python expertise to help determine the root cause of this failure so we can figure out if we should fix spidermonkey24 or if there is something wrong with py-setuptools_scm (or something else).
Comment 5 John Hein 2019-05-18 18:04:08 UTC
Clarification that may have already been obvious:  the py-setuptools_scm flavor that interferes is @py27.  Now that the default python is py36, this is important to mention if you are trying to reproduce.  Of course, if only py-setuptools_scm@py36 is installed, then the python2.7 (that spidermonkey24 uses) won't see it, and thus you won't reproduce the failure.

So the reproduction instructions in comment 2 should say 'make -C /usr/ports/devel/py-setuptools_scm install FLAVOR=py27' in case your ports tree is after the default python switched from py27 -> py36.
Comment 6 John Hein 2019-05-18 18:46:49 UTC
I don't have a fix yet, but potential workarounds include:

(1) 'pkg delete py27-setuptools_scm'.  Leave deleted if you don't need it, or re-add after building & installing spidermonkey24.

(2) mv -i /usr/local/lib/python2.7/site-packages/setuptools_scm-3.1.0-py2.7.egg-info /usr/local/lib/python2.7/site-packages/setuptools_scm-3.1.0-py2.7.egg-info.mv

   Then rename back after building & installing spidermonkey24.