Comments (10)
This is the expected behaviour. The configure script used to try and select a C++ version, but it was an ugly can of worms. So I made it the caller's choice.
So, if your compiler compiles an older version of C++ by default, you'll need to pass an option to select a version.
For example: ./configure CXXFLAGS=-"std=c++17"
from libpqxx.
Ah: I thought that as you want c++17, you would set that standard via compiler flags, but now I see that you really want >= 17, so don't want to be limited to c++17 if the compiler can do c++20 or more... so notabug
from libpqxx.
Exactly! Plus, other compilers may have different flags... Like I said, ugly can of worms. :-)
from libpqxx.
I think this is still buggy. The basic issue is that various compilers have various defaults for std. It would be reasonable to default to adding --std=c++17, and to have an --enable-c++20 that instead sets --std=c++20, and add --enable-foo as needed and tested in the future. Right now, someone with a compiler that supports c++17 but defaults to c++14 will likely get mysterious errors, and this decision pushes surprising work onto everyone that builds this.
from libpqxx.
I wonder if it wouldn't be better to detect the availability during the configure step and drop a HAVE_xx
macro in the header file -- then there won't be an ODR violation because the capabilities will be fixed.
from libpqxx.
My impression is that standard practice is to test if the compiler accepts the --std flag you want, and to fail otherwise. Testing for an acceptable std flag and HAVE
is certainly a reasonable expansion of that.
from libpqxx.
compiler accepts the --std flag you want
This gets messy very quickly across all of the compilers libpqxx supports, which is why it's left to the user to decide what they want
from libpqxx.
Mixing binaries compiled by different compilers is a bad idea in C++ -unlike with C there is no guarantee that they will be compatible. Yes a few compilers are ABI-compatible with gcc, but even that is thin ice. Different versions of the same compiler aren't necessarily ABI-compatible. The same C++ version on the same version of the same compiler isn't necessarily ABI-compatible depending on compiler options.
So the answer IMO is not "make it easier to do something dangerous," but "if you know what you're doing you're free to do it, but you'll have to know what you're doing." Even if what you want is quite simple, it has to be a decision that you make in your build environment - because there are no standards to protect you from the agony of choice.
As a point of comparison, even autoconf-archive didn't have even a halfway decent solution to this. CMake basically addresses it by dictating versions and options and assuming it knows all compilers intimately. That just doesn't scale - libpqxx has to work on platforms I haven't even heard of.
from libpqxx.
Perhaps you're right @KayEss that I should go back to doing all the compiler/libpq feature checks at configure time... but it's a royal pain and I was fervently hoping to phase most of them out in favour of simple compile-time checks.
Then again... given that mixing object files built for different C++ versions breaks ABI compatibility, and worse, debug options can break runtime compatibility of memory layouts anyway... perhaps it's just not worth trying to solve this. Perhaps it would be more helpful to try and detect incompatible combinations.
from libpqxx.
in favour of simple compile-time checks
I totally get that. It's what I'm doing in my projects and it is nice. But it seems there are also hidden dangers.
You have it harder if you mean to support both cmake and autoconf though -- it means doing these checks twice. You also have to consider what happens when libpqxx is packaged -- it seems right now that's quite likely to break because people using the packaged version have no control over how it was compiled.
from libpqxx.
Related Issues (20)
- More Documentation for INSERT HOT 5
- [Build failure] undefined reference to `pqxx::argument_error::argument_error` HOT 7
- have libpqxx subscribe to a channel HOT 4
- subscribing to two trigger channels HOT 4
- Receiving false positive signals through conn.await_notification() HOT 2
- Converting TIMESTAMP datatypes into a std::chrono::time_point HOT 8
- Docs gone since 7.9 HOT 19
- Error building a project with the library HOT 8
- Building with bazel error: "ar: libdeps specified more than once" or "undefined reference to PQ" HOT 7
- Make of libpqxx on Red Hat Enterprise Linux 8.8 fails HOT 6
- PQXX_DECLARE_ENUM_CONVERSION issues HOT 15
- G++ Vcpkg Debian Docker image linker errors HOT 18
- Query streaming doesn't compile anymore HOT 3
- Can't initialize zview from string_view HOT 2
- Missing cast opportunity HOT 17
- cmake will take the given lib name and it changes to "-l{libname}" and linker will search using "-l{libname}" HOT 7
- `RETURNING` from a `stream_to` HOT 3
- Failure on streaming a list of empty strings HOT 6
- 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
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.