Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2021-02

Latest trunk - problems with codesign on MacOSX

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Ring

In a recent trunk version new code was introduced in the compiler Makefile to make use of codesign for comparing stage compilers.

Problem is that there was an algorithm implemented to detect codesign in the path and this code is not properly covering the case when for some reason codesign is visible in two places... (Which happens for me when I try to use fpcupdeluxe to build latest trunk)

Here's the magic code:

ifeq ($(OS_TARGET), darwin)
CODESIGN?=$(strip $(wildcard $(addsuffix /codesign,$(SEARCHPATH)))) endif

I have added debug output and there can be cases where $CODESIGN is set to "/usr/bin/codesign /usr/bin/codesign"

which results in codesign trying to sign codesign, which fortunately fails because of /usr/bin protection in Darwin:

/Library/Developer/CommandLineTools/usr/bin/make -C compiler distclean

$CODESIGN is [/usr/bin/codesign /usr/bin/codesign]

.....

error: /Library/Developer/CommandLineTools/usr/bin/codesign_allocate: can't create output file: /usr/bin/codesign.cstemp (Operation not permitted)

and finally, later the build fails:

strip -no_uuid ppca64.tmp
/usr/bin/codesign /usr/bin/codesign --remove-signature ppc3.tmp

there is also another issue:

ifneq ($(CODESIGN),)
DIFFRESULT:=$(shell $(COPY) $(OLDFPC) $(OLDFPC).tmp; $(COPY) $(FPC)
$(FPC).tmp; strip -no_uuid $(OLDFPC).tmp; strip -no_uuid $(FPC).tmp;
$(CODESIGN) --remove-signature $(OLDFPC).tmp; *codesign*
--remove-signature $(FPC).tmp; $(DIFF) $(OLDFPC).tmp $(FPC).tmp;
$(RMPROG) $(OLDFPC).tmp $(FPC).tmp)

One instance of 'codesign' is still left in the code which has to get replaced with $(CODESIGN)

So, question one is if it is necessary to detect codesign path at all, at least for my Mac's it is in /usr/bin

and, if this step is needed,

please make the result of the detection unique so that codesign stops trying to codesign itself.

Thank you,

Michael

Reply by email

Jonas Maebe
to Michael Ring
Michael Ring wrote
So, question one is if it is necessary to detect codesign path at all, at least for my Mac's it is in /usr/bin

It may not exist at all, e.g. on PowerPC Macs.

and, if this step is needed, please make the result of the detection unique so that codesign stops trying to codesign itself.

Fixed.

Jonas

Reply by email

Michael Ring
to Jonas Maebe

Thank you, building from within fpcupdeluxe now works....

Jonas Maebe wrote 16 lines
On 12/02/2021 11:33, Michael Ring via fpc-devel wrote: > So, question one is if it is necessary to detect codesign path at all, > at least for my Mac's it is in /usr/bin It may not exist at all, e.g. on PowerPC Macs. > and, if this step is needed, > > please make the result of the detection unique so that codesign stops > trying to codesign itself. Fixed. Jonas _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email