<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thanks to your help, I’ve been able to edit setup.py akin to what you’ve done in py-tensorflow and have solved the long timeout issue, but not the underlying cause of the hang.<div class=""><br class=""></div><div class="">The command:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="4" class="">sudo port build py37-dm-tree</font></span></div></blockquote><div class=""><br class=""></div>fails to build (with no reported errors, except that it fails). However, running the python build command by hand in ${worksrcpath} works:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="4" class="">sudo -u macports bash -c 'python3.7 setup.py --no-user-cfg build -j6'</font></span></div></blockquote><div class=""><br class=""></div><div class="">I don’t know enough about “the wonderful bazel build system …” to troubleshoot, but I have a few hypotheses:</div><div class=""><ul class="MailOutline"><li class="">There’s some issue with handling bazel output when run within the port command</li><li class="">There’s some issue with bazel downloading [???] things it needs when run within port (e.g. in this case it’s getting @com_google_absl from somewhere)</li></ul><div class=""><br class=""></div></div><div class="">Any pointers would be appreciated. I don’t <a href="https://github.com/macports/macports-ports/search?q=bazel&unscoped_q=bazel" class="">see</a> any existing Portfiles that use bazel from within a setup.py. I’ve attached the draft Portfile and setup.py.patch below.</div><div class=""><br class=""></div><div class=""></div><div class=""><br class=""></div><div class="">By the way, a successful by-hand build produces many SUBCOMMAND lines like this:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-size: 12px;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class="">SUBCOMMAND: </span><span style="font-variant-ligatures: no-common-ligatures" class=""># @com_google_absl//absl/numeric:int128 [action 'Linking external/com_google_absl/absl/numeric/libint128.a', configuration: e2b2526ee351b893fa655145c6fbfa76bc6002a7b6841de71a5ce32b31c693d5]</span></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; font-size: 12px;" class="">(cd /opt/local/var/macports/build/_opt_local_ports_python_py-dm-tree/py37-dm-tree/work/760db6fa436447021e976cb8885c1247/execroot/tree && \</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; font-size: 12px;" class="">  exec env - \</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; font-size: 12px;" class="">    APPLE_SDK_PLATFORM=MacOSX \</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; font-size: 12px;" class="">    APPLE_SDK_VERSION_OVERRIDE=10.15 \</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; font-size: 12px;" class="">    PATH='/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/opt/X11/bin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/Library/Apple/usr/bin:/usr/local/bin' \</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; font-size: 12px;" class="">    XCODE_VERSION_OVERRIDE=11.5.0.11E608c \</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; font-size: 12px;" class="">  external/local_config_cc/libtool -no_warning_for_no_symbols -static -o bazel-out/darwin-opt/bin/external/com_google_absl/absl/numeric/libint128.a bazel-out/darwin-opt/bin/external/com_google_absl/absl/numeric/_objs/int128/int128.o)</span></div></blockquote></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></div><div class=""><br class=""></div><div class=""><br class=""><div class="">Draft Portfile:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class=""># -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4</div><div class=""><br class=""></div><div class="">PortSystem          1.0</div><div class="">PortGroup           compiler_blacklist_versions 1.0</div><div class="">PortGroup           github 1.0</div><div class="">PortGroup           java 1.0</div><div class="">PortGroup           python 1.0</div><div class="">PortGroup           xcode_workaround 1.0</div><div class=""><br class=""></div><div class="">github.setup        deepmind tree 2b81872</div><div class=""># no official release; version from __init__.py plus github commit date</div><div class="">version             0.1.6.20200524</div><div class="">name                py-dm-${github.project}</div><div class="">revision 0</div><div class=""><br class=""></div><div class="">platforms           darwin</div><div class="">license             Apache-2</div><div class="">maintainers         nomaintainer</div><div class=""><br class=""></div><div class="">description         Deepmind tree is a library for working with nested\</div><div class="">                    data structures.</div><div class="">long_description    ${description} In a way, tree generalizes the builtin\</div><div class="">                    map function which only supports flat sequences, and\</div><div class="">                    allows to apply a function to each "leaf" preserving\</div><div class="">                    the overall structure.</div><div class=""><br class=""></div><div class="">homepage            <a href="https://github.com/deepmind/tree" class="">https://github.com/deepmind/tree</a></div><div class="">distname            ${github.project}-${version}</div><div class=""><br class=""></div><div class="">checksums           rmd160  40518b306e8f5a80b12ef5e76ca9e2f8ef232de3 \</div><div class="">                    sha256  0748428f70fae2209b8763bf99cadaf22276a4391851ba919dce9d3d0bc047bf \</div><div class="">                    size    35176</div><div class=""><br class=""></div><div class="">python.versions     37 38</div><div class=""><br class=""></div><div class=""># Required java version</div><div class="">java.version        11+</div><div class=""># JDK port to install if required java not found</div><div class="">java.fallback       openjdk14</div><div class=""># JDK only needed at build time, but java PG sets lib dependency so</div><div class=""># declare no conflict to allow redistribution of binaries.</div><div class="">license_noconflict  ${java.fallback}</div><div class=""><br class=""></div><div class=""># require c++14</div><div class="">compiler.cxx_standard 2014</div><div class=""><br class=""></div><div class=""># The oldest Xcode version to use default Xcode compiler</div><div class=""># <a href="https://github.com/tensorflow/tensorflow/issues/39262" class="">https://github.com/tensorflow/tensorflow/issues/39262</a></div><div class="">set tf_min_xcode    10.2</div><div class="">compiler.blacklist-append {clang < 1001}</div><div class=""># Work out if we should be using macports clang</div><div class="">set use_mp_clang [ expr ( [ string match macports-clang-* ${configure.compiler} ] || [ vercmp ${xcodeversion} ${tf_min_xcode} ] < 0 ) ]</div><div class=""><br class=""></div><div class="">proc python_listify {tcl_list} {</div><div class="">    set python_list {}</div><div class="">    foreach item [lreverse ${tcl_list}] {</div><div class="">        set python_list "'${item}', ${python_list}"</div><div class="">    }</div><div class="">    return ${python_list}</div><div class="">}</div><div class=""><br class=""></div><div class="">if {${name} ne ${subport}} {</div><div class="">    depends_build-append \</div><div class="">                    port:bazel \</div><div class="">                    port:py${python.version}-setuptools</div><div class=""><br class=""></div><div class="">    depends_run-append \</div><div class="">                    port:py${python.version}-six \</div><div class=""><br class=""></div><div class="">    depends_test-append \</div><div class="">                    port:py${python.version}-absl \</div><div class="">                    port:py${python.version}-attrs \</div><div class="">                    port:py${python.version}-numpy \</div><div class="">                    port:py${python.version}-pytest \</div><div class="">                    port:py${python.version}-wrapt</div><div class=""><br class=""></div><div class="">    # Limit the number of parallel jobs to the number of physical, not logical, cpus.</div><div class="">    # First current setting to ensure we would be reducing the current setting.</div><div class="">    set physicalcpus [sysctl hw.physicalcpu]</div><div class="">    if { ${build.jobs} > ${physicalcpus} } {</div><div class="">        build.jobs ${physicalcpus}</div><div class="">    }</div><div class=""><br class=""></div><div class="">    # Build using the wonderful bazel build system ...</div><div class="">    set bazel_cmd "bazel --max_idle_secs=60 --output_user_root=${workpath}"</div><div class="">    set bazel_build_opts "--subcommands --compilation_mode=opt --verbose_failures"</div><div class="">    # Limit bazel resource utilisation</div><div class="">    set bazel_build_opts "${bazel_build_opts} --jobs ${build.jobs} --local_ram_resources=HOST_RAM*0.75 --local_cpu_resources=HOST_CPUS*.75"</div><div class="">    # Explicitly pass SDK <a href="https://github.com/bazelbuild/rules_go/issues/1554" class="">https://github.com/bazelbuild/rules_go/issues/1554</a></div><div class="">    # Check versioned SDK actually exists... <a href="https://trac.macports.org/ticket/60317" class="">https://trac.macports.org/ticket/60317</a></div><div class="">    if {[string first ${configure.sdk_version} ${configure.sdkroot}] != -1} {</div><div class="">        set bazel_build_opts "${bazel_build_opts} --macos_sdk_version=${configure.sdk_version}"</div><div class="">    } else {</div><div class="">        ui_warn "configure.sdkroot='${configure.sdkroot}' does not match configure.sdk_version='${configure.sdk_version}'"</div><div class="">    }</div><div class="">    # hack to try and transfer MP c, c++ and ld options to bazel...</div><div class="">    foreach opt [list {*}${configure.cflags} ] {</div><div class="">        set bazel_build_opts "${bazel_build_opts} --conlyopt \"${opt}\""</div><div class="">    }</div><div class="">    foreach opt [list {*}${configure.cxxflags} ] {</div><div class="">        set bazel_build_opts "${bazel_build_opts} --cxxopt \"${opt}\""</div><div class="">    }</div><div class="">    foreach opt [list {*}${configure.ldflags} ] {</div><div class="">        set bazel_build_opts "${bazel_build_opts} --linkopt \"${opt}\""</div><div class="">    }</div><div class="">    if { ${use_mp_clang} } {</div><div class="">        set bazel_build_opts "${bazel_build_opts} --action_env CC=${<a href="http://configure.cc" class="">configure.cc</a>}"</div><div class="">        set bazel_cmd "BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 ${bazel_cmd}"</div><div class="">    }</div><div class="">    ui_debug "Bazel build command : ${bazel_cmd}"</div><div class="">    ui_debug "Bazel build options : ${bazel_build_opts}"</div><div class=""><br class=""></div><div class="">    # diff -NaurdwB ./dm-tree-orig/setup.py ./dm-tree-new/setup.py | sed -E -e 's/\.\/dm-tree-(orig|new)*\/(setup\.py)(\.[[:alnum:]]+)*/\.\/setup.py/' > ./setup.py.patch</div><div class="">    patchfiles      setup.py.patch</div><div class=""><br class=""></div><div class="">    post-patch {</div><div class="">        reinplace \</div><div class="">            "s|@BAZEL_CMD@|[python_listify ${bazel_cmd}]|g" \</div><div class="">            ${worksrcpath}/setup.py</div><div class="">        reinplace \</div><div class="">            "s|@BAZEL_BUILD_OPTS@|[python_listify ${bazel_build_opts}]|g" \</div><div class="">            ${worksrcpath}/setup.py</div><div class="">    }</div><div class=""><br class=""></div><div class="">    build.env-append \</div><div class="">        TMPDIR=${workpath}/tmp \</div><div class="">        JAVA_HOME=${java.home}</div><div class=""><br class=""></div><div class="">    test.run        yes</div><div class="">    test.cmd        py.test-${python.branch}</div><div class="">    test.target</div><div class="">    test.env-append \</div><div class="">                    "PATH=$env(PATH):${workpath}/bin" \</div><div class="">                    PYTHONPATH=${worksrcpath}/build/lib</div><div class=""><br class=""></div><div class="">    post-destroot {</div><div class="">        set docdir ${prefix}/share/doc/${subport}</div><div class="">        xinstall -d ${destroot}${docdir}</div><div class="">        xinstall -m 0644 -W ${worksrcpath} LICENSE README.md \</div><div class="">            ${destroot}${docdir}</div><div class="">    }</div><div class=""><br class=""></div><div class="">    livecheck.type      none</div><div class="">} else {</div><div class="">    livecheck.type      pypi</div><div class="">}</div></blockquote><div class=""><div class=""><br class=""></div></div><div class="">Draft setup.py.patch:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">--- ./setup.py<span class="Apple-tab-span" style="white-space:pre">      </span>2020-07-05 09:50:12.000000000 -0400</div><div class="">+++ ./setup.py<span class="Apple-tab-span" style="white-space:pre"> </span>2020-07-07 06:55:37.000000000 -0400</div><div class="">@@ -90,11 +90,11 @@</div><div class="">       os.makedirs(self.build_temp)</div><div class=""> </div><div class="">     bazel_argv = [</div><div class="">-        'bazel',</div><div class="">+        @BAZEL_CMD@</div><div class="">         'build',</div><div class="">+        @BAZEL_BUILD_OPTS@</div><div class="">         ext.bazel_target,</div><div class="">         '--symlink_prefix=' + os.path.join(self.build_temp, 'bazel-'),</div><div class="">-        '--compilation_mode=' + ('dbg' if self.debug else 'opt'),</div><div class="">     ]</div><div class=""> </div><div class="">     if IS_WINDOWS:</div></blockquote></div><div class=""><div class=""><br class=""></div></div><div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jul 6, 2020, at 1:22 PM, Steven Smith <<a href="mailto:steve.t.smith@gmail.com" class="">steve.t.smith@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 24px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">I’ll go try the settings you’re using with “</span><span style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; caret-color: rgb(106, 115, 125); color: rgb(106, 115, 125); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);" class="">the wonderful bazel build system ...</span><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 24px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">”</span></div></blockquote></div><br class=""></div></div></div></div></body></html>