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

Windows: note: ld: cannot find -lpq #135

Closed
Ciantic opened this Issue Jan 24, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@Ciantic

Ciantic commented Jan 24, 2016

I tried with this:

#[macro_use]
extern crate diesel;
fn main() {
    println!("Hello world!");
}

The compilation fails with note: ld: cannot find -lpq

I downloaded PostgreSQL (portable) and set LD_LIBRARY_PATH environment variable, but it didn't help. I wonder should I set the library path some other way?

edit Also pg_config is in the PATH and it prints out the right directory.

@mcasper

This comment has been minimized.

Collaborator

mcasper commented Jan 24, 2016

Have you tried running cargo clean && cargo build? A lot of the time cargo just needs to rebuild the package from scratch in order to pick up new link paths

@Ciantic

This comment has been minimized.

Ciantic commented Jan 24, 2016

Hmm, now it gives a longer error:

note: ld: skipping incompatible C:/Copies/.../PgSQL/lib/libpq.dll when searching for -lpq
ld: skipping incompatible C:/Copies/.../PgSQL/lib/libpq.dll when searching for -lpq
ld: cannot find -lpq

@mcasper

This comment has been minimized.

Collaborator

mcasper commented Jan 24, 2016

That usually means that you've installed an incompatible version of the library (32bit vs 64bit, or for the wrong platform).

Can you confirm that you have the correct bit version installed?

@Ciantic

This comment has been minimized.

Ciantic commented Jan 24, 2016

Yes I also suspected this from the error message. It seems to be incorrect version (32 bit), if I could only find portable 64bit version to try...

But I think the cargo clean && cargo build solved the first issue so perhaps you can close this.

@Ciantic

This comment has been minimized.

Ciantic commented Jan 24, 2016

Note for future reference:

I found the 64 bit binary zip, which is portable already: http://www.postgresql.org/download/windows/ (note the small zip archive link at the end)

@Ciantic Ciantic closed this Jan 24, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment