[fpc-devel] Latest trunk - problems with codesign on MacOSX

Michael Ring mail at michael-ring.org
Fri Feb 12 11:33:42 CET 2021


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20210212/992a3b9b/attachment.htm>


More information about the fpc-devel mailing list