Open conniemzhang opened 2 years ago
This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_foreign_cc!
could you add info how did you solve this issue? building libpqxx via bazel. Thank you!
Hello, I am trying to use libpqxx by using cmake to build a static library using Bazel but I am stuck. I am using rules_foreign_cc cmake() which builds a library named pqxx and links a static library libpqxx-7.7.a. When I try to add this as a dependency to a cc_binary, it is able to see all the headers, but is not able to run the program.
When installed locally, gcc requires the libraries -lpqxx -lpq (the C++ and C bindings). When install it locally, all the commands work fine: For example:
g++ -L/usr/local/lib -lpqxx -lpq foo.cpp
where /usr/local/lib is where the library was installed. I cannot duplicate this behavior in Bazel.No matter what, I always get the error:
ld: library not found for -lpqxx
I can see that there is a libpqxx-7.7.a file in bazel-bin, but adding the path from "$(bazel info bazel-bin)/workspace/libpqxx-7.7.a" throws the same "library not found" error. Leaving the link options out produces
which I believe is a linking error. Am I building my cmake wrong? I am new to C++, am I missing important debugging steps?
WORKSPACE
BUILD