Closed Pysis868 closed 4 years ago
This builds completely fine for me OOB on Catalina with this config. Looks like you've somehow built mbedtls with the wrong architecture.
export CC=clang
export AR=ar
export CFLAGS = -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC
export LDFLAGS = -lmbedtls -lmbedx509 -lmbedcrypto
Can try this config & do a make clean_full
to clean mbedtls first (once https://github.com/SciresM/hactool/pull/97 is merged).
FWIW, you can get hactool via devkitPro pacman if you're a toolchain user. i.e. sudo dkp-pacman -S hactool
Commit: 2b0c791f9485f78ee359f45c91b97a48d534e9e6
> gmake clean_full
rm -f *.o hactool hactool.exe
gmake -C mbedtls clean
gmake[1]: Entering directory '.../hactool/mbedtls'
gmake[2]: Entering directory '.../hactool/mbedtls/library'
gmake[2]: Leaving directory '.../hactool/mbedtls/library'
gmake[2]: Entering directory '.../hactool/mbedtls/programs'
gmake[2]: Leaving directory '.../hactool/mbedtls/programs'
gmake[2]: Entering directory '.../hactool/mbedtls/tests'
gmake[2]: Leaving directory '.../hactool/mbedtls/tests'
gmake[1]: Leaving directory '.../hactool/mbedtls'
Config:
CC = gcc
CC = clang
AR = ar
CC1 = /usr/local/opt/gcc/bin/gcc-9
CFLAGS = -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC
LDFLAGS = -lmbedtls -lmbedx509 -lmbedcrypto
Building:
gmake
gmake -C mbedtls lib
gmake[1]: Entering directory '.../hactool/mbedtls'
gmake[2]: Entering directory '.../hactool/mbedtls/library'
CC aes.c
...
clang -o hactool save.o sha.o aes.o extkeys.o rsa.o npdm.o bktr.o kip.o packages.o pki.o pfs0.o hfs0.o nca0_romfs.o romfs.o utils.o nax0.o nso.o lz4.o nca.o xci.o main.o filepath.o ConvertUTF.o cJSON.o -L ./mbedtls/library -lmbedtls -lmbedx509 -lmbedcrypto
ld: warning: ignoring file ./mbedtls/library/libmbedtls.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file ./mbedtls/library/libmbedcrypto.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file ./mbedtls/library/libmbedx509.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
Undefined symbols for architecture x86_64:
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[1]: *** [Makefile:17: hactool] Error 1
gmake[1]: Leaving directory '.../hactool'
gmake: *** [Makefile:11: all] Error 2
Why are you adding extra bits to the config I posted in https://github.com/SciresM/hactool/issues/96#issuecomment-653614711?
This builds fine OOB on a fresh Catalina install with xcode command line tools. Would personally recommend staying far, far away from brew or whatever that is you're using. It's clearly broken.
Just how I keep old entries in case I want to switch them on again quickly.
Tried it with CC1 = gcc
as well to disable that part.
Xcode: 11.4.1
> ls -l (which gmake)
lrwxr-xr-x 1 ... admin 28 2020-04-27 15:03 /usr/local/bin/gmake -> ../Cellar/make/4.3/bin/gmake
> brew info make
make: stable 4.3 (bottled)
Utility for directing compilation
https://www.gnu.org/software/make/
/usr/local/Cellar/make/4.3 (15 files, 1MB) *
Poured from bottle on 2020-04-27 at 15:03:37
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/make.rb
...
> brew info automake
automake: stable 1.16.2 (bottled)
Tool for generating GNU Standards-compliant Makefiles
https://www.gnu.org/software/automake/
/usr/local/Cellar/automake/1.16.2 (131 files, 3.4MB) *
Poured from bottle on 2020-04-27 at 15:10:20
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/automake.rb
...
> brew info autoconf
autoconf: stable 2.69 (bottled)
Automatic configure script builder
https://www.gnu.org/software/autoconf
/usr/local/Cellar/autoconf/2.69 (70 files, 3.0MB) *
Poured from bottle on 2017-08-06 at 14:00:31
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/autoconf.rb
...
k. One last shot.
Try exactly this config as written. No modifications of any kind.
export CC=/usr/bin/clang
export AR=/usr/bin/ar
export CFLAGS = -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC
export LDFLAGS = -lmbedtls -lmbedx509 -lmbedcrypto
and then run /usr/bin/make
directly.
Whatever you're trying to compile hactool with is broken. If using direct paths to official apple tools doesn't work then your machine is hosed and I'd reinstall your OS.
That seemed to do it, thanks.
Besides trying to keep the config.mk
file clean, I noticed the ar
is different, but I was also using gmake
earlier based on the readme mention. Used regular apple's make
this time.
~/D/s/hactool (master=) gmake clean_full
rm -f *.o hactool hactool.exe
gmake -C mbedtls clean
gmake[1]: Entering directory '.../hactool/mbedtls'
gmake[2]: Entering directory '.../hactool/mbedtls/library'
gmake[2]: Leaving directory '.../hactool/mbedtls/library'
gmake[2]: Entering directory '.../hactool/mbedtls/programs'
gmake[2]: Leaving directory '.../hactool/mbedtls/programs'
gmake[2]: Entering directory '.../hactool/mbedtls/tests'
gmake[2]: Leaving directory '.../hactool/mbedtls/tests'
gmake[1]: Leaving directory '.../hactool/mbedtls'
~/D/s/hactool (master=) which make
/usr/bin/make
~/D/s/hactool (master=) which clang
/usr/bin/clang
~/D/s/hactool (master=) which ar
/usr/local/bin/ar
~/D/s/hactool (master=) pbpaste > config.mk
~/D/s/hactool (master=) cat config.mk
export CC=/usr/bin/clang
export AR=/usr/bin/ar
export CFLAGS = -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC
export LDFLAGS = -lmbedtls -lmbedx509 -lmbedcrypto
~/D/s/hactool (master=) ls -l hactool
-rwxr-xr-x 1 ... staff 473K 2020-07-03 16:54 hactool
If I try from the repos, I get this:
~ sudo dkp-pacman -S hactool
:: Synchronizing package databases...
dkp-libs is up to date
dkp-osx is up to date
resolving dependencies...
looking for conflicting packages...
Packages (1) hactool-1.3.2-1
...
(1/1) checking available disk space [###########################################] 100%
error: Partition / is mounted read only
fwiw apple make is gnu make.
% make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
If I try from the repos, I get this:
~ sudo dkp-pacman -S hactool :: Synchronizing package databases... dkp-libs is up to date dkp-osx is up to date resolving dependencies... looking for conflicting packages... Packages (1) hactool-1.3.2-1 ... (1/1) checking available disk space [###########################################] 100% error: Partition / is mounted read only
That's the issue with Catalina https://github.com/devkitPro/pacman/issues/15
It's been fixed with latest pacman installer https://github.com/devkitPro/pacman/releases/latest
Config:
Using
gmake
as specifically instructed.Compiler:
Linker:
/usr/local/opt/gcc/bin/gcc-9
didn't build at all. Got stuck onstdio.h
.Building:
Branch: master, origin/master Commit: f55d6f2506a38ef05ec0ab99ec4041313d5e6d7a System (OS): macOS 10.15.4