hactool icon indicating copy to clipboard operation
hactool copied to clipboard

Unable to compile without errors on macOS 14.3 (arm64).

Open skyzyx opened this issue 1 year ago • 1 comments

Intro

Not a C/C++ dev (Go, Python, and Bash these days), but I've compiled lots of software from source over the years. I generally know my stuff, but I'm a bit shaky here.

Specs

  • macOS 14.3 with Xcode 15.2 installed. Apple M1-class chip (arm64).

  • gcc points to Clang, so I installed real GCC from Homebrew.

    $ ll $(which gcc-13)
    Permissions Links Size User    Group Date Modified    Git Name
    lrwxr-xr-x      1    - rparman admin 2024-01-18 16:12  -I  /opt/homebrew/bin/gcc-13 -> ../Cellar/gcc/13.2.0/bin/gcc-13*
    
  • make is the GNU make.

    $ ll $(which gmake)
    Permissions Links Size User    Group Date Modified    Git Name
    lrwxr-xr-x      1    - rparman admin 2023-02-28 08:16  -I  /opt/homebrew/bin/gmake -> ../Cellar/make/4.4.1/bin/gmake*
    
  • Copied config.mk.templateconfig.mk. Updated CC = gccCC = gcc-13. Left everything else the same. This appears to match https://github.com/SciresM/hactool/blob/master/.github/workflows/build.yml#L41-L43 (except for the change in gcc on the $PATH).

    $ cat config.mk
    CC = gcc-13
    CFLAGS = -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC
    LDFLAGS = -lmbedtls -lmbedx509 -lmbedcrypto
    

Compile logging

$ gmake
gmake -C mbedtls lib
gmake[1]: Entering directory '/Library/WebServer/Documents/switch/hactool/mbedtls'
gmake[2]: Entering directory '/Library/WebServer/Documents/switch/hactool/mbedtls/library'
  CC    aes.c
  CC    aesni.c
  CC    arc4.c
  CC    asn1parse.c
  CC    asn1write.c
  CC    base64.c
  CC    bignum.c
  CC    blowfish.c
  CC    camellia.c
  CC    ccm.c
  CC    cipher.c
  CC    cipher_wrap.c
  CC    cmac.c
cmac.c:428:46: warning: argument 5 of type 'unsigned char *' declared as a pointer [-Warray-parameter=]
  428 |                               unsigned char *output )
      |                               ~~~~~~~~~~~~~~~^~~~~~
In file included from cmac.c:51:
../include/mbedtls/cmac.h:154:45: note: previously declared as an array 'unsigned char[16]'
  154 |                               unsigned char output[16] );
      |                               ~~~~~~~~~~~~~~^~~~~~~~~~
  CC    ctr_drbg.c
  CC    des.c
  CC    dhm.c
  CC    ecdh.c
  CC    ecdsa.c
  CC    ecjpake.c
  CC    ecp.c
  CC    ecp_curves.c
  CC    entropy.c
  CC    entropy_poll.c
  CC    error.c
  CC    gcm.c
  CC    gf128mul.c
  CC    havege.c
  CC    hmac_drbg.c
  CC    md.c
  CC    md2.c
  CC    md4.c
  CC    md5.c
  CC    md_wrap.c
  CC    memory_buffer_alloc.c
  CC    oid.c
  CC    padlock.c
  CC    pem.c
  CC    pk.c
  CC    pk_wrap.c
  CC    pkcs12.c
  CC    pkcs5.c
  CC    pkparse.c
  CC    pkwrite.c
  CC    platform.c
  CC    ripemd160.c
  CC    rsa.c
  CC    sha1.c
  CC    sha256.c
  CC    sha512.c
  CC    threading.c
  CC    timing.c
  CC    version.c
  CC    version_features.c
  CC    xtea.c
  AR    libmbedcrypto.a
  RL    libmbedcrypto.a
  CC    certs.c
  CC    pkcs11.c
  CC    x509.c
  CC    x509_create.c
  CC    x509_crl.c
  CC    x509_crt.c
  CC    x509_csr.c
  CC    x509write_crt.c
  CC    x509write_csr.c
  AR    libmbedx509.a
  RL    libmbedx509.a
  CC    debug.c
  CC    net_sockets.c
  CC    ssl_cache.c
  CC    ssl_ciphersuites.c
  CC    ssl_cli.c
  CC    ssl_cookie.c
  CC    ssl_srv.c
  CC    ssl_ticket.c
  CC    ssl_tls.c
