The program won't compile nor link on Linux ARM64.
Here's what I did:
cd src
cmake ../
make
But then an error shows up:
cc: error: unrecognized command line option ‘-masm=intel’
make[2]: *** [CMakeFiles/pkg_pfs_tool.dir/build.make:63: CMakeFiles/pkg_pfs_tool.dir/compression.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/pkg_pfs_tool.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
To "fix" it, I changed this line in CMakeLists.txt
12 #add_compile_options(-masm=intel -march=native)
And then "make" compiles, but can't link because the architecture is recognized as "linux64":
[...]
[100%] Linking C executable pkg_pfs_tool
/usr/bin/ld: ../thirdparty/lib/linux64/libmbedcrypto.a(aes.c.o): Relocations in generic ELF (EM: 62)
/usr/bin/ld: ../thirdparty/lib/linux64/libmbedcrypto.a(aes.c.o): Relocations in generic ELF (EM: 62)
/usr/bin/ld: ../thirdparty/lib/linux64/libmbedcrypto.a: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/pkg_pfs_tool.dir/build.make:433: pkg_pfs_tool] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/pkg_pfs_tool.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
If I force "../thirdparty/lib/darwin-arm64" via CMakeLists.txt, it won't link either:
67 set(THIRDPARTY_LIB_DIR "${THIRDPARTY_ROOT_DIR}/lib/darwin-arm64")
"make" output:
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `crypto_initialize':
crypto.c:(.text+0x10): undefined reference to `mbedtls_entropy_init'
/usr/bin/ld: crypto.c:(.text+0x1c): undefined reference to `mbedtls_ctr_drbg_init'
/usr/bin/ld: crypto.c:(.text+0x34): undefined reference to `mbedtls_cipher_info_from_type'
/usr/bin/ld: crypto.c:(.text+0x74): undefined reference to `mbedtls_md_info_from_type'
/usr/bin/ld: crypto.c:(.text+0xc0): undefined reference to `mbedtls_entropy_func'
/usr/bin/ld: crypto.c:(.text+0xc4): undefined reference to `mbedtls_entropy_func'
/usr/bin/ld: crypto.c:(.text+0xd0): undefined reference to `mbedtls_ctr_drbg_seed'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `crypto_finalize':
crypto.c:(.text+0x138): undefined reference to `mbedtls_ctr_drbg_free'
/usr/bin/ld: crypto.c:(.text+0x144): undefined reference to `mbedtls_entropy_free'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `rsa_public':
crypto.c:(.text+0x20c): undefined reference to `mbedtls_rsa_init'
/usr/bin/ld: crypto.c:(.text+0x244): undefined reference to `mbedtls_rsa_public'
/usr/bin/ld: crypto.c:(.text+0x2a0): undefined reference to `mbedtls_rsa_free'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `rsa_private':
crypto.c:(.text+0x368): undefined reference to `mbedtls_rsa_init'
/usr/bin/ld: crypto.c:(.text+0x3a8): undefined reference to `mbedtls_ctr_drbg_random'
/usr/bin/ld: crypto.c:(.text+0x3ac): undefined reference to `mbedtls_ctr_drbg_random'
/usr/bin/ld: crypto.c:(.text+0x3b4): undefined reference to `mbedtls_rsa_private'
/usr/bin/ld: crypto.c:(.text+0x410): undefined reference to `mbedtls_rsa_free'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `mbedtls_rsa_rsaes_pkcs1_v15_decrypt_ex':
crypto.c:(.text+0x4c0): undefined reference to `mbedtls_rsa_public'
/usr/bin/ld: crypto.c:(.text+0x4e0): undefined reference to `mbedtls_rsa_private'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `rsa_pkcsv15_decrypt':
crypto.c:(.text+0x88c): undefined reference to `mbedtls_rsa_init'
/usr/bin/ld: crypto.c:(.text+0x944): undefined reference to `mbedtls_ctr_drbg_random'
/usr/bin/ld: crypto.c:(.text+0x948): undefined reference to `mbedtls_ctr_drbg_random'
/usr/bin/ld: crypto.c:(.text+0x9b8): undefined reference to `mbedtls_rsa_free'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `rsa_pkcsv15_verify_by_hash':
crypto.c:(.text+0xa8c): undefined reference to `mbedtls_rsa_init'
/usr/bin/ld: crypto.c:(.text+0xb08): undefined reference to `mbedtls_ctr_drbg_random'
/usr/bin/ld: crypto.c:(.text+0xb0c): undefined reference to `mbedtls_ctr_drbg_random'
/usr/bin/ld: crypto.c:(.text+0xb14): undefined reference to `mbedtls_rsa_pkcs1_verify'
/usr/bin/ld: crypto.c:(.text+0xb48): undefined reference to `mbedtls_rsa_free'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `setup_rsa_keyset':
crypto.c:(.text+0xce8): undefined reference to `mbedtls_mpi_read_string'
/usr/bin/ld: crypto.c:(.text+0xd74): undefined reference to `mbedtls_mpi_read_string'
/usr/bin/ld: crypto.c:(.text+0xe0c): undefined reference to `mbedtls_mpi_read_string'
/usr/bin/ld: crypto.c:(.text+0xe78): undefined reference to `mbedtls_mpi_read_string'
/usr/bin/ld: crypto.c:(.text+0xee4): undefined reference to `mbedtls_mpi_read_string'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o:crypto.c:(.text+0xf34): more undefined references to `mbedtls_mpi_read_string' follow
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `setup_rsa_keyset':
crypto.c:(.text+0x10a8): undefined reference to `mbedtls_mpi_size'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `sha256_buffer':
crypto.c:(.text+0x1144): undefined reference to `mbedtls_md_init'
/usr/bin/ld: crypto.c:(.text+0x115c): undefined reference to `mbedtls_md_setup'
/usr/bin/ld: crypto.c:(.text+0x1164): undefined reference to `mbedtls_md_starts'
/usr/bin/ld: crypto.c:(.text+0x1174): undefined reference to `mbedtls_md_update'
/usr/bin/ld: crypto.c:(.text+0x1180): undefined reference to `mbedtls_md_finish'
/usr/bin/ld: crypto.c:(.text+0x1188): undefined reference to `mbedtls_md_free'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `sha256_buffer_chunked':
crypto.c:(.text+0x1250): undefined reference to `mbedtls_md_init'
/usr/bin/ld: crypto.c:(.text+0x1268): undefined reference to `mbedtls_md_setup'
/usr/bin/ld: crypto.c:(.text+0x1270): undefined reference to `mbedtls_md_starts'
/usr/bin/ld: crypto.c:(.text+0x12bc): undefined reference to `mbedtls_md_update'
/usr/bin/ld: crypto.c:(.text+0x12d4): undefined reference to `mbedtls_md_finish'
/usr/bin/ld: crypto.c:(.text+0x12ec): undefined reference to `mbedtls_md_free'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `hmac_sha256_buffer':
crypto.c:(.text+0x13b0): undefined reference to `mbedtls_md_init'
/usr/bin/ld: crypto.c:(.text+0x13c8): undefined reference to `mbedtls_md_setup'
/usr/bin/ld: crypto.c:(.text+0x13d8): undefined reference to `mbedtls_md_hmac_starts'
/usr/bin/ld: crypto.c:(.text+0x13e8): undefined reference to `mbedtls_md_hmac_update'
/usr/bin/ld: crypto.c:(.text+0x13f4): undefined reference to `mbedtls_md_hmac_finish'
/usr/bin/ld: crypto.c:(.text+0x13fc): undefined reference to `mbedtls_md_free'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `hmac_sha256_buffer_chunked':
crypto.c:(.text+0x14f8): undefined reference to `mbedtls_md_init'
/usr/bin/ld: crypto.c:(.text+0x1510): undefined reference to `mbedtls_md_setup'
/usr/bin/ld: crypto.c:(.text+0x1520): undefined reference to `mbedtls_md_hmac_starts'
/usr/bin/ld: crypto.c:(.text+0x156c): undefined reference to `mbedtls_md_hmac_update'
/usr/bin/ld: crypto.c:(.text+0x1584): undefined reference to `mbedtls_md_hmac_finish'
/usr/bin/ld: crypto.c:(.text+0x1594): undefined reference to `mbedtls_md_free'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `aes_encrypt_cbc_cts':
crypto.c:(.text+0x16f0): undefined reference to `mbedtls_aes_init'
/usr/bin/ld: crypto.c:(.text+0x1708): undefined reference to `mbedtls_aes_setkey_enc'
/usr/bin/ld: crypto.c:(.text+0x17bc): undefined reference to `mbedtls_aes_crypt_cbc'
/usr/bin/ld: crypto.c:(.text+0x181c): undefined reference to `mbedtls_aes_crypt_ecb'
/usr/bin/ld: crypto.c:(.text+0x18b0): undefined reference to `mbedtls_aes_free'
/usr/bin/ld: crypto.c:(.text+0x18d4): undefined reference to `mbedtls_aes_free'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `aes_decrypt_cbc_cts':
crypto.c:(.text+0x1ad0): undefined reference to `mbedtls_aes_init'
/usr/bin/ld: crypto.c:(.text+0x1ae8): undefined reference to `mbedtls_aes_setkey_dec'
/usr/bin/ld: crypto.c:(.text+0x1b10): undefined reference to `mbedtls_aes_crypt_cbc'
/usr/bin/ld: crypto.c:(.text+0x1b20): undefined reference to `mbedtls_aes_free'
/usr/bin/ld: crypto.c:(.text+0x1b74): undefined reference to `mbedtls_aes_init'
/usr/bin/ld: crypto.c:(.text+0x1b8c): undefined reference to `mbedtls_aes_setkey_enc'
/usr/bin/ld: crypto.c:(.text+0x1bb0): undefined reference to `mbedtls_aes_crypt_ecb'
/usr/bin/ld: crypto.c:(.text+0x1bc0): undefined reference to `mbedtls_aes_free'
/usr/bin/ld: crypto.c:(.text+0x1c70): undefined reference to `mbedtls_aes_free'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `aes_decrypt_oex':
crypto.c:(.text+0x1ec4): undefined reference to `mbedtls_aes_setkey_enc'
/usr/bin/ld: crypto.c:(.text+0x1f30): undefined reference to `mbedtls_aes_crypt_ecb'
/usr/bin/ld: crypto.c:(.text+0x2000): undefined reference to `mbedtls_aes_free'
/usr/bin/ld: crypto.c:(.text+0x201c): undefined reference to `mbedtls_aes_free'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `aes_cmac':
crypto.c:(.text+0x20f8): undefined reference to `mbedtls_cipher_cmac'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `encdec_device_alloc':
crypto.c:(.text+0x22ac): undefined reference to `mbedtls_aes_xts_init'
/usr/bin/ld: crypto.c:(.text+0x22d8): undefined reference to `mbedtls_aes_xts_setkey_enc'
/usr/bin/ld: crypto.c:(.text+0x2300): undefined reference to `mbedtls_aes_xts_init'
/usr/bin/ld: crypto.c:(.text+0x2330): undefined reference to `mbedtls_aes_xts_setkey_dec'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `encdec_device_free':
crypto.c:(.text+0x23d0): undefined reference to `mbedtls_aes_xts_free'
/usr/bin/ld: crypto.c:(.text+0x23dc): undefined reference to `mbedtls_aes_xts_free'
/usr/bin/ld: CMakeFiles/pkg_pfs_tool.dir/crypto.c.o: in function `encdec_device_process':
crypto.c:(.text+0x2584): undefined reference to `mbedtls_aes_crypt_xts'
/usr/bin/ld: crypto.c:(.text+0x2614): undefined reference to `mbedtls_aes_crypt_xts'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/pkg_pfs_tool.dir/build.make:433: pkg_pfs_tool] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/pkg_pfs_tool.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Do you know how to fix this and add Linux ARM support?