Bug 250899 - security/masscan: fails to build on !x86
Summary: security/masscan: fails to build on !x86
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Mikael Urankar
Depends on:
Reported: 2020-11-06 10:01 UTC by Mikael Urankar
Modified: 2020-11-21 13:37 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (taguchi.ch)


Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Urankar freebsd_committer 2020-11-06 10:01:30 UTC
pulls in x86 headers on every arch:

cat files/patch-src_smack1.c
--- src/smack1.c.orig   2017-06-06 03:59:39 UTC
+++ src/smack1.c
@@ -115,6 +115,8 @@
 #include "pixie-timer.h"
 #if defined(_MSC_VER)
 #include <intrin.h>
+#elif defined(__llvm__)
+#include <x86intrin.h>
 #elif defined(__GNUC__)
 static __inline__ unsigned long long __rdtsc(void)

see also: ports r533887 (which is wrong imo)

build log:
In file included from src/smack1.c:119:
In file included from /usr/lib/clang/11.0.0/include/x86intrin.h:15:
In file included from /usr/lib/clang/11.0.0/include/immintrin.h:15:
/usr/lib/clang/11.0.0/include/mmintrin.h:50:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
/usr/lib/clang/11.0.0/include/mmintrin.h:129:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
Comment 2 Chie Taguchi 2020-11-07 13:15:44 UTC
Hi Mikael,
Thanks for your notice.
I will look it.
Comment 3 dewayne 2020-11-07 18:29:28 UTC
(In reply to Mikael Urankar from comment #0)
That's interesting.  I've just rebuilt all my ports which includes security/masscan which were successfully built on 
FreeBSD 12.2-STABLE #0 r367125M: Fri Oct 30 02:52:58 AEDT 2020 i386 and amd64

We build for each of: c3-2, pentium3 and prescott; core2, haswell.  masscan is functional on the c3-2 and haswell (which I tested just tested for this PR)

So for the brave, my cflags (used with clang 10.0.1, the default on 12.2 i386):
-O2 -pipe -g0 -ggdb0 -DSTRIP_FBSDID -UDEBUG -fno-math-errno -DOPENSSL_NO_SSL2 -DOPENSSL_NO_SSL3 -Wl,--strip-debug -Wl,--build-id=md5 -Wl,--hash-style=sysv -Wl,-m,elf_i386_fbsd -fPIC -DPIC -fPIE -pie -fomit-frame-pointer -fno-asynchronous-unwind-tables -Wl,-z,relro -Wl,-z,now -fno-common -march=c3-2  -Wno-format

-Wl,--strip-debug -Wl,--build-id=md5 -Wl,--hash-style=sysv -pie -Wl,-z,notext -z notext -z relro -z now

I should note, that I've made no change for masscan, these are my default options for all ports for each cpu_type.  (Though some ports need hand-holding.)
Comment 4 Mikael Urankar freebsd_committer 2020-11-07 18:59:58 UTC
(In reply to dewayne from comment #3)
I haven't tried on x86, only aarch64 and armv7, it fails here.
Comment 5 dewayne 2020-11-07 20:44:39 UTC
Apologies, I misinterpreted your !x86.
Comment 6 Fernando Apesteguía freebsd_committer 2020-11-10 18:51:26 UTC
^Triage: Reporter is committer, assign accordingly.
Comment 7 commit-hook freebsd_committer 2020-11-21 13:37:37 UTC
A commit references this bug:

Author: mikael
Date: Sat Nov 21 13:37:33 UTC 2020
New revision: 555980
URL: https://svnweb.freebsd.org/changeset/ports/555980

  security/masscan: fix build on !x86

  Only include x86 header on x86

  PR:		250899
  Approved by:	taguchi.ch@gmail.com (maintainer timeout)