ssl_tls.c:1012:67: warning: argument 2 of type 'unsigned char[36]' with mismatched bound [-Warray-parameter=]
 1012 | void ssl_calc_verify_tls( mbedtls_ssl_context *ssl, unsigned char hash[36] )
      |                                                     ~~~~~~~~~~~~~~^~~~~~~~
ssl_tls.c:466:57: note: previously declared as 'unsigned char *'
  466 | static void ssl_calc_verify_tls( mbedtls_ssl_context *, unsigned char * );
      |                                                         ^~~~~~~~~~~~~~~
ssl_tls.c:1040:74: warning: argument 2 of type 'unsigned char[32]' with mismatched bound [-Warray-parameter=]
 1040 | void ssl_calc_verify_tls_sha256( mbedtls_ssl_context *ssl, unsigned char hash[32] )
      |                                                            ~~~~~~~~~~~~~~^~~~~~~~
ssl_tls.c:473:63: note: previously declared as 'unsigned char *'
  473 | static void ssl_calc_verify_tls_sha256( mbedtls_ssl_context *,unsigned char * );
      |                                                               ^~~~~~~~~~~~~~~
ssl_tls.c:1061:74: warning: argument 2 of type 'unsigned char[48]' with mismatched bound [-Warray-parameter=]
 1061 | void ssl_calc_verify_tls_sha384( mbedtls_ssl_context *ssl, unsigned char hash[48] )
      |                                                            ~~~~~~~~~~~~~~^~~~~~~~
ssl_tls.c:479:64: note: previously declared as 'unsigned char *'
  479 | static void ssl_calc_verify_tls_sha384( mbedtls_ssl_context *, unsigned char * );
      |                                                                ^~~~~~~~~~~~~~~
ssl_tls.c: In function 'ssl_calc_finished_tls_sha384':
ssl_tls.c:5126:5: warning: 'mbedtls_sha512_finish' accessing 64 bytes in a region of size 48 [-Wstringop-overflow=]
 5126 |     mbedtls_sha512_finish( &sha512, padbuf );
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ssl_tls.c:5126:5: note: referencing argument 2 of type 'unsigned char[64]'
In file included from ../include/mbedtls/ssl_internal.h:41,
                 from ssl_tls.c:48:
../include/mbedtls/sha512.h:102:6: note: in a call to function 'mbedtls_sha512_finish'
  102 | void mbedtls_sha512_finish( mbedtls_sha512_context *ctx, unsigned char output[64] );
      |      ^~~~~~~~~~~~~~~~~~~~~
ssl_tls.c: In function 'ssl_calc_verify_tls_sha384':
ssl_tls.c:1070:5: warning: 'mbedtls_sha512_finish' accessing 64 bytes in a region of size 48 [-Wstringop-overflow=]
 1070 |     mbedtls_sha512_finish( &sha512, hash );
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ssl_tls.c:1070:5: note: referencing argument 2 of type 'unsigned char[64]'
../include/mbedtls/sha512.h:102:6: note: in a call to function 'mbedtls_sha512_finish'
  102 | void mbedtls_sha512_finish( mbedtls_sha512_context *ctx, unsigned char output[64] );
      |      ^~~~~~~~~~~~~~~~~~~~~
  AR    libmbedtls.a
  RL    libmbedtls.a
