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

[BUG]: macOS ARM build depends on libomp from Homebrew #723

Open
solardiz opened this issue Feb 6, 2025 · 4 comments
Open

[BUG]: macOS ARM build depends on libomp from Homebrew #723

solardiz opened this issue Feb 6, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@solardiz
Copy link
Member

solardiz commented Feb 6, 2025

Which version of the application are you using?

1.9.1-ce

Description of the bug

A user reported that running macOS-ARM_1_JtR/run/dmg2john fails on not finding /opt/homebrew/opt/libomp/lib/libomp.dylib.

Steps To Reproduce

I suppose download current latest macOS ARM build from this repo and run dmg2john (or indeed john).

Your execution environment

I don't know, but a Mac that was able to run the program up to the point of not finding the library.

@solardiz solardiz added the bug Something isn't working label Feb 6, 2025
@solardiz
Copy link
Member Author

solardiz commented Feb 6, 2025

I think we should either avoid the external dependency (preferable) or document how to satisfy it (a problematic workaround).

To avoid the dependency, is static linking an option? Or including the dynamic library in the tarball?

I haven't looked into how this build is done. Apparently, we use a compiler packaged by Homebrew? Are there other options we could use?

@claudioandre-br
Copy link
Member

claudioandre-br commented Feb 7, 2025

Let's deal with this in parts. BTW: It is not only libomp:

To avoid the dependency, is static linking an option? Or including the dynamic library in the tarball?

Maybe/probably. But I'm not the person to say the final word.

or document how to satisfy it (a problematic workaround).

Documentations says (https://github.com/openwall/john-packages/pkgs/container/john#-macos):


📂 macOS

[...]

Install required Homebrew packages (if not already installed):

 brew update
 brew install libomp openssl gmp

[...]
built using clang from the official Xcode toolchain plus non-system libraries from Homebrew.


------------------ Oh, I forgot about this ------------------

Image

@claudioandre-br
Copy link
Member

claudioandre-br commented Feb 7, 2025

Moving forward:

The biggest problems are:

  • john_omp_init() exists inside john.c
  • e.g., zip2john is the "binary john". It's (part of) main() inside john.c
  • so zip2john requires OMP (unless non-OMP build).

Solution?

  • create a new main.c file [1];
  • move the main() routine and the fallback to this new file [1];
  • build main.c without OMP and SIMD [1];
  • build *2john tools without OMP and SIMD;
  • main.c will fallback to the *2john tools (or binaries?), OMP and SIMD binaries [1][2];

[1] This is John "proper" itself, so you need to be happy with the idea and think about its consequences for the whole project.
If you have a diagram, it's time to update it.
In fact, the first commit should be applied to the "core" branch just to see if it fits.

[2] I like the idea.

@claudioandre-br
Copy link
Member

A user reported that running macOS-ARM_1_JtR/run/dmg2john fails on not finding /opt/homebrew/opt/libomp/lib/libomp.dylib.

  • john itself will fail the same way;
  • dmg2john has its own binary, so to solve the reported issue the binary must be compiled without OMP flags.

claudioandre-br added a commit that referenced this issue Feb 9, 2025
Do not install libraries marked as keg-only in Homebrew [1].

[1] which means it is not symlinked into /usr/local because macOS
    already provides this software. Installing another version in
    parallel can cause conflicts and other issues.

See: #723.

Signed-off-by: Claudio André <[email protected]>
claudioandre-br added a commit that referenced this issue Feb 9, 2025
Do not install libraries marked as keg-only in Homebrew [1].

[1] which means it is not symlinked into /usr/local because macOS
    already provides this software. Installing another version in
    parallel can cause conflicts and other issues.

See: #723.

Signed-off-by: Claudio André <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants