Bug 262134

Summary: textproc/re-flex: Fails to build on !x86 (arm) due to -march=native: c++: error: the clang compiler does not support '-march=native'
Product: Ports & Packages Reporter: Robert Clausecker <fuz>
Component: Individual Port(s)Assignee: Pietro Cerutti <gahr>
Status: Closed FIXED    
Severity: Affects Many People Keywords: needs-qa
Priority: --- Flags: bugzilla: maintainer-feedback? (gahr)
koobs: merge-quarterly?
Version: Latest   
Hardware: arm   
OS: Any   
Attachments:
Description Flags
textproc/re-flex 3.1.0 armv7 build log none

Description Robert Clausecker freebsd_committer freebsd_triage 2022-02-23 06:04:08 UTC
Created attachment 232024 [details]
textproc/re-flex 3.1.0 armv7 build log

While building textproc/re-flex from 2022Q1, I noticed that the build fails due to an unsupported compiler flag:

===>  Building for re-flex-3.1.0
[  3% 1/32] /usr/bin/c++ -DHAVE_NEON -DReflexLib_EXPORTS -I/wrkdirs/usr/ports/textproc/re-flex/work/RE-flex-3.1.0/include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -march=native -mfpu=neon -std=gnu++11 -MD -MT CMakeFiles/ReflexLib.dir/lib/convert.cpp.o -MF CMakeFiles/ReflexLib.dir/lib/convert.cpp.o.d -o CMakeFiles/ReflexLib.dir/lib/convert.cpp.o -c /wrkdirs/usr/ports/textproc/re-flex/work/RE-flex-3.1.0/lib/convert.cpp
FAILED: CMakeFiles/ReflexLib.dir/lib/convert.cpp.o 
/usr/bin/c++ -DHAVE_NEON -DReflexLib_EXPORTS -I/wrkdirs/usr/ports/textproc/re-flex/work/RE-flex-3.1.0/include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -march=native -mfpu=neon -std=gnu++11 -MD -MT CMakeFiles/ReflexLib.dir/lib/convert.cpp.o -MF CMakeFiles/ReflexLib.dir/lib/convert.cpp.o.d -o CMakeFiles/ReflexLib.dir/lib/convert.cpp.o -c /wrkdirs/usr/ports/textproc/re-flex/work/RE-flex-3.1.0/lib/convert.cpp
c++: error: the clang compiler does not support '-march=native'
ninja: build stopped: subcommand failed.
*** Error code 1

Stop.
make: stopped in /usr/ports/textproc/re-flex

---

This is because -march=native is only supported on x86.  Furthermore, ports should not use this option (see porter's handbook, ยง13.14.4) as it may cause packages to be built that do not run on other machines of the same architecture.

Please patch the port to build without -march=native.
Comment 1 Pietro Cerutti freebsd_committer freebsd_triage 2022-02-23 08:44:04 UTC
Thanks, fixed!
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-02-23 08:45:37 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d7347075f1ecaf154d4226c186db09a9115bcbc2

commit d7347075f1ecaf154d4226c186db09a9115bcbc2
Author:     Pietro Cerutti <gahr@FreeBSD.org>
AuthorDate: 2022-02-23 08:36:38 +0000
Commit:     Pietro Cerutti <gahr@FreeBSD.org>
CommitDate: 2022-02-23 08:44:49 +0000

    textproc/re-flex: make SIMD optional

    PR:             262134
    Reported by:    Robert Clausecker  <fuz@fuz.su>

 textproc/re-flex/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2022-02-23 23:10:22 UTC
^Triage: Issue reported for quarterly, re-open for MFH
Comment 4 commit-hook freebsd_committer freebsd_triage 2022-03-14 10:02:23 UTC
A commit in branch 2022Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=28e74084e0c34549c60443bb583db4763d95e777

commit 28e74084e0c34549c60443bb583db4763d95e777
Author:     Pietro Cerutti <gahr@FreeBSD.org>
AuthorDate: 2022-02-23 08:36:38 +0000
Commit:     Pietro Cerutti <gahr@FreeBSD.org>
CommitDate: 2022-03-14 10:01:13 +0000

    textproc/re-flex: make SIMD optional

    PR:             262134
    Reported by:    Robert Clausecker  <fuz@fuz.su>

    (cherry picked from commit d7347075f1ecaf154d4226c186db09a9115bcbc2)

 textproc/re-flex/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)