igrr / mkspiffs

Tool to build and unpack SPIFFS images
MIT License
186 stars 91 forks source link

Make fails on M1 pro Mac book Pro #84

Open dejavu1987 opened 1 year ago

dejavu1987 commented 1 year ago

I am trying to build on M1 mac book pro. I get the following error.

      _spiffs_gc_find_candidate in spiffs_gc.o
      _spiffs_object_append in spiffs_nucleus.o
      _spiffs_object_truncate in spiffs_nucleus.o
  "_mkdir", referenced from:
      dirCreate(char const*) in main.o
  "_opendir$INODE64$UNIX2003", referenced from:
      addFiles(char const*, char const*) in main.o
      dirExists(char const*) in main.o
  "_printf", referenced from:
      _SPIFFS_vis in spiffs_hydrogen.o
  "_putchar", referenced from:
      _SPIFFS_vis in spiffs_hydrogen.o
  "_puts", referenced from:
      _SPIFFS_vis in spiffs_hydrogen.o
  "_readdir$INODE64", referenced from:
      addFiles(char const*, char const*) in main.o
  "_stat$INODE64", referenced from:
      addFiles(char const*, char const*) in main.o
  "_strcmp", referenced from:
      addFiles(char const*, char const*) in main.o
      _spiffs_object_find_object_index_header_by_name_v in spiffs_nucleus.o
      _spiffs_obj_lu_find_free_obj_id_bitmap_v in spiffs_nucleus.o
      _spiffs_obj_lu_find_free_obj_id_compact_v in spiffs_nucleus.o
  "_strlen", referenced from:
      addFile(char*, char const*) in main.o
      addFiles(char const*, char const*) in main.o
      listFiles() in main.o
      unpackFiles(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>) in main.o
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::basic_string[abi:v15006]<std::nullptr_t>(char const*) in main.o
      _SPIFFS_creat in spiffs_hydrogen.o
      _SPIFFS_open in spiffs_hydrogen.o
      ...
  "_strncpy", referenced from:
      _spiffs_stat_pix in spiffs_hydrogen.o
      _spiffs_object_create in spiffs_nucleus.o
      _spiffs_object_update_index_hdr in spiffs_nucleus.o
  "start", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mkspiffs] Error 1

GCC version

gcc -v
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
new-soul commented 11 months ago

Me too. I plan to back to Macbook of intel.

pawelskr commented 11 months ago

A Makefile seems to be outdated. I used a dirty hack and commented out this section in Makefile and then I managed to build tool without any errors 😄

ifeq ($(TARGET_OS),osx)
    TARGET_CFLAGS   = -mmacosx-version-min=10.7 -arch i386 -arch x86_64
    TARGET_CXXFLAGS = -mmacosx-version-min=10.7 -arch i386 -arch x86_64 -stdlib=libc++
    TARGET_LDFLAGS  = -mmacosx-version-min=10.7 -arch i386 -arch x86_64 -stdlib=libc++
endif
clang --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

MacOS Ventura 13.5 (22G74) - intel based

new-soul commented 11 months ago

ifeq ($(TARGET_OS),osx) TARGET_CFLAGS = -mmacosx-version-min=10.7 -arch x86_64 TARGET_CXXFLAGS = -mmacosx-version-min=10.7 -arch x86_64 -stdlib=libc++ TARGET_LDFLAGS = -mmacosx-version-min=10.7 -arch x86_64 -stdlib=libc++ endif I remove the '-arch i386' is OK now.