[openssl-dev] [openssl.org #4444] [openssl-1.1.0-pre4] Make fails with "recipe for target 'depend' failed" on solaris64-x86_64

Rainer Jung rainer.jung at kippdata.de
Fri Mar 18 18:07:20 UTC 2016


Am 18.03.2016 um 17:49 schrieb Richard Levitte via RT:
> Vid Fre, 18 Mar 2016 kl. 16.34.05, skrev rainer.jung at kippdata.de:
>> I had the same problem. /bin/sh on Solaris does not understand the "-
>> nt"
>> operator used in the definition of the "depend" target in the top-
>> level
>> Makefile, e.g. in line
>>
>> if [ Makefile -nt Makefile ] ...
>
> That can't be the cause, because whatever the exit code from the test is, it's
> "swallowed" by 'if'. A little like this is:

If it were syntactically correct, but it isn't. I added the "set -ex" and:

% make depend
catdepends=false
+ [ Makefile -nt Makefile ]
Makefile:172: recipe for target 'depend' failed
make: *** [depend] Error 1

Line numbers are:

     167 # To check if test has the file age comparison operator, we
     168 # simply try, and rely test to exit with 0 if the comparison
     169 # was true, 1 if false, and most importantly, 2 if it doesn't
     170 # recognise the operator.
     171 depend:
     172         @:
     173         @set -ex; catdepends=false; \
     174         if [ Makefile -nt Makefile ] 2>/dev/null || [ $$? = 1 
]; then \
...

> $ if (exit 1); then :; fi; echo $? 0 I cannot tell you what's going wrong, and
> the only suggestion I currently have is to apply the attached patch and then
> reconfigure and make and see what the output is. Can I assume you know what
> 'set -ex' does?

You can and "man sh" would tell me otherwise ;)

I tried a couple of other approaches. One could simulate the "-nt" using 
perl and stat() but my current favorite is using "find" with "-newer":

     171 depend:
     172         @:
     173         @catdepends=false; \
     174         if [ "X`find $(DEPS) -newer Makefile`" != "X" ]; then \
     175           catdepends=true; \
     176         fi; \
     177         if [ $$catdepends = true ]; then \
... rest unchanged

or - since there's no more real need for the catdepends variable shorter 
and more direct:

     171 depend:
     172         @:
     173         @( sed -e '/^# DO NOT DELETE THIS LINE.*/,$$d' < 
Makefile; \
     174           echo '# DO NOT DELETE THIS LINE -- make depend 
depends on it.'; \
     175           echo; \
     176           for d in `find $(DEPS) -newer Makefile`; do \
     177             if [ -f $$d ]; then cat $$d; fi; \
     178           done ) > Makefile.new; \
     179         if cmp Makefile.new Makefile >/dev/null 2>&1; then \
     180           rm -f Makefile.new; \
     181         else \
     182          mv -f Makefile.new Makefile; \
     183         fi
     184         @:

I don't know which length restrictions for $(DEPS) as find arguments we 
have, but at least for current OpenSSL 1.1.0 pre 4 on Solaris - which is 
typically more limited than Linux - it works. One could also iterate 
over "find" using one DEPS file for each iteration, but that would be 
much slower due to the overhead of forking "find" lots of times (on my 
slow system the above takes less than one second, but 6 seconds after 
switching to a loop over $(DEPS) with find inside the loop.

Regards,

Rainer



More information about the openssl-dev mailing list