Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build in Apple Silicon #5002

Open
walexaindre opened this issue Jun 19, 2024 · 2 comments
Open

How to build in Apple Silicon #5002

walexaindre opened this issue Jun 19, 2024 · 2 comments

Comments

@walexaindre
Copy link
Contributor

walexaindre commented Jun 19, 2024

Details

Hello, this project is interesting to me and I was using it on windows. Now I have a Mac with an M1 and I wasn't able to compile it from source.

The provided binaries are for intel based Macs and they require some form of rosetta to be interpreted and used. I don't want to use non native binaries if it's possible.

The error generated is from something missing with sqlite extensions:

ld: warning: -single_module is obsolete ld: warning: search path '/Users/walexaindre/sqlitestudio/SQLiteStudio3/../../lib' not found Undefined symbols for architecture arm64: "_sqlite3_enable_load_extension", referenced from: AbstractDb3<Sqlite3>::openInternal() in dbsqlite3.o "_sqlite3_load_extension", referenced from: AbstractDb3<Sqlite3>::loadExtension(QString const&, QString const&) in dbsqlite3.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [../../SQLiteStudio/libcoreSQLiteStudio.1.0.0.dylib] Error 1 make: *** [sub-coreSQLiteStudio-make_first] Error 2

I'm trying to link against home brew sqlite or against compiled sqlite with the recipe from the GitHub Actions. However I don't know how to override sqlite default path or if that is the problem really (After a long reading on other issues and web pages the conclusion was that native Mac OS sqlite is trimmed in functionalities and don't work correctly with this project.)

My problem is that I don't know how to edit the .pro files correctly or how to start to debug this issue.

Initially I was thinking that editing the file coreSQLiteStudio.pro at the line LIBS += -lsqlite3 to LIBS += -L/path/... was sufficient but maybe something is missing. When I edit that line the result is worse and anything from sqlite is non recognized.

ld: warning: search path '/Users/walexaindre/sqlitestudio/SQLiteStudio3/../../lib' not found Undefined symbols for architecture arm64: "_sqlite3_aggregate_context", referenced from: AbstractDb3<Sqlite3>::evaluateAggregateStep(sqlite3_context*, int, sqlite3_value**) in dbsqlite3.o AbstractDb3<Sqlite3>::evaluateAggregateStep(sqlite3_context*, int, sqlite3_value**) in dbsqlite3.o AbstractDb3<Sqlite3>::evaluateAggregateFinal(sqlite3_context*) in dbsqlite3.o AbstractDb3<Sqlite3>::evaluateAggregateFinal(sqlite3_context*) in dbsqlite3.o "_sqlite3_bind_blob", referenced from: AbstractDb3<Sqlite3>::Query::bindParam(int, QVariant const&) in dbsqlite3.o "_sqlite3_bind_double", referenced from: AbstractDb3<Sqlite3>::Query::bindParam(int, QVariant const&) in dbsqlite3.o "_sqlite3_bind_int", referenced from: AbstractDb3<Sqlite3>::Query::bindParam(int, QVariant const&) in dbsqlite3.o "_sqlite3_bind_int64", referenced from: AbstractDb3<Sqlite3>::Query::bindParam(int, QVariant const&) in dbsqlite3.o "_sqlite3_bind_null", referenced from: AbstractDb3<Sqlite3>::Query::bindParam(int, QVariant const&) in dbsqlite3.o "_sqlite3_bind_parameter_index", referenced from: AbstractDb3<Sqlite3>::Query::execInternal(QHash<QString, QVariant> const&) in dbsqlite3.o "_sqlite3_bind_text16", referenced from: AbstractDb3<Sqlite3>::Query::bindParam(int, QVariant const&) in dbsqlite3.o "_sqlite3_close", referenced from: AbstractDb3<Sqlite3>::openInternal() in dbsqlite3.o AbstractDb3<Sqlite3>::closeInternal() in dbsqlite3.o "_sqlite3_collation_needed", referenced from: AbstractDb3<Sqlite3>::registerDefaultCollationRequestHandler() in dbsqlite3.o "_sqlite3_column_blob", referenced from: AbstractDb3<Sqlite3>::Query::Row::getValue(sqlite3_stmt*, int, QVariant&, QFlags<Db::Flag>) in dbsqlite3.o "_sqlite3_column_bytes", referenced from: AbstractDb3<Sqlite3>::Query::Row::getValue(sqlite3_stmt*, int, QVariant&, QFlags<Db::Flag>) in dbsqlite3.o "_sqlite3_column_bytes16", referenced from: AbstractDb3<Sqlite3>::Query::Row::getValue(sqlite3_stmt*, int, QVariant&, QFlags<Db::Flag>) in dbsqlite3.o "_sqlite3_column_count", referenced from: AbstractDb3<Sqlite3>::columnsForQuery(QString const&) in dbsqlite3.o AbstractDb3<Sqlite3>::Query::fetchFirst() in dbsqlite3.o "_sqlite3_column_database_name", referenced from: AbstractDb3<Sqlite3>::columnsForQuery(QString const&) in dbsqlite3.o "_sqlite3_column_double", referenced from: AbstractDb3<Sqlite3>::Query::Row::getValue(sqlite3_stmt*, int, QVariant&, QFlags<Db::Flag>) in dbsqlite3.o "_sqlite3_column_int64", referenced from: AbstractDb3<Sqlite3>::Query::Row::getValue(sqlite3_stmt*, int, QVariant&, QFlags<Db::Flag>) in dbsqlite3.o "_sqlite3_column_name", referenced from: AbstractDb3<Sqlite3>::columnsForQuery(QString const&) in dbsqlite3.o AbstractDb3<Sqlite3>::Query::fetchFirst() in dbsqlite3.o "_sqlite3_column_origin_name", referenced from: AbstractDb3<Sqlite3>::columnsForQuery(QString const&) in dbsqlite3.o "_sqlite3_column_table_name", referenced from: AbstractDb3<Sqlite3>::columnsForQuery(QString const&) in dbsqlite3.o "_sqlite3_column_text16", referenced from: AbstractDb3<Sqlite3>::Query::Row::getValue(sqlite3_stmt*, int, QVariant&, QFlags<Db::Flag>) in dbsqlite3.o "_sqlite3_column_type", referenced from: AbstractDb3<Sqlite3>::Query::Row::getValue(sqlite3_stmt*, int, QVariant&, QFlags<Db::Flag>) in dbsqlite3.o "_sqlite3_complete", referenced from: DbSqlite3::complete(QString const&) in dbsqlite3.o AbstractDb3<Sqlite3>::isComplete(QString const&) const in dbsqlite3.o "_sqlite3_create_collation_v2", referenced from: AbstractDb3<Sqlite3>::registerCollationInternal(QString const&) in dbsqlite3.o AbstractDb3<Sqlite3>::deregisterCollationInternal(QString const&) in dbsqlite3.o AbstractDb3<Sqlite3>::registerDefaultCollation(void*, sqlite3*, int, char const*) in dbsqlite3.o "_sqlite3_create_function", referenced from: AbstractDb3<Sqlite3>::deregisterFunction(QString const&, int) in dbsqlite3.o "_sqlite3_create_function_v2", referenced from: AbstractDb3<Sqlite3>::registerScalarFunction(QString const&, int, bool) in dbsqlite3.o AbstractDb3<Sqlite3>::registerAggregateFunction(QString const&, int, bool) in dbsqlite3.o "_sqlite3_enable_load_extension", referenced from: AbstractDb3<Sqlite3>::openInternal() in dbsqlite3.o "_sqlite3_errmsg", referenced from: AbstractDb3<Sqlite3>::extractLastError(sqlite3*) in dbsqlite3.o AbstractDb3<Sqlite3>::Query::nextInternal() in dbsqlite3.o AbstractDb3<Sqlite3>::Query::fetchNext() in dbsqlite3.o AbstractDb3<Sqlite3>::Query::resetStmt() in dbsqlite3.o "_sqlite3_extended_errcode", referenced from: AbstractDb3<Sqlite3>::extractLastError(sqlite3*) in dbsqlite3.o "_sqlite3_finalize", referenced from: AbstractDb3<Sqlite3>::columnsForQuery(QString const&) in dbsqlite3.o AbstractDb3<Sqlite3>::columnsForQuery(QString const&) in dbsqlite3.o AbstractDb3<Sqlite3>::Query::~Query() in dbsqlite3.o AbstractDb3<Sqlite3>::cleanUp() in dbsqlite3.o "_sqlite3_free", referenced from: AbstractDb3<Sqlite3>::loadExtension(QString const&, QString const&) in dbsqlite3.o "_sqlite3_interrupt", referenced from: AbstractDb3<Sqlite3>::interruptExecution() in dbsqlite3.o "_sqlite3_last_insert_rowid", referenced from: AbstractDb3<Sqlite3>::Query::fetchFirst() in dbsqlite3.o "_sqlite3_load_extension", referenced from: AbstractDb3<Sqlite3>::loadExtension(QString const&, QString const&) in dbsqlite3.o "_sqlite3_open_v2", referenced from: AbstractDb3<Sqlite3>::openInternal() in dbsqlite3.o "_sqlite3_prepare_v2", referenced from: AbstractDb3<Sqlite3>::columnsForQuery(QString const&) in dbsqlite3.o AbstractDb3<Sqlite3>::Query::prepareStmt() in dbsqlite3.o "_sqlite3_reset", referenced from: AbstractDb3<Sqlite3>::Query::resetStmt() in dbsqlite3.o "_sqlite3_result_blob", referenced from: AbstractDb3<Sqlite3>::storeResult(sqlite3_context*, QVariant const&, bool) in dbsqlite3.o "_sqlite3_result_double", referenced from: AbstractDb3<Sqlite3>::storeResult(sqlite3_context*, QVariant const&, bool) in dbsqlite3.o "_sqlite3_result_error16", referenced from: AbstractDb3<Sqlite3>::storeResult(sqlite3_context*, QVariant const&, bool) in dbsqlite3.o "_sqlite3_result_int", referenced from: AbstractDb3<Sqlite3>::storeResult(sqlite3_context*, QVariant const&, bool) in dbsqlite3.o "_sqlite3_result_int64", referenced from: AbstractDb3<Sqlite3>::storeResult(sqlite3_context*, QVariant const&, bool) in dbsqlite3.o "_sqlite3_result_null", referenced from: AbstractDb3<Sqlite3>::storeResult(sqlite3_context*, QVariant const&, bool) in dbsqlite3.o "_sqlite3_result_text16", referenced from: AbstractDb3<Sqlite3>::storeResult(sqlite3_context*, QVariant const&, bool) in dbsqlite3.o AbstractDb3<Sqlite3>::storeResult(sqlite3_context*, QVariant const&, bool) in dbsqlite3.o AbstractDb3<Sqlite3>::storeResult(sqlite3_context*, QVariant const&, bool) in dbsqlite3.o "_sqlite3_step", referenced from: AbstractDb3<Sqlite3>::Query::fetchNext() in dbsqlite3.o "_sqlite3_total_changes", referenced from: AbstractDb3<Sqlite3>::Query::fetchFirst() in dbsqlite3.o AbstractDb3<Sqlite3>::Query::fetchFirst() in dbsqlite3.o "_sqlite3_user_data", referenced from: AbstractDb3<Sqlite3>::evaluateScalar(sqlite3_context*, int, sqlite3_value**) in dbsqlite3.o AbstractDb3<Sqlite3>::evaluateAggregateStep(sqlite3_context*, int, sqlite3_value**) in dbsqlite3.o AbstractDb3<Sqlite3>::evaluateAggregateFinal(sqlite3_context*) in dbsqlite3.o "_sqlite3_value_blob", referenced from: AbstractDb3<Sqlite3>::getArgs(int, sqlite3_value**) in dbsqlite3.o "_sqlite3_value_bytes", referenced from: AbstractDb3<Sqlite3>::getArgs(int, sqlite3_value**) in dbsqlite3.o "_sqlite3_value_bytes16", referenced from: AbstractDb3<Sqlite3>::getArgs(int, sqlite3_value**) in dbsqlite3.o "_sqlite3_value_double", referenced from: AbstractDb3<Sqlite3>::getArgs(int, sqlite3_value**) in dbsqlite3.o "_sqlite3_value_int64", referenced from: AbstractDb3<Sqlite3>::getArgs(int, sqlite3_value**) in dbsqlite3.o "_sqlite3_value_text16", referenced from: AbstractDb3<Sqlite3>::getArgs(int, sqlite3_value**) in dbsqlite3.o "_sqlite3_value_type", referenced from: AbstractDb3<Sqlite3>::getArgs(int, sqlite3_value**) in dbsqlite3.o "_sqlite3_wal_checkpoint_v2", referenced from: AbstractDb3<Sqlite3>::flushWalInternal() in dbsqlite3.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [../../SQLiteStudio/libcoreSQLiteStudio.1.0.0.dylib] Error 1 make: *** [sub-coreSQLiteStudio-make_first] Error 2

If someone have suggestions or a workaround please let me know.

@dkwolfe4
Copy link

if you search for 'silicon' in the closed issues you'll find that issues 4899 and 4900 claim that Apple Silicon binaries are available from the following URL: https://github.com/pawelsalawa/sqlitestudio/actions/runs/6845148624

There seems to be a disconnect as the universal binary [build (darwin_20.arm64-x86_64) appears to have successfully built, but the resulting DMG is not placed in the release folder.

My Github Feng Shui is lacking as I can't find the output of the build and haven't figured out how to kick off the build such that I can access the resulting binary.....

@tuffnatty
Copy link
Collaborator

@walexaindre Regarding your build log: ld: warning: search path '/Users/walexaindre/sqlitestudio/SQLiteStudio3/../../lib' not found. If you don't want to build with the system SQLite (as is the case on MacOS) you should put your copy of the library at that path.
Regarding GitHub Actions builds: the build artifacts are cleaned up after some time, and the link was old. You can always find the recent artifacts on a recent successful (and sometimes unsuccessful) workflow run summary page, which you can find here: https://github.com/pawelsalawa/sqlitestudio/actions/workflows/mac_release.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants