Comments (9)
This looks likely to be caused by your build options. Where are you getting the cmake configuration from?
from libpqxx.
(Inserted some backticks into your text to stop Github from interpreting bits of the error message as Wiki markup...)
from libpqxx.
AFAICS the function in question is clear_result
. But that's not a weak symbol — it's declared in result.hxx and defined in result.cxx. There could be a bug in the CMake setup, but perhaps also the pg_result
declaration needs to be explicitly exported.
As an experiment, in include/pqxx/forward.hxx, could you replace the struct pg_result;
with struct PQXX_LIBEXPORT pg_result;
and see if that fixes the warning?
from libpqxx.
I have created a test program that reproduce a linker warning on mac:
$ cat mytest/pqxx_test.cpp
#include <pqxx/pqxx>
int main() {
pqxx::result r;
}
I cloned the lipqxx repo and built it:
./configure --prefix=$PWD/dist && make && make install
Then I compiled my test program:
$ clang++ --std=c++11 -I $PWD/dist/include -L $PWD/dist/lib mytest/pqxx_test.cpp -lpqxx -lpq
ld: warning: direct access in function 'std::__1::__shared_ptr_pointer<pg_result const*, void ()(pg_result const), std::__1::allocator<pg_result const> >::__get_deleter(std::type_info const&) const' from file '/Users/sergey.kurenkov/src/test_libpqxx/dist/lib/libpqxx.a(result.o)' to global weak symbol 'typeinfo name for void ()(pg_result const)' from file '/var/folders/8k/wmd646w54nb94_rfs6l1rn312bkjmr/T/pqxx_test-a62599.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
In my opinion the warning is caused by using in result.hxx shared_ptr:
using data_pointer = std::shared_ptr<const internal::pq::PGresult>;
from libpqxx.
You should use the same compile configuration for the configure script as you do for your build (although I believe Jeroen defaults to c++11, it'd still be important if you wanted 14 or even 17).
./configure CXXFLAGS=-std=c++11 --prefix=$PWD/dist
I have often noticed that older versions of clang have some bugs with regard to shared_ptr
code generation, but this error doesn't look like one of them.
I've just switched my projects to the latest pqxx and need to fix up some headers, but I'll report back on whether or not I see any warnings when I get a working build again.
from libpqxx.
I've done some builds (C++14) with the latest code for libpqxx and don't get any warnings on the Mac. However, when I do what you've done I do get the warning.
I'm not using the supplied make files though. I build the libpqxx sources using the same build that I then build the application with, and this ensures that the compile options are exactly alike. Can you try to include the libpqxx sources into your build rather than using make separately?
from libpqxx.
Can you try to include the libpqxx sources into your build rather than using make separately?
Look if I add -fvisibility=hidden -fvisibility-inlines-hidden
to clang I get no warning:
$ clang++ -fvisibility=hidden -fvisibility-inlines-hidden -g --std=c++11 -I $PWD/dist/include -L $PWD/dist/lib mytest/pqxx_test.cpp -o mytest/pqxx_test -lpqxx -lpq
➜ 18-02-26 15:07:10 /Users/sergey.kurenkov/src/test_libpqxx git:(master) ✗
-fvisibility=hidden -fvisibility-inlines-hidden
are options from libpqxx's Makefile.
from libpqxx.
It doesn't help that I can't reproduce this on an Ubuntu system. :( @skwllsp, have you tried adding PQXX_LIBEXPORT
to that using
declaration, to see whether that would convince the compiler to keep the type completely visible for linking?
from libpqxx.
Annoying situation: we can't reproduce it, and a warning isn't quite serious enough to warrant a lot of effort. I don't think we're going to get around to it, so I'll just close the issue.
If it comes up again, we can take that as a sign that it deserves more attention.
from libpqxx.
Related Issues (20)
- Conversion of TEXT[] to std::vector<std::string>. HOT 5
- error C2039: 'converts_from_string': is not a member of 'pqxx::string_traits<pgvector::Vector>' HOT 8
- Undefined references while compiling project HOT 17
- Static linking is not working, C++20, libpq REL_16_2, HOT 11
- Can I use stream_to to insert multiple records while one field is Postgis Geometry type? HOT 5
- std::optional<std::chrono::year_month_day> to DATE error if optional is empty HOT 4
- Encoding problems with bytea HOT 19
- Undefined refences when compiling example from the documentation HOT 10
- After compilation, there are only pqxx files but no pqxx.hxx files. Is this normal? HOT 31
- Rtti usage on demand HOT 6
- linking issue when using torch+pqxx in cmake. HOT 11
- Can't use libpqxx 7.9.0 from vcpkg in a Visual Studio 2022 C++ 17 project HOT 6
- Allow parsing arrays without connection HOT 20
- Any example to deal with time or date? HOT 2
- ERROR: Unsupported server version; 9.0 is the minimum. HOT 4
- Readthedocs /stable documentation page is empty. HOT 7
- Make pqxx iterators model the right iterator category HOT 9
- CMakeDetermineCompileFeatures throwing errors HOT 23
- `stream_to` uses `quote_name` as 2 argument function HOT 6
- std::ranges undefined? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libpqxx.