SQLite Forum

Compile for Apple Silicon
Login
Looking at building a universal binary for macOS Intel & Apple Silicon.

Downloaded the sqlite-amalgamation-3370000 and used:

clang++ -arch arm64 -arch x86_64 -o sqlite_build sqlite3.c

...to try build. Managed to get as far as the output below. Seems very close, like I'm just missing the right compiler flags...? Any thoughts?

```
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
sqlite3.c:21601:20: error: redefinition of 'sqlite3WhereTrace'
SQLITE_PRIVATE u32 sqlite3WhereTrace = 0;
                   ^
sqlite3.c:14130:20: note: previous definition is here
SQLITE_PRIVATE u32 sqlite3WhereTrace;
                   ^
sqlite3.c:23315:11: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings]
  { 0, 6, "second", 464269060800.0, 1000.0         },
          ^
sqlite3.c:23316:11: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings]
  { 0, 6, "minute", 7737817680.0,   60000.0        },
          ^
sqlite3.c:23317:11: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings]
  { 0, 4, "hour",   128963628.0,    3600000.0      },
          ^
sqlite3.c:23318:11: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings]
  { 0, 3, "day",    5373485.0,      86400000.0     },
          ^
sqlite3.c:23319:11: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings]
  { 1, 5, "month",  176546.0,       2592000000.0   },
          ^
sqlite3.c:23320:11: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings]
  { 2, 4, "year",   14713.0,        31536000000.0  },
          ^
sqlite3.c:27359:11: error: assigning to 'sqlite3_mutex *' from incompatible type 'void *'
      p = sqlite3MallocZero( sizeof(*p) );
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(omitted, can post full output if helpful)

sqlite3.c:33835:10: note: forward declaration of '_ht'
  struct _ht *pEntry,    /* The entry into which pNew is inserted */
         ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
8 warnings and 20 errors generated.


```