Skip to content

Some fixes for Apple Silicon & Ventura #3

@fortiko

Description

@fortiko

Hello! I just thought I'd leave some recent hints here, in case somebody else is looking to compile this repo.

According to the docs:
brew install acme cc65 libftdi0 cmake confuse imagemagick

In my experience, you also want to:
brew install gcc libusb libusb-compat libftdi0 imagemagick

Then there is an issue I wasn't able to solve: brew install wxwidgets --with-static doesn't work anymore, because option "--with-static" was removed. My solution was to remove --static from WXCONFIGLIBS and just link dynamically, because I didn't manage to build wxWidgets in a way on Apple Silicon that would allow for static linking ¯_(ツ)_/¯ For the bold, you can try to follow this: https://www.betamaster.us/blog/?p=1999 and contribute back here if you manage to make it work.

Then there are a couple of code changes, since applications now needs to add the Security framework if they use libusb-1.0.a.

diff --git a/EasyTransfer/Makefile b/EasyTransfer/Makefile
index 3702699..9c1848a 100644
--- a/EasyTransfer/Makefile
+++ b/EasyTransfer/Makefile
@@ -53,7 +53,7 @@ ifeq ($(win32), yes)
 else
 	LIBDIR        := /usr/local/lib
 	# Link to static wx
-	WXCONFIGLIBS  := $(shell wx-config --static --libs)
+	WXCONFIGLIBS  := $(shell wx-config --libs)
 	# Link to static dependencies, too
 	WXCONFIGLIBS  := $(WXCONFIGLIBS:-lpng=$(LIBDIR)/libpng.a)
 	WXCONFIGLIBS  := $(WXCONFIGLIBS:-ljpeg=$(LIBDIR)/libjpeg.a)
@@ -63,9 +63,9 @@ else
     cxx           := c++
     cc            := gcc
     outbase       := $(top_dir)/out
-    cxxflags      += $(shell wx-config --static --cxxflags)
-    cxxlibs       += $(LIBDIR)/libftdi.a $(LIBDIR)/libusb.a $(LIBDIR)/libusb-1.0.a $(WXCONFIGLIBS) -lpthread
-    clibs         += $(LIBDIR)/libftdi.a $(LIBDIR)/libusb.a $(LIBDIR)/libusb-1.0.a -framework IOKit -framework CoreFoundation
+    cxxflags      += $(shell wx-config --cxxflags)
+    cxxlibs       += $(LIBDIR)/libftdi.a $(LIBDIR)/libusb.a $(LIBDIR)/libusb-1.0.a $(WXCONFIGLIBS) -lpthread  -framework Security
+    clibs         += $(LIBDIR)/libftdi.a $(LIBDIR)/libusb.a $(LIBDIR)/libusb-1.0.a -framework IOKit -framework CoreFoundation -framework Security
     archive_fmt   := tar.bz2
     icon_resize   :=
 
@@ -274,7 +274,7 @@ $(objdir)/%.o: $(objdir)/%.c $(headers) | pre_deps
 
 $(objdir)/%.c: $(srcdir)/%.prg | $(objdir) pre_deps
 	mkdir -p $(dir $@)
-	python make/bin2c.py $< $@ $(notdir $(basename $@))
+	python3 make/bin2c.py $< $@ $(notdir $(basename $@))
 
 $(objdir)/%.res.o: $(srcdir)/%.rc | $(objdir) pre_deps
 	$(windres) -I $(objdir) $< $@
diff --git a/EasyTransfer/make/bin2c.py b/EasyTransfer/make/bin2c.py
index 3816ae8..95ade9d 100644
--- a/EasyTransfer/make/bin2c.py
+++ b/EasyTransfer/make/bin2c.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 
 
@@ -7,14 +7,14 @@ if __name__ == '__main__':
         if sys.argv[1] == '-':
             instream = sys.stdin
         else:
-            instream = file(sys.argv[1],'rb')
+            instream = open(sys.argv[1],'rb')
         if sys.argv[2] == '-':
             outstream = sys.stdout
         else:
-            outstream = file(sys.argv[2], 'wt')
+            outstream = open(sys.argv[2], 'wt')
         varname = sys.argv[3]
     else:
-        print "Usage: bin2c infile outfile varname"
+        print("Usage: bin2c infile outfile varname")
         sys.exit(0)
 
     outstream.write("\n\nconst unsigned char %s[] = {\n    " % varname)
@@ -31,3 +31,4 @@ if __name__ == '__main__':
     outstream.write("\nint %s_size = %i;\n\n" % (varname, written))
 
     sys.exit(0)
+
diff --git a/EasyTransfer/src/ef3xfer_log.c b/EasyTransfer/src/ef3xfer_log.c
index 638de48..cdb6625 100644
--- a/EasyTransfer/src/ef3xfer_log.c
+++ b/EasyTransfer/src/ef3xfer_log.c
@@ -23,6 +23,7 @@
 
 #include <stdarg.h>
 #include <string.h>
+#include <stdio.h>
 
 #include <ftdi.h>
 
diff --git a/EasyTransfer/src/ef3xfer_usb_test.c b/EasyTransfer/src/ef3xfer_usb_test.c
index 2de5210..264cd4d 100644
--- a/EasyTransfer/src/ef3xfer_usb_test.c
+++ b/EasyTransfer/src/ef3xfer_usb_test.c
@@ -31,7 +31,7 @@
 
 static int test_sequence(void);
 static int check_usb_with_value(uint8_t val);
-
+int run_usb_test();
 
 /*****************************************************************************/
 /**

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions