Opened 10 years ago

Closed 8 years ago

#43751 closed defect (fixed)

masscan is not UsingTheRightCompiler nor -arch flags nor does it have a universal variant

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: jul_bsd@…
Priority: Normal Milestone:
Component: ports Version: 2.3.99
Keywords: Cc:
Port: masscan

Description

masscan is not UsingTheRightCompiler nor -arch flags nor does it have a universal variant.

Attachments (1)

patch-masscan-Portfile.diff (761 bytes) - added by jul_bsd@… 10 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 10 years ago by jul_bsd@…

Could you document what is needed for universal variant as I can't test it. Ony doc I see

https://guide.macports.org/chunked/reference.phases.html#reference.phases.configure.universal
wiki:howto/buildUniversal
just add a variant w -arch i386 -arch x86_64 ? configure.universal_cflags? nothing for m32/m64?

do every port need to have an universal variant?

How masscan is not using right compiler? arg, just hardcoded CC=gcc, switch to ${configure.cc}

patch proposal joined. but +universal failed to build on

ld: warning: ignoring file /opt/local/lib/libpcap.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libpcap.dylib

it seems libpcap is not universal ...

Last edited 10 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:2 in reply to:  1 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to jul_bsd@…:

Could you document what is needed for universal variant as I can't test it. Ony doc I see

https://guide.macports.org/chunked/reference.phases.html#reference.phases.configure.universal
wiki:howto/buildUniversal
just add a variant w -arch i386 -arch x86_64 ? configure.universal_cflags? nothing for m32/m64?

I can't really document it because it varies for each port; each build system is different. MacPorts automatically handles standard build systems like autoconf (default), cmake (using the cmake portgroup) and xcode (xcode portgroup). But because masscan uses a handmade Makefile, it's up to you to figure out where exactly the -arch flags need to be specified, and how best to insert them. Note that you need to use -arch flags for all builds, not just universal ones. Use the [get_canonical_archflags] procedure to get them. Define an empty universal variant before the first line where you invoke this procedure. You can see an example of this pattern in the ascii port, and a slightly different way of doing it in the dcraw port. The method used in dcraw (including the -arch flags in CC) works well for build systems that don't give you easily-modifiable variables; masscan gives you FLAGS2, but if you also need to munge LIBS, then using CC instead might be simpler. But see if it works without munging LIBS, since LIBS is supposed to be for libraries that are linked with, not other flags.

do every port need to have an universal variant?

That would be ideal. Every port that compiles software, that is. Some ports just install text files (and specify "supported_archs noarch"), so universal isn't applicable to those.

How masscan is not using right compiler? arg, just hardcoded CC=gcc, switch to ${configure.cc}

Yes, that's the problem. Consider setting CC in build.args instead of using reinplaces; again, see ascii and dcraw for examples.

patch proposal joined. but +universal failed to build on

ld: warning: ignoring file /opt/local/lib/libpcap.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libpcap.dylib

it seems libpcap is not universal ...

MacPorts automatically ensures dependencies are built universal if you build a port universal. However masscan does not declare any dependencies. So you've just proved that masscan needs a library dependency on libpcap.

comment:3 Changed 10 years ago by jul_bsd@…

ok. here is a new diff

but when I build with +universal, still got

/usr/bin/clang -Os -arch x86_64 -o bin/masscan [...]

so the cflags doesn't look complete for universal, even with CFLAGS="${configure.cflags} [get_canonical_archflags cc]". same w CC="${configure.cc} [get_canonical_archflags cc]"

comment:4 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Because you've defined the universal variant after invoking get_canonical_archflags instead of before.

comment:5 Changed 10 years ago by jul_bsd@…

ok. here it works correctly.

Changed 10 years ago by jul_bsd@…

Attachment: patch-masscan-Portfile.diff added

comment:6 Changed 10 years ago by jul_bsd@…

any other comments?

comment:7 Changed 8 years ago by mf2k (Frank Schima)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.