Opened 4 years ago

Closed 4 years ago

#61123 closed defect (fixed)

grepcidr: Not using the right compiler, -arch flags, has no universal variant

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: iefdev (Eric F)
Priority: Normal Milestone:
Component: ports Version: 2.6.3
Keywords: Cc: iEFdev
Port: grepcidr

Description

Because grepcidr uses use_configure no, it is not UsingTheRightCompiler nor -arch flags nor does it have a universal variant. The makefile 1.0 portgroup can help you resolve these issues or you can do it manually.

Change History (12)

comment:1 Changed 4 years ago by iEFdev

Thanks… I've added the makefile 1.0 PG and could remove some code in the Portfile.

While reading the PG: makefile-1.0.tcl#L139-L149 Would it benifit to also include the muniversal 1.0 PG as well? …or is the code in the first “*not* used” section be suffient enough?

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

I do not know whether grepcidr's build system is OK with building for multiple architectures at the same time or whether it instead needs to build for each arch separately using the muniversal portgroup. You'll have to figure it out.

Usually those that need muniversal are those that unwisely check for endianness or bitness at configure time. Since grepcidr has no configure script, it doesn't have the opportunity to do that, so it is plausible that it does not need muniversal.

comment:3 Changed 4 years ago by iEFdev

Ah. I see. Thanks.

Made a PR for this here. I could also use the PG to set the prefix - which feels better than the reinplace I had.

comment:4 Changed 4 years ago by iEFdev

Owner: set to iEFdev
Resolution: fixed
Status: newclosed

In 876bb7833b9a54d793b8b86362f65ce43dd6c411/macports-ports (master):

grepcidr: add the makefile PG

  • add the makefile PG
  • use makefile.override to set the PREFIX
  • Closes: #61123

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

Resolution: fixed
Status: closedreopened

Looking at a new build log, it is using the right compiler now:

/usr/bin/clang -O3 -Wall -Werror   -c -o grepcidr.o grepcidr.c
/usr/bin/clang -O3 -Wall -Werror grepcidr.o -o grepcidr

but it is still not using MacPorts CFLAGS or LDFLAGS (including -arch flags).

comment:6 in reply to:  5 Changed 4 years ago by iEFdev

Replying to ryandesign:

but it is still not using MacPorts CFLAGS or LDFLAGS (including -arch flags).

If I use:

makefile.override   PREFIX CFLAGS LDFLAGS

pre-build {
    reinplace "s|\$(CFLAGS)|\$(CFLAGS) \$(LDFLAGS)|" ${worksrcpath}/Makefile
}

I get this:

:info:build Executing:  cd "… grepcidr-2.0" && /usr/local/bin/make -j5 -w all PREFIX=/opt/local CFLAGS="-Os -arch x86_64" LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64" 
:debug:build system:  cd "… grepcidr-2.0" && /usr/local/bin/make -j5 -w all PREFIX=/opt/local CFLAGS="-Os -arch x86_64" LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64" 
:info:build make: Entering directory '… grepcidr-2.0'
:info:build /usr/bin/clang -Os -arch x86_64   -c -o grepcidr.o grepcidr.c
:info:build /usr/bin/clang -Os -arch x86_64 -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 grepcidr.o -o grepcidr

Is that ok?

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

That output looks good, except that I am surprised to see a reference to /usr/local/bin/make. Is that something specific to your MacPorts installation?

Looks like your reinplace would change just a single line:

	$(CC) $(CFLAGS) grepcidr.o -o grepcidr

so please do that change using a patchfile rather than reinplace.

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

And FYI since this change will alter the installed files (w.r.t. the optimization flag they were built with, and the header padding), the revision should be increased.

comment:9 in reply to:  7 Changed 4 years ago by iEFdev

Replying to ryandesign:

That output looks good, except that I am surprised to see a reference to /usr/local/bin/make. Is that something specific to your MacPorts installation?

[OT] Yes, that was prob my install. Wrote about that here earlier tonight. Seems like MP is finding those programs during install, even if that path is not in PATH. Rebuilt my install tonight, while having /usr/local renamed, so it wouldn't pick up anything.

Looks like your reinplace would change just a single line:

	$(CC) $(CFLAGS) grepcidr.o -o grepcidr

so please do that change using a patchfile rather than reinplace.

Aah, ok. I thought since there was only 1 line to change, a reinstall would be easier/better, and to keep everything within 1 file (ie the Portfile).

Replying to ryandesign:

And FYI since this change will alter the installed files (w.r.t. the optimization flag they were built with, and the header padding), the revision should be increased.

Yes. Will do.

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

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

MacPorts shouldn't be using /usr/local/bin/make, unless /usr/local/bin/make was present and /usr/local/bin was on your PATH and you compiled MacPorts base from source. If you compile MacPorts base from source, I recommend setting PATH to /usr/bin:/usr/sbin:/bin:/sbin before running ./configure to ensure that nothing other that system software will be found.

Using a patchfile is almost always preferable because it provides context and helps people understand what is being replaced. It is also easier to send a patchfile to the developers, which is what should happen here since this is a change they should make.

comment:11 in reply to:  10 Changed 4 years ago by iEFdev

Thanks. Yes, that's the PATH I use. All are gone now, and it doesn't use anything in that path.

Ok. I can look into that later and send over the patch.

comment:12 Changed 4 years ago by iEFdev

Resolution: fixed
Status: reopenedclosed

In 21de3abe9c3a03acfd129ba237511e2443587f65/macports-ports (master):

grepcidr: use MP flags

  • Add LDFLAGS to build
  • Use CFLAGS and LDFLAGS from MP
  • Closes: #61123
Note: See TracTickets for help on using tickets.