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

0.7.3: compile, undefined symbol: sqlite3_unlock_notify #3149

Closed
starsareintherose opened this issue Mar 24, 2024 · 3 comments
Closed

0.7.3: compile, undefined symbol: sqlite3_unlock_notify #3149

starsareintherose opened this issue Mar 24, 2024 · 3 comments
Labels

Comments

@starsareintherose
Copy link

Bug Description

A clear and concise description of what the bug is.

I compile the toeverything/AFFiNE#6280 and face the issue compiling sqlx

Minimal Reproduction

A small code snippet or a link to a Github repo or Gist, with instructions on reproducing the bug.

   Compiling semver v1.0.20
   Compiling regex-syntax v0.8.2
   Compiling sqlx-sqlite v0.7.3
   Compiling regex-automata v0.4.3
   Compiling sqlx-macros-core v0.7.3
   Compiling anyhow v1.0.75
   Compiling regex v1.10.2
   Compiling sqlx-macros v0.7.3
   Compiling convert_case v0.6.0
   Compiling inotify-sys v0.1.5
   Compiling same-file v1.0.6
   Compiling affine_schema v0.0.0 (/build/affine/src/AFFiNE/packages/frontend/native/schema)
   Compiling napi-build v2.1.0
   Compiling dotenv v0.15.0
   Compiling inotify v0.9.6
   Compiling sqlx v0.7.3
error: /build/affine/src/AFFiNE/target/release/deps/libsqlx_macros-82b16273f34f4120.so: undefined symbol: sqlite3_unlock_notify
  --> /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-0.7.3/src/lib.rs:53:1
   |
53 | pub extern crate sqlx_macros;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Compiling walkdir v2.4.0
error[E0432]: unresolved imports `self::encode::Encode`, `self::decode::Decode`, `super::Decode`, `super::Encode`, `super::FromRow`, `super::Type`
   --> /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-0.7.3/src/lib.rs:119:9
    |
119 | pub use self::encode::Encode;
    |         ^^^^^^^^^^^^^^^^^^^^
...
130 | pub use self::decode::Decode;
    |         ^^^^^^^^^^^^^^^^^^^^
...
144 |     pub use super::Decode;
    |             ^^^^^^^^^^^^^
145 |     pub use super::Encode;
    |             ^^^^^^^^^^^^^
146 |     pub use super::Executor;
147 |     pub use super::FromRow;
    |             ^^^^^^^^^^^^^^
...
151 |     pub use super::Type;
    |             ^^^^^^^^^^^

For more information about this error, try `rustc --explain E0432`.
error: could not compile `sqlx` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Internal Error: Build failed with exit code 101
    at ChildProcess.<anonymous> (file:///build/affine/src/AFFiNE/node_modules/@napi-rs/cli/dist/api/build.js:184:28)
    at Object.onceWrapper (node:events:633:26)
    at ChildProcess.emit (node:events:530:35)
    at ChildProcess._handle.onexit (node:internal/child_process:294:12)

Info

extra/rust 1:1.76.0-1
    usr/bin/rustc
extra/rustup 1.26.0-5
    usr/bin/rustc
@abonander
Copy link
Collaborator

This cannot be a SQLx bug. The errors indicate something went wrong with the build process itself. The linked issue should not have been closed.

@JunioCalu
Copy link

JunioCalu commented Apr 7, 2024

I also encountered a similar problem. I just found out that sqlx does not support the build flag "-flto=auto" (Link Time Optimization, LTO) which is enabled by default by the Arch Linux package build system (makepkg tool). It's necessary to disable this compile flag during the build of sqlx by adding the build configuration "options=('!lto')" to the PKGBUILD script for the package. Once this is done, the package builds normally, without errors. This was noticed by an Arch Linux developer who used the same option to disable "LTO" in the PKGBUILD for sqlx-cli linked from the Arch Linux GitLab, in the description of the problem mentioned above.

The discussion about the mentioned issue can be viewed at: ffplayout/ffplayout#580

@yochananmarqos
Copy link

One can add CFLAGS+=" -ffat-lto-objects" to the build() function to resolve the issue without completely disabling LTO.

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

No branches or pull requests

4 participants