planetbeing / xpwn

A cross-platform custom NOR firmware loader and custom IPSW generator for the iPhone
http://planetbeing.lighthouseapp.com/projects/15246-xpwn
GNU General Public License v3.0
466 stars 328 forks source link

libcrypto Catalina #13

Open ivancristina opened 4 years ago

ivancristina commented 4 years ago

I know this issue is not specifically xpwn related, but I encountered a problem with Catalina where linker doesn't work properly

MBP-di-Ivan:build ivancristina$ make
[  5%] Built target common
[ 12%] Built target minizip
[ 33%] Built target hfs
[ 49%] Built target dmg
[ 52%] Built target dmg-bin
[ 56%] Built target hdutil
[ 59%] Built target hfsplus
[ 82%] Built target xpwn
[ 84%] Linking C executable xpwntool
ld: cannot link directly with dylib/framework, your binary is not an allowed client of /usr/lib/libcrypto.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [ipsw-patch/xpwntool] Error 1
make[1]: *** [ipsw-patch/CMakeFiles/xpwntool.dir/all] Error 2
make: *** [all] Error 2

Any help would be highly appreciated

hexploitable commented 4 years ago

Basically openssl (and thus libcrypto) is deprecated on macos. You'll need to install openssl via brew and then replace the instances of /usr/lib/libcrypto.dylib with the openssl path to libcrypto, e.g. I've manually symlinked mine into: /usr/local/lib/

ivancristina commented 4 years ago

I've done that too, but I still get the same error. The error reported up here happened after the openssl installation via homebrew

hexploitable commented 4 years ago

Did you set the search paths correctly in the env? I get past this error after that.

honghaoz commented 2 years ago

Here is the detailed steps for a successful compiling on Big Sur (11.6.1) on an Intel Mac.

  1. clone the repo https://github.com/planetbeing/xpwn.git to a local dir
  2. cd to the cloned repo: cd ./xpwn
  3. mkdir build-dir
  4. cd ./build-dir
  5. brew install openssl
  6. make symlink: sudo ln -s /usr/local/opt/openssl/lib/libcrypto.dylib /usr/local/lib/libcrypto1.dylib, as @hexploitable mentioned above.
  7. set environment variables: (from https://github.com/scipr-lab/libsnark/issues/99#issuecomment-367677834)
    LD_LIBRARY_PATH=/usr/local/opt/openssl/lib:"${LD_LIBRARY_PATH}"
    CPATH=/usr/local/opt/openssl/include:"${CPATH}"
    PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:"${PKG_CONFIG_PATH}"
    export LD_LIBRARY_PATH CPATH PKG_CONFIG_PATH
  8. Run CMake:
    CPPFLAGS=-I/usr/local/opt/openssl/include LDFLAGS=-L/usr/local/opt/openssl/lib PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig cmake -DWITH_PROCPS=OFF -DWITH_SUPERCOP=OFF ..
  9. Apply changes from https://github.com/planetbeing/xpwn/pull/15 in ipsw-patch/xpwntool.c, add #include "xpwn/img3.h"
  10. Run make

Now you should see compiled bins under build-dir