Bug 250530 - devel/llvm10 FAILED Applying extra patch openmp
Summary: devel/llvm10 FAILED Applying extra patch openmp
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: Brooks Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-22 15:35 UTC by albert.shih
Modified: 2020-10-28 17:27 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (brooks)


Attachments
a patch to fix patching openmp (1.71 KB, patch)
2020-10-27 01:06 UTC, Yasuhito FUTATSUKI
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description albert.shih 2020-10-22 15:35:16 UTC
I'm aware my version of the FreeBSD are obsolete, and are not supporter. That's why I put the «Severity» at low as possible. 

In fact It's more a information than a actual bug report. 

Inside a poudriere with version 11.2, 12.0 the port devel/llvm10 don't build with this error 

===>  License BSD3CLAUSE LLVM MIT PD REGEX LLVM2 accepted by the user
===> Fetching all distfiles required by llvm10-10.0.1_2 for building
===>  Extracting for llvm10-10.0.1_2
=> SHA256 Checksum OK for llvm-10.0.1.src.tar.xz.
=> SHA256 Checksum OK for clang-10.0.1.src.tar.xz.
=> SHA256 Checksum OK for compiler-rt-10.0.1.src.tar.xz.
=> SHA256 Checksum OK for clang-tools-extra-10.0.1.src.tar.xz.
=> SHA256 Checksum OK for lld-10.0.1.src.tar.xz.
=> SHA256 Checksum OK for lldb-10.0.1.src.tar.xz.
=> SHA256 Checksum OK for openmp-10.0.1.src.tar.xz.
/bin/mv /wrkdirs/usr/ports/devel/llvm10/work/clang-10.0.1.src /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/tools/clang
/bin/mv /wrkdirs/usr/ports/devel/llvm10/work/clang-tools-extra-10.0.1.src /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/tools/clang/tools/extra
/bin/mv /wrkdirs/usr/ports/devel/llvm10/work/lld-10.0.1.src /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/tools/lld
/bin/mv /wrkdirs/usr/ports/devel/llvm10/work/lldb-10.0.1.src /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/tools/lldb
/usr/bin/sed -i.bak -e 's/KMP_ARCH_AARCH64) && KMP_OS_LINUX/KMP_ARCH_AARCH64)/'  /wrkdirs/usr/ports/devel/llvm10/work/openmp-10.0.1.src/runtime/src/kmp.h  /wrkdirs/usr/ports/devel/llvm10/work/openmp-10.0.1.src/runtime/src/kmp_csupport.cpp  /wrkdirs/usr/ports/devel/llvm10/work/openmp-10.0.1.src/runtime/src/kmp_runtime.cpp  /wrkdirs/usr/ports/devel/llvm10/work/openmp-10.0.1.src/runtime/src/kmp_gsupport.cpp
/bin/mv /wrkdirs/usr/ports/devel/llvm10/work/openmp-10.0.1.src /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/projects/openmp
===========================================================================
=======================<phase: patch-depends  >============================
===========================================================================
=======================<phase: patch          >============================
===>  Patching for llvm10-10.0.1_2
===>  Applying extra patch patches for llvm10-10.0.1_2 from /usr/ports/devel/llvm10/files/clang
===>  Applying extra patch patches for llvm10-10.0.1_2 from /usr/ports/devel/llvm10/files/compiler-rt
===>  Applying extra patch patches for llvm10-10.0.1_2 from /usr/ports/devel/llvm10/files/extras
===>  Applying extra patch patches for llvm10-10.0.1_2 from /usr/ports/devel/llvm10/files/lldb
===>  Applying extra patch openmp
cat: openmp: No such file or directory
  I can't seem to find a patch in there anywhere.
===>  FAILED Applying extra patch openmp
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/llvm10
=>> Cleaning up wrkdir
===>  Cleaning for llvm10-10.0.1_2
build of devel/llvm10 | llvm10-10.0.1_2 ended at Thu Oct 22 16:45:44 CEST 2020
build time: 00:01:00
!!! build failure encountered !!!
Comment 1 Brooks Davis freebsd_committer 2020-10-22 17:09:55 UTC
Your ports tree was somehow updated improperly and includes the Makefile portion of r544246, but not the files/openmp directory added with it. You could fix that or disable the OPENMP option.
Comment 2 albert.shih 2020-10-23 14:20:08 UTC
Well...

I reopen the ticket, but of course feel free to close it again, I will not reopen it. I know I'm using non supported version of FreeBSD.


I don't think the problem are my port tree, because with the same port tree it's working fine (with same set of options) under a 12.1 poudriere jail. 

But to be sure I remove the port tree, download a new one, try to build the ports, end up same way. 

Just to be absolutly sure, I also donwload the port tree on the host (with portsnap) and with svn, then I compare the directory deve/llvm10 from the port tree used by poudriere and the two other, end up with exact same file.

the backward of the problem on this ports is, they are lot of pkg depend on it, so...the impact a not so small.

Well...I know I just have to upgrade my FreeBSD ;-)

Regards.
Comment 3 Brooks Davis freebsd_committer 2020-10-23 20:55:30 UTC
Please provide the output of:

cd /usr/ports/devel/llvm10 && make clean && find . -ls
Comment 4 albert.shih 2020-10-23 21:07:59 UTC
Hi,

Here:

[root@poudriere1 /usr/local/poudriere/ports/default/devel/llvm10]# find . -type f                
./Makefile
./Makefile.COMMANDS
./distinfo
./files/clang/patch-D77776
./files/clang/patch-fformat_extensions.diff
./files/clang/patch-fopenmp.diff
./files/clang/patch-freebsd-r352030
./files/clang/patch-tools_clang_lib_Basic_Targets.cpp
./files/clang/patch-tools_clang_lib_Headers_CMakeLists.txt
./files/clang/patch-tools_clang_tools_clang-format_clang-format-sublime.py
./files/clang/patch-tools_clang_tools_clang-format_clang-format.py
./files/clang/patch-tools_clang_tools_clang-format_git-clang-format
./files/clang/patch-tools_clang_tools_scan-build_libexec_ccc-analyzer
./files/compiler-rt/patch-.._compiler-rt-10.0.1.src_lib_sanitizer__common_sanitizer__platform__interceptors.h
./files/extras/patch-tools_clang_tools_extra_clang-doc_tool_CMakeLists.txt
./files/lldb/patch-head-r332965.diff
./files/lldb/patch-tools_lldb_docs_conf.py
./files/llvm-wrapper.sh.in
./files/openmp/patch-ea99c09
./files/patch-cmake_modules_AddSphinxTarget.cmake
./files/patch-freebsd-r352318
./files/patch-lib_Support_Unix_Path.inc
./files/patch-llvm-revert-18bfb3a
./files/xtoolchain.mk.in
./pkg-descr
./pkg-plist
[root@poudriere1 /usr/local/poudriere/ports/default/devel/llvm10]# 

And to be absolutly sure :

[root@poudriere1 /usr/local/poudriere/ports/default/devel/llvm10]# find . -type f -exec md5 {} \;
MD5 (./Makefile) = b23cb6b397436aa6181eddcb9e97c7a7
MD5 (./Makefile.COMMANDS) = 5844f048227a21cec1f1c1a037b8a720
MD5 (./distinfo) = e515ca98b6c037af2e48620e90b8cfde
MD5 (./files/clang/patch-D77776) = f6008642c3275b835cf8ac0500cb1b50
MD5 (./files/clang/patch-fformat_extensions.diff) = 918883a34bbe81841a7083666d8f5ca4
MD5 (./files/clang/patch-fopenmp.diff) = bfc7fd94bc4744f71fbeb94386516fa3
MD5 (./files/clang/patch-freebsd-r352030) = 90b0b83661057817d19c14fd7e8b8971
MD5 (./files/clang/patch-tools_clang_lib_Basic_Targets.cpp) = ae1b29d1c9a118228d6aaf9b32588958
MD5 (./files/clang/patch-tools_clang_lib_Headers_CMakeLists.txt) = 3c0e3b82572388515649edcac73fa106
MD5 (./files/clang/patch-tools_clang_tools_clang-format_clang-format-sublime.py) = b88a6317c74b8e79558c93963e55d979
MD5 (./files/clang/patch-tools_clang_tools_clang-format_clang-format.py) = c81ca5bd8cfa51b0fb6fa37b7e72e6a2
MD5 (./files/clang/patch-tools_clang_tools_clang-format_git-clang-format) = c5c6d4eee612f1588aa2dca5bd7e01d5
MD5 (./files/clang/patch-tools_clang_tools_scan-build_libexec_ccc-analyzer) = 5cb93551505fa96288c0ef83368e8751
MD5 (./files/compiler-rt/patch-.._compiler-rt-10.0.1.src_lib_sanitizer__common_sanitizer__platform__interceptors.h) = b8a39ab327d0d93cca4502cdb974d8de
MD5 (./files/extras/patch-tools_clang_tools_extra_clang-doc_tool_CMakeLists.txt) = 1467791c61e0e009de940b7667be7117
MD5 (./files/lldb/patch-head-r332965.diff) = 82893621d03e27c6592e638a4a60dc4f
MD5 (./files/lldb/patch-tools_lldb_docs_conf.py) = 76c97151209716924c4f2dae6a9e0a9b
MD5 (./files/llvm-wrapper.sh.in) = 27b86e7ce11158cc7da2eabab9e36c52
MD5 (./files/openmp/patch-ea99c09) = 94bf29629f1ac939e4f4674ffcdcfa94
MD5 (./files/patch-cmake_modules_AddSphinxTarget.cmake) = 29b8385430cfb8d27fac74b55e34d85b
MD5 (./files/patch-freebsd-r352318) = 17f4b34e453ffa8e4d0d3bfb22d6452b
MD5 (./files/patch-lib_Support_Unix_Path.inc) = ec2f79e701f62b75816194e8a96e1a83
MD5 (./files/patch-llvm-revert-18bfb3a) = 3af9b76cd359190774be9721677542e5
MD5 (./files/xtoolchain.mk.in) = d41e69b5082aedba81be6dd13a2c551a
MD5 (./pkg-descr) = 732c7a058977b6a90957dead300e82b3
MD5 (./pkg-plist) = 50dccc5dacca772ea44eea607c3d65be

Thanks.

Regards
Comment 5 Brooks Davis freebsd_committer 2020-10-23 21:19:30 UTC
The error output is from the run of Mk/Scripts/do-patch.sh. It is clearly the case that the "[ -d ..." in this bit of code is returning false on openmp (apparently due to its non-existence):

if [ -n "${dp_EXTRA_PATCHES}" ]; then
        for i in ${dp_EXTRA_PATCHES}; do
                if [ -d "${i}" ]; then
                        patch_from_directory "${i}" \
                                "extra patch"
                else
                        if ! apply_one_patch "${i}" \
                                "extra patch" \
                                "verbose" \
                                ${dp_PATCH_ARGS}; then
                                failure_fatal
                        fi
                fi
        done
fi

You need to figure out why that's happening despite the directory apparently existing. I might suggest using the -i option to bulk or testport to examine /usr/ports/devel/llvm10/files.
Comment 6 Yasuhito FUTATSUKI 2020-10-27 01:06:02 UTC
Created attachment 219131 [details]
a patch to fix patching openmp

Hi, I also encountered this issue on 12.0 (yes, it is too old but it is need to migrate old gitlab-ce to new server).

However, it seems this problem is not only for older releases.
The patch attached looks to be able to fix it, at least to apply openmp extra patch.
(I'm not sure, this makes it possible to build llvm10 normally or not)
Comment 7 commit-hook freebsd_committer 2020-10-27 17:05:23 UTC
A commit references this bug:

Author: brooks
Date: Tue Oct 27 17:04:36 UTC 2020
New revision: 553456
URL: https://svnweb.freebsd.org/changeset/ports/553456

Log:
  Fix application of openmp patch

  PR:		250530
  Submitted by:	Yasuhito FUTATSUKI
  Reported by:	albert.shih@obspm.fr

Changes:
  head/devel/llvm10/Makefile
  head/devel/llvm10/files/openmp/patch-ea99c09
Comment 8 John Hein 2020-10-28 17:10:19 UTC
(In reply to commit-hook from comment #7)
Shouldn't this have a PORTREVISION bump?

The patch was not applied before this - not just on older FreeBSD releases.  In my test on 11-stable, it failed to apply the patch, but did not cause the build to terminate.

This reflects a bug in do-patch.sh - it can fail to find a patch file, but not cause the build to die.  This is because the exit error from cat does not propagate through the pipeline (patch doesn't care about the empty input and exits with 0):

$ cat nonexistent_file | patch -d /tmp
cat: /alkfjasdlfjkasdf: No such file or directory
$ echo $?
0
$ cat nonexistent_file
cat: /alkfjasdlfjkasdf: No such file or directory
$ echo $?
1

That's a separate bug, but before r553456 this port was built differently than after (if OPENMP is on).  So it seems to me this should drive a PORTREVISION bump.
Comment 9 commit-hook freebsd_committer 2020-10-28 17:16:00 UTC
A commit references this bug:

Author: brooks
Date: Wed Oct 28 17:15:46 UTC 2020
New revision: 553556
URL: https://svnweb.freebsd.org/changeset/ports/553556

Log:
  Bump port revion after r553456

  The patch to openmp was either ignored or the build was broken depending
  on different aspects of the build environment. Now that it applies, the
  pkg contents change...

  PR:		250530
  Reported by:	John Hein

Changes:
  head/devel/llvm10/Makefile
Comment 10 John Hein 2020-10-28 17:27:44 UTC

(In reply to comment #9)
Thanks for the quick update, Brooks.


(In reply to John Hein from comment #8)
Sorry for the bad copy/paste in the example snippet. For the record that should have been:

$ cat nonexistent_file | patch -d /tmp
cat: nonexistent_file: No such file or directory
$ echo $?
0
$ cat nonexistent_file
cat: nonexistent_file: No such file or directory
$ echo $?
1



By the way, before r553456, make patch was showing this:

 .
 .
===>  Applying extra patch openmp
cat: openmp: No such file or directory
===>  Applying FreeBSD patches for llvm10-10.0.1_2 from /usr/ports/devel/llvm10/files
 .
 .

And it did not die on 11.4-stable (and probably other versions) with an up to date ports tree.

I don't know why it died for the OP unless they didn't have an up to date ports tree (do-patch.sh probably broke with r533459 - 2020-04-30) or /bin/sh behaved differently for the pipeline case on his OS version.