gmake[2]: Leaving directory '/Library/WebServer/Documents/switch/hactool/mbedtls/library'
gmake[1]: Leaving directory '/Library/WebServer/Documents/switch/hactool/mbedtls'
gmake hactool
gmake[1]: Entering directory '/Library/WebServer/Documents/switch/hactool'
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o save.o save.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o sha.o sha.c
sha.c: In function 'new_sha_ctx':
sha.c:17:66: warning: implicit conversion from 'hash_type_t' to 'mbedtls_md_type_t' [-Wenum-conversion]
   17 |     if (mbedtls_md_setup(&ctx->digest, mbedtls_md_info_from_type(type), hmac)) {
      |                                                                  ^~~~
sha.c: In function 'sha256_get_buffer_hmac':
sha.c:67:66: warning: implicit conversion from 'enum <anonymous>' to 'mbedtls_md_type_t' [-Wenum-conversion]
   67 |     if (mbedtls_md_setup(&ctx->digest, mbedtls_md_info_from_type(HASH_TYPE_SHA256), 1)) {
      |                                                                  ^~~~~~~~~~~~~~~~
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o aes.o aes.c
aes.c: In function 'new_aes_ctx':
aes.c:19:78: warning: implicit conversion from 'aes_mode_t' to 'mbedtls_cipher_type_t' [-Wenum-conversion]
   19 |     if (mbedtls_cipher_setup(&ctx->cipher_dec, mbedtls_cipher_info_from_type(mode))
      |                                                                              ^~~~
aes.c:20:81: warning: implicit conversion from 'aes_mode_t' to 'mbedtls_cipher_type_t' [-Wenum-conversion]
   20 |         || mbedtls_cipher_setup(&ctx->cipher_enc, mbedtls_cipher_info_from_type(mode))) {
      |                                                                                 ^~~~
aes.c:24:68: warning: implicit conversion from 'enum <anonymous>' to 'mbedtls_operation_t' [-Wenum-conversion]
   24 |     if (mbedtls_cipher_setkey(&ctx->cipher_dec, key, key_size * 8, AES_DECRYPT)
      |                                                                    ^~~~~~~~~~~
aes.c:25:71: warning: implicit conversion from 'enum <anonymous>' to 'mbedtls_operation_t' [-Wenum-conversion]
   25 |         || mbedtls_cipher_setkey(&ctx->cipher_enc, key, key_size * 8, AES_ENCRYPT)) {
      |                                                                       ^~~~~~~~~~~
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o extkeys.o extkeys.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o rsa.o rsa.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o npdm.o npdm.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o bktr.o bktr.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o kip.o kip.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o packages.o packages.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o pki.o pki.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o pfs0.o pfs0.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o hfs0.o hfs0.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o nca0_romfs.o nca0_romfs.c
nca0_romfs.c: In function 'nca0_romfs_print':
nca0_romfs.c:141:41: warning: unused parameter 'ctx' [-Wunused-parameter]
  141 | void nca0_romfs_print(nca0_romfs_ctx_t *ctx) {
      |                       ~~~~~~~~~~~~~~~~~~^~~
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o romfs.o romfs.c
romfs.c: In function 'romfs_print':
romfs.c:140:31: warning: unused parameter 'ctx' [-Wunused-parameter]
  140 | void romfs_print(romfs_ctx_t *ctx) {
      |                  ~~~~~~~~~~~~~^~~
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o utils.o utils.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o nax0.o nax0.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o nso.o nso.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o lz4.o lz4.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o nca.o nca.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o xci.o xci.c
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o main.o main.c
main.c: In function 'usage':
main.c:112:9: warning: string length '5108' is greater than the length '4095' ISO C99 compilers are required to support [-Woverlength-strings]
  112 |         "\n", __TIME__, __DATE__, prog_name);
      |         ^~~~
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o filepath.o filepath.c
filepath.c: In function 'filepath_set':
filepath.c:109:9: warning: '__builtin_strncpy' specified bound 1023 equals destination size [-Wstringop-truncation]
  109 |         strncpy(fpath->char_path, path, MAX_PATH);
      |         ^~~~~~~
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o ConvertUTF.o ConvertUTF.c
ConvertUTF.c: In function 'ConvertUTF16toUTF8':
ConvertUTF.c:270:72: warning: this statement may fall through [-Wimplicit-fallthrough=]
  270 |             case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
      |                                                                     ~~~^~~~~
ConvertUTF.c:271:13: note: here
  271 |             case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
      |             ^~~~
ConvertUTF.c:271:72: warning: this statement may fall through [-Wimplicit-fallthrough=]
  271 |             case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
      |                                                                     ~~~^~~~~
ConvertUTF.c:272:13: note: here
  272 |             case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
      |             ^~~~
ConvertUTF.c:272:72: warning: this statement may fall through [-Wimplicit-fallthrough=]
  272 |             case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
      |                                                                     ~~~^~~~~
ConvertUTF.c:273:13: note: here
  273 |             case 1: *--target =  (UTF8)(ch | firstByteMark[bytesToWrite]);
      |             ^~~~
ConvertUTF.c: In function 'isLegalUTF8':
ConvertUTF.c:301:42: warning: this statement may fall through [-Wimplicit-fallthrough=]
  301 |     case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
ConvertUTF.c:302:5: note: here
  302 |     case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
      |     ^~~~
ConvertUTF.c:302:42: warning: this statement may fall through [-Wimplicit-fallthrough=]
  302 |     case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
ConvertUTF.c:303:5: note: here
  303 |     case 2: if ((a = (*--srcptr)) > 0xBF) return false;
      |     ^~~~
ConvertUTF.c:305:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
  305 |         switch (*source) {
      |         ^~~~~~
ConvertUTF.c:314:5: note: here
  314 |     case 1: if (*source >= 0x80 && *source < 0xC2) return false;
      |     ^~~~
ConvertUTF.c: In function 'ConvertUTF8toUTF16':
ConvertUTF.c:357:41: warning: this statement may fall through [-Wimplicit-fallthrough=]
  357 |             case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
      |                                      ~~~^~~~~
ConvertUTF.c:358:13: note: here
  358 |             case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
      |             ^~~~
ConvertUTF.c:358:41: warning: this statement may fall through [-Wimplicit-fallthrough=]
  358 |             case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
      |                                      ~~~^~~~~
ConvertUTF.c:359:13: note: here
  359 |             case 3: ch += *source++; ch <<= 6;
      |             ^~~~
ConvertUTF.c:359:41: warning: this statement may fall through [-Wimplicit-fallthrough=]
  359 |             case 3: ch += *source++; ch <<= 6;
      |                                      ~~~^~~~~
ConvertUTF.c:360:13: note: here
  360 |             case 2: ch += *source++; ch <<= 6;
      |             ^~~~
ConvertUTF.c:360:41: warning: this statement may fall through [-Wimplicit-fallthrough=]
  360 |             case 2: ch += *source++; ch <<= 6;
      |                                      ~~~^~~~~
ConvertUTF.c:361:13: note: here
  361 |             case 1: ch += *source++; ch <<= 6;
      |             ^~~~
ConvertUTF.c:361:41: warning: this statement may fall through [-Wimplicit-fallthrough=]
  361 |             case 1: ch += *source++; ch <<= 6;
      |                                      ~~~^~~~~
ConvertUTF.c:362:13: note: here
  362 |             case 0: ch += *source++;
      |             ^~~~
ConvertUTF.c: In function 'ConvertUTF32toUTF8':
ConvertUTF.c:448:72: warning: this statement may fall through [-Wimplicit-fallthrough=]
  448 |             case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
      |                                                                     ~~~^~~~~
ConvertUTF.c:449:13: note: here
  449 |             case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
      |             ^~~~
ConvertUTF.c:449:72: warning: this statement may fall through [-Wimplicit-fallthrough=]
  449 |             case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
      |                                                                     ~~~^~~~~
ConvertUTF.c:450:13: note: here
  450 |             case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
      |             ^~~~
ConvertUTF.c:450:72: warning: this statement may fall through [-Wimplicit-fallthrough=]
  450 |             case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
      |                                                                     ~~~^~~~~
ConvertUTF.c:451:13: note: here
  451 |             case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
      |             ^~~~
ConvertUTF.c: In function 'ConvertUTF8toUTF32':
ConvertUTF.c:483:41: warning: this statement may fall through [-Wimplicit-fallthrough=]
  483 |             case 5: ch += *source++; ch <<= 6;
      |                                      ~~~^~~~~
ConvertUTF.c:484:13: note: here
  484 |             case 4: ch += *source++; ch <<= 6;
      |             ^~~~
ConvertUTF.c:484:41: warning: this statement may fall through [-Wimplicit-fallthrough=]
  484 |             case 4: ch += *source++; ch <<= 6;
      |                                      ~~~^~~~~
ConvertUTF.c:485:13: note: here
  485 |             case 3: ch += *source++; ch <<= 6;
      |             ^~~~
ConvertUTF.c:485:41: warning: this statement may fall through [-Wimplicit-fallthrough=]
  485 |             case 3: ch += *source++; ch <<= 6;
      |                                      ~~~^~~~~
ConvertUTF.c:486:13: note: here
  486 |             case 2: ch += *source++; ch <<= 6;
      |             ^~~~
ConvertUTF.c:486:41: warning: this statement may fall through [-Wimplicit-fallthrough=]
  486 |             case 2: ch += *source++; ch <<= 6;
      |                                      ~~~^~~~~
ConvertUTF.c:487:13: note: here
  487 |             case 1: ch += *source++; ch <<= 6;
      |             ^~~~
ConvertUTF.c:487:41: warning: this statement may fall through [-Wimplicit-fallthrough=]
  487 |             case 1: ch += *source++; ch <<= 6;
      |                                      ~~~^~~~~
ConvertUTF.c:488:13: note: here
  488 |             case 0: ch += *source++;
      |             ^~~~
gcc-13 -I ./mbedtls/include -c -O2 -Wall -Wextra -pedantic -std=gnu11 -fPIC -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 -o cJSON.o cJSON.c
gcc-13 -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: multiple errors: archive member '/' not a mach-o file in '/Library/WebServer/Documents/switch/hactool/mbedtls/library/libmbedtls.a'; archive member '/' not a mach-o file in '/Library/WebServer/Documents/switch/hactool/mbedtls/library/libmbedx509.a'; archive member '/' not a mach-o file in '/Library/WebServer/Documents/switch/hactool/mbedtls/library/libmbedcrypto.a'
collect2: error: ld returned 1 exit status
gmake[1]: *** [Makefile:17: hactool] Error 1
gmake[1]: Leaving directory '/Library/WebServer/Documents/switch/hactool'
gmake: *** [Makefile:11: all] Error 2

I seem to be getting an error on the linking step.

ld: multiple errors: archive member '/' not a mach-o file in '/Library/WebServer/Documents/switch/hactool/mbedtls/library/libmbedtls.a'; archive member '/' not a mach-o file in '/Library/WebServer/Documents/switch/hactool/mbedtls/library/libmbedx509.a'; archive member '/' not a mach-o file in '/Library/WebServer/Documents/switch/hactool/mbedtls/library/libmbedcrypto.a'
collect2: error: ld returned 1 exit status

Not sure where to go from here. Any tips would be appreciated.

skyzyx avatar Feb 18 '24 19:02 skyzyx

Also, looks like ld is the macOS ld.

$ ll $(which ld)
Permissions Links Size User Group Date Modified    Name
.rwxr-xr-x@    76 119k root wheel 2024-02-08 23:38  /usr/bin/ld*

skyzyx avatar Feb 18 '24 19:02 skyzyx