Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'makedepend: command not found' when installing on M1 #10

Open
jlugner opened this issue Dec 17, 2023 · 5 comments
Open

'makedepend: command not found' when installing on M1 #10

jlugner opened this issue Dec 17, 2023 · 5 comments

Comments

@jlugner
Copy link

jlugner commented Dec 17, 2023

I'm unable to run brew install rbenv/tap/[email protected] on my M1, with or without makedepend linked to homebrew. Getting the following output:

➜  ruby_project git:(master) ✗ brew install rbenv/tap/[email protected]
Running `brew update --auto-update`... ==> Auto-updated Homebrew!
Updated 3 taps (homebrew/cask-versions, homebrew/services and homebrew/core). ==> New Formulae
opensca-cli

You have 4 outdated formulae installed. ==> Fetching rbenv/tap/[email protected] ==> Downloading https://www.openssl.org/source/openssl-1.0.2u.tar.gz
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/cb69ca61319d7186eb55397eb90cec0c2f56d8722af71a851bb35194ecaf3359--openssl-1.0.2u.tar.gz ==> Installing [email protected] from rbenv/tap ==> Patching
==> perl ./Configure --prefix=/opt/homebrew/Cellar/[email protected]/1.0.2u --openssldir=/opt/homebrew/etc/openssl no-ssl2 no-ss ==> make depend
Last 15 lines from /Users/me/Library/Logs/Homebrew/[email protected]/02.make:
2023-12-16 08:00:28 +0000

make
depend

making depend in crypto...
../util/domd: line 23: makedepend: command not found
mv: Makefile.new: No such file or directory
make[1]: *** [local_depend] Error 127
make: *** [depend] Error 1

If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):
  https://github.com/rbenv/homebrew-tap/issues
@mislav
Copy link
Member

mislav commented Dec 21, 2023

I found evidence of other people having this exact issue in the past; I'm not sure if it was ever solved for them: #4 (comment)

Apparently gcc -M should be equivalent of makedepend on systems that have none. Not sure why make depend would fail on systems with gcc.

@jlugner
Copy link
Author

jlugner commented Dec 21, 2023

I saw that, but didn't find anyone mentioning solving it. I somewhat assumed the fix you mentioned in the bottom of the thread had worked for them.

I saw gcc -M mentioned a couple of times, but not sure if it's something I can make use of to proceed here?

@mislav
Copy link
Member

mislav commented Dec 22, 2023

You could try brew install with --keep-tmp and then, after failure, open the temporary directory and look at the Makefile generated by the Configure step. Here's mine: https://gist.github.com/mislav/fd2a8d9deb404399acabe055b26719bc

$ grep MAKEDEP /private/tmp/opensslA1.0-20231222-15977-tyt2qu/openssl-1.0.2u/Makefile
MAKEDEPPROG= clang
		MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
		MAKEDEPPROG='$(MAKEDEPPROG)'

@jlugner
Copy link
Author

jlugner commented Dec 22, 2023

You could try brew install with --keep-tmp and then, after failure, open the temporary directory and look at the Makefile generated by the Configure step. Here's mine: https://gist.github.com/mislav/fd2a8d9deb404399acabe055b26719bc

$ grep MAKEDEP /private/tmp/opensslA1.0-20231222-15977-tyt2qu/openssl-1.0.2u/Makefile
MAKEDEPPROG= clang
		MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
		MAKEDEPPROG='$(MAKEDEPPROG)'

That's interesting. The grep result for me is the same:

 ✗ grep MAKEDEP /private/tmp/opensslA1.0-20231222-49466-66c9fh/openssl-1.0.2u/Makefile
MAKEDEPPROG=makedepend
		MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
		MAKEDEPPROG='$(MAKEDEPPROG)'

My makefile differs however. Where you have MAKEDEPPROG= clang, I have MAKEDEPPROG=makedepend.

I don't really know how homebrew works with stuff like this. Can I alter the makefile and reinitiate the install using the stored temp output, or can I inject what MAKEDEPPROG I want to use when installing?

@mislav
Copy link
Member

mislav commented Dec 26, 2023

My makefile differs however. Where you have MAKEDEPPROG= clang, I have MAKEDEPPROG=makedepend.

I strongly suspect this is what causes the failure on your system and what makes it work on mine. I do not know why the Perl Configure script generates it that way, though. Here is the relevant logic from the script:

# collect compiler pre-defines from gcc or gcc-alike...
open(PIPE, "$cross_compile_prefix$cc -dM -E -x c /dev/null 2>&1 |");
while (<PIPE>) {
  m/^#define\s+(\w+(?:\(\w+\))?)(?:\s+(.+))?/ or last;
  $predefined{$1} = defined($2) ? $2 : "";
}
close(PIPE);

# Xcode did not handle $cc -M before clang support
my $cc_as_makedepend = 0;
if ($predefined{__GNUC__} >= 3 && !(defined($predefined{__APPLE_CC__})
                                    && !defined($predefined{__clang__}))) {
  $cc_as_makedepend = 1;
}

I think that either clang behaves differently on your system, or that you have the CC environment variable set to something else.

$ clang -dM -E -x c /dev/null 2>&1 | grep -E '__(GNUC|APPLE_CC|clang)__'
#define __APPLE_CC__ 6000
#define __GNUC__ 4
#define __clang__ 1

Note that we're trying to debug a build script issue in a version of OpenSSL that is no longer maintained. It's quite possible that this issue was known and fixed in future versions of OpenSSL. If you do manage to find the cause of the bug, I'm open to patching it in this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants