bruteforce-enigma icon indicating copy to clipboard operation
bruteforce-enigma copied to clipboard

error compiling with make on apple silicon Sonoma 14.2.1

Open godfriedt opened this issue 1 year ago • 1 comments

[crxunch@mac] bruteforce-enigma % make crack_enigma     
clang: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang: warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]
Building build/bruteforce.o .../usr/bin/time: illegal option -- -
usage: time [-al] [-h | -p] [-o file] utility [argument ...]
make: *** [build/bruteforce.o] Error 1

godfriedt avatar Apr 21 '24 20:04 godfriedt

Hi, I encountered this problem before on macOS (see Issue #5) and thought I had fixed it, but I guess Macs don't use the GNU time command at all. I don't have a Mac to test on, so

  • If you don't care about the cracking time, you can change the makefile where ever you see @$(TIME) --format=$(TIME_FORMAT) -- $(COMPILE) to @$(COMPILE).
  • If you want the cracking time you can either adjust $(TIME) --format=$(TIME_FORMAT) -- to a Mac-compatible timing command, if you know it, or
  • Install gtime, which is GNU-compatible like the time command on my system. In the makefile, replace TIME = /usr/bin/time with TIME = /usr/local/bin/gtime. I got this from a helpful AI generated response on Google.

The error message "usr/bin/time illegal option" means that you are trying to use an option with the time command that is not supported on macOS. The time command on macOS is a BSD-like command that does not accept all of the same options as the GNU time command.

If you need to use an option that is not supported by the macOS time command, you can use the gtime command instead. The gtime command is a GNU-compatible time command that is available on macOS through Homebrew. To install gtime, open Terminal and run the following command:

brew install gtime

I don't know how to make the time command work across the three major OSes. If you figure out a good cross-platform solution, please let me know.

the-lambda-way avatar May 17 '24 01:05 the-lambda-way