Closed Bug 1561510 Opened 2 years ago Closed 2 years ago

Removing -arch XXX args from CC doesn't work

Categories

(NSS :: Build, defect, P1)

All
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mt, Assigned: mt)

References

Details

Attachments

(1 file)

The code added in a fixup to Bug 1310168 introduced a regression when Bug 1418944 landed. I have no idea how this worked.

At its core, this is what we have:

CC = cc -arch x86_64
X := CC="$(CC)"
X := $(filter-out -arch x86_64,$(X))

However, because the x86_64 is adjacent the quote, we end up with it not being filtered correctly.

Arguably, this code is not right, because it also removes x86_64 arguments that don't follow -arch, but we can at least un-break it by adding the filtering at the right place.

Here's what I have now:

remove_arch = $(filter-out __REMOVEME%,$(subst $(NULL) -arch , __REMOVEME,$(1)))
ifdef CC
NSPR_CONFIGURE_ENV = CC="$(call remove_arch,$(CC))"
endif
ifdef CCC
NSPR_CONFIGURE_ENV += CXX="$(call remove_arch,$(CC))"
endif

That seems to work.

This faithfully removes just -arch arguments. It's not clear to me whether NSPR
can handle other arguments to CC either. Maybe this should just use
$(first-word $(CC)) instead...

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.45
You need to log in before you can comment on or make changes to this bug.