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

psycopg2: cross compilation fails #164958

Closed
tusj opened this issue Mar 20, 2022 · 2 comments
Closed

psycopg2: cross compilation fails #164958

tusj opened this issue Mar 20, 2022 · 2 comments
Labels
0.kind: bug Something is broken 6.topic: cross-compilation Building packages on a different platform than they will be used on

Comments

@tusj
Copy link

tusj commented Mar 20, 2022

Cross compiling psycopg2 currently fails. Psycopg2 is a postgresql adapter for python, and therefore requires postgresql.

The runtime libraries for postgresql needs to be available for the host platform, and the binary pg_config from postgresql needs to be available for the build platform.
Currently, postgresql is only specified in nativeBuildInputs. That makes the pg_config binary available. However, it also makes the runtime libraries available built for build platform, not host platform. From what I understand, to make the runtime libraries for postgresql available for the target platform, postgresql should be added to buildInputs. However, the linking step fails because it still finds the native / build platform libraries.

I'd like to fix this issue myself, but I need some pointers on the best way to proceed. I can see two ways to fix this:

  1. The runtime libraries for native should not be available to the linker when building for the host platform.
  2. In nativeBuildInputs, specify a postgresql package which does not include the runtime libraries.

Error when building: pkgsCross.armv7l-hf-multiplatform.python39Packages.psycopg2
/nix/store/521z5w03bmrs4d2qxpnbcqk80lvn7p4v-postgresql-13.6-lib/lib/libpq.so: file not recognized: file format not recognized
Examining the file format reveals that it is build for x86-64, the build platform.

@tusj tusj added the 0.kind: bug Something is broken label Mar 20, 2022
@veprbl veprbl added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Mar 20, 2022
@Artturin
Copy link
Member

Looks like the bug caused by #177538 and fixed today in #177888

@Artturin
Copy link
Member

Oops linked the wrong pr

#169475 caused it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: cross-compilation Building packages on a different platform than they will be used on
Projects
None yet
Development

No branches or pull requests

3 participants