BOOST_NO_CXX11_HDR_CHRONO?
Hi,
When I compile the following program:
#include
On 2020-05-15 16:40, Frédéric via Boost wrote:
Hi,
When I compile the following program: #include
#include <chrono> int main() { return 0; } with a osx cross compiler based on clang 9 on linux,I get the following warnings (full output below): CAUTION: This message was generated due to the define: BOOST_NO_CXX11_HDR_CHRONO [-W#pragma-messages] This is quite strange as the compiler generates the binary which means there was no issue to find <chrono>.
What's wrong then?
That the header exists doesn't mean it's (reasonably) usable. Boost.Config has a test for <chrono>[1]. If it passes, it may be a reason to stop defining BOOST_NO_CXX11_HDR_CHRONO on that compiler. [1]: https://github.com/boostorg/config/blob/develop/test/boost_no_cxx11_hdr_chro...
That the header exists doesn't mean it's (reasonably) usable. Boost.Config has a test for <chrono>[1]. If it passes, it may be a reason to stop defining BOOST_NO_CXX11_HDR_CHRONO on that compiler. [1]: https://github.com/boostorg/config/blob/develop/test/boost_no_cxx11_hdr_chro...
I ran the test and had no issue to compile and run it.
Hello, I'm trying to specify that my library uses C++11 (features) and cannot be compiled or used without. Using `[ requires cxx11_defaulted_functions]` as the project "requirements" does work (lib not build), but e.g. the tests are still build and obviously failing. Putting the above as "usage-requirements" (just like `<link>shared:<define>BOOST_NOWIDE_DYN_LINK=1`) doesn't have any effect. What is the proper way to do this? Thanks, Alex
On 2020-05-15 20:00, Alexander Grund via Boost wrote:
Hello,
I'm trying to specify that my library uses C++11 (features) and cannot be compiled or used without.
Using `[ requires cxx11_defaulted_functions]`
I think, you missed a space before ']'.
as the project "requirements" does work (lib not build), but e.g. the tests are still build and obviously failing.
Putting the above as "usage-requirements" (just like `<link>shared:<define>BOOST_NOWIDE_DYN_LINK=1`) doesn't have any effect.
What is the proper way to do this?
In general, requirements field designates what is required to build your library (or executable). usage-requirements designates requirements imposed on the users of your library (provided that they use Boost.Build). I'm not sure if the requires rule works in usage-requirements though, I've never used it.
Em 15 de mai de 2020, à(s) 19:03, Alexander Grund via Boost
Hello,
I'm trying to specify that my library uses C++11 (features) and cannot be compiled or used without.
Using `[ requires cxx11_defaulted_functions]` as the project "requirements" does work (lib not build), but e.g. the tests are still build and obviously failing.
Not sure if this what you want, but here’s an example of a test suite that skips tests if in pre-C++11: https://github.com/boostorg/poly_collection/blob/develop/test/Jamfile.v2 Joaquín M López Muñoz
Using `[ requires cxx11_defaulted_functions]` as the project "requirements" does work (lib not build), but e.g. the tests are still build and obviously failing.
Not sure if this what you want, but here’s an example of a test suite that skips tests if in pre-C++11:
https://github.com/boostorg/poly_collection/blob/develop/test/Jamfile.v2
Thanks, but I was wondering if I couldn't just depend on the library. I mean with this approach I have to repeat the same conditions in the tests as for the library. But that library isn't even build. So a dependency on the library sounds more reasonable and I thought that something like this must exists already
https://github.com/boostorg/poly_collection/blob/develop/test/Jamfile.v2
As another note on that: I have a test to be run on windows only by using: <build>no <target-os>windows:<build>yes This now also breaks BJam as it sees a <build>no by the C++11 requirements and a <build>yes by the above :( No idea how to solve that.
On 2020-05-16 17:50, Alexander Grund via Boost wrote:
https://github.com/boostorg/poly_collection/blob/develop/test/Jamfile.v2
As another note on that: I have a test to be run on windows only by using: <build>no <target-os>windows:<build>yes
This now also breaks BJam as it sees a <build>no by the C++11 requirements and a <build>yes by the above :( No idea how to solve that.
You could write a local rule that determines when to build the test. You can see an example here: https://github.com/boostorg/filesystem/blob/92522691601533a2afdec9bdecb97674... https://github.com/boostorg/filesystem/blob/92522691601533a2afdec9bdecb97674...
As another note on that: I have a test to be run on windows only by using: <build>no <target-os>windows:<build>yes
This now also breaks BJam as it sees a <build>no by the C++11 requirements and a <build>yes by the above :( No idea how to solve that.
You could write a local rule that determines when to build the test. You can see an example here:
https://github.com/boostorg/filesystem/blob/92522691601533a2afdec9bdecb97674...
https://github.com/boostorg/filesystem/blob/92522691601533a2afdec9bdecb97674...
This will get ugly here. I have 1 test which must only be build on Windows. ALL tests must only be build in C++11. Hence I would need to decorate _every_ test with the C++11 requirement but that 1 test where I need to define a function that checks for the C++11 requirement _and_ if it is on Windows. I guess this could be solved if B2 allows negation. So I can say: `<target-os>not windows:<build>no `. Does this exist?
On 2020-05-18 11:43, Alexander Grund via Boost wrote:
As another note on that: I have a test to be run on windows only by using: <build>no <target-os>windows:<build>yes
This now also breaks BJam as it sees a <build>no by the C++11 requirements and a <build>yes by the above :( No idea how to solve that.
You could write a local rule that determines when to build the test. You can see an example here:
https://github.com/boostorg/filesystem/blob/92522691601533a2afdec9bdecb97674...
https://github.com/boostorg/filesystem/blob/92522691601533a2afdec9bdecb97674...
This will get ugly here. I have 1 test which must only be build on Windows. ALL tests must only be build in C++11.
Hence I would need to decorate _every_ test with the C++11 requirement but that 1 test where I need to define a function that checks for the C++11 requirement _and_ if it is on Windows.
The requirements specified for the project are applied to all targets in the Jamfile. So you can apply the C++11 requirement to the project and the Windows requirement to that one test.
I guess this could be solved if B2 allows negation. So I can say: `<target-os>not windows:<build>no `. Does this exist?
I'm not aware of such; I don't think it is supported other than through the <conditional> rule.
As another note on that: I have a test to be run on windows only by using: <build>no <target-os>windows:<build>yes
This now also breaks BJam as it sees a <build>no by the C++11 requirements and a <build>yes by the above :( No idea how to solve that.
This will get ugly here. I have 1 test which must only be build on Windows. ALL tests must only be build in C++11.
Hence I would need to decorate _every_ test with the C++11 requirement but that 1 test where I need to define a function that checks for the C++11 requirement _and_ if it is on Windows.
The requirements specified for the project are applied to all targets in the Jamfile. So you can apply the C++11 requirement to the project and the Windows requirement to that one test. This is what I'm already doing, see above. The problem is that the project-wide C++11 requirement yields <build>no while the windows requirement yields <build>yes which causes a conflict and a hard error in B2:
https://ci.appveyor.com/project/Flamefire/nowide-fr98b/builds/32945388/job/1... The relevant line is this: https://github.com/boostorg/nowide/blob/755dbe5255211677eebbe0a3795e44b1afb3...
On 2020-05-18 13:16, Alexander Grund via Boost wrote:
As another note on that: I have a test to be run on windows only by using: <build>no <target-os>windows:<build>yes
This now also breaks BJam as it sees a <build>no by the C++11 requirements and a <build>yes by the above :( No idea how to solve that.
This will get ugly here. I have 1 test which must only be build on Windows. ALL tests must only be build in C++11.
Hence I would need to decorate _every_ test with the C++11 requirement but that 1 test where I need to define a function that checks for the C++11 requirement _and_ if it is on Windows.
The requirements specified for the project are applied to all targets in the Jamfile. So you can apply the C++11 requirement to the project and the Windows requirement to that one test. This is what I'm already doing, see above. The problem is that the project-wide C++11 requirement yields <build>no while the windows requirement yields <build>yes which causes a conflict and a hard error in B2:
https://ci.appveyor.com/project/Flamefire/nowide-fr98b/builds/32945388/job/1...
The relevant line is this: https://github.com/boostorg/nowide/blob/755dbe5255211677eebbe0a3795e44b1afb3...
The problem is that you have <build>no and <build>yes at the same time on Windows. The conditional rule I suggested would produce no additional properties on Windows (so that the test builds, provided that it is not disabled by other requirements) and <build>no on other target systems. rule check-windows ( properties * ) { local result ; if ! <target-os>windows in $(properties) { result = <build>no ; } return $(result) ; }
The problem is that you have <build>no and <build>yes at the same time on Windows. The conditional rule I suggested would produce no additional properties on Windows (so that the test builds, provided that it is not disabled by other requirements) and <build>no on other target systems.
rule check-windows ( properties * ) { local result ; if ! <target-os>windows in $(properties) { result = <build>no ; } return $(result) ; }
Got it now, thanks a lot. Working and CI is happy!
On 15/05/2020 14:40, Frédéric via Boost wrote:
Hi,
When I compile the following program: #include
#include <chrono> int main() { return 0; } with a osx cross compiler based on clang 9 on linux,I get the following warnings (full output below): CAUTION: This message was generated due to the define: BOOST_NO_CXX11_HDR_CHRONO [-W#pragma-messages] This is quite strange as the compiler generates the binary which means there was no issue to find <chrono>.
What's wrong then?
No idea. What's the std lib? libc++ ? <chrono> support is enabled for _LIBCPP_VERSION >= 3700 and __cplusplus
= 201103 do those conditions hold?
Best, John.
Kind regards,
F
$ x86_64-apple-darwin13-clang++-libc++ -o boost_math_constants -Wall -Wextra -std=c++14 -m64 -mmacosx-version-min=10.9 -I/softs/osx64-clang-9.0.1/release/boost/include boost_math_constants.cpp In file included from Progs/boost_math_constants.cpp:1: In file included from /softs/osx64-clang-9.0.1/release/boost/include/boost/math/constants/constants.hpp:11: /softs/osx64-clang-9.0.1/release/boost/include/boost/math/tools/cxx03_warn.hpp:99:1: warning: CAUTION: One or more C++11 features were found to be unavailable [-W#pragma-messages] BOOST_PRAGMA_MESSAGE("CAUTION: One or more C++11 features were found to be unavailable") ^ /softs/osx64-clang-9.0.1/release/boost/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE' # define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x))) ^ <scratch space>:307:2: note: expanded from here message("CAUTION: One or more C++11 features were found to be unavailable") ^ In file included from Progs/boost_math_constants.cpp:1: In file included from /softs/osx64-clang-9.0.1/release/boost/include/boost/math/constants/constants.hpp:11: /softs/osx64-clang-9.0.1/release/boost/include/boost/math/tools/cxx03_warn.hpp:100:1: warning: CAUTION: Compiling Boost.Math in pre-C++11 conformance modes is now deprecated and will be removed from March 2021. [-W#pragma-messages] BOOST_PRAGMA_MESSAGE("CAUTION: Compiling Boost.Math in pre-C++11 conformance modes is now deprecated and will be removed from March 2021.") ^ /softs/osx64-clang-9.0.1/release/boost/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE' # define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x))) ^ <scratch space>:310:2: note: expanded from here message("CAUTION: Compiling Boost.Math in pre-C++11 conformance modes is now deprecated and will be removed from March 2021.") ^ In file included from Progs/boost_math_constants.cpp:1: In file included from /softs/osx64-clang-9.0.1/release/boost/include/boost/math/constants/constants.hpp:11: /softs/osx64-clang-9.0.1/release/boost/include/boost/math/tools/cxx03_warn.hpp:101:1: warning: CAUTION: Define BOOST_MATH_DISABLE_DEPRECATED_03_WARNING to suppress this message. [-W#pragma-messages] BOOST_PRAGMA_MESSAGE("CAUTION: Define BOOST_MATH_DISABLE_DEPRECATED_03_WARNING to suppress this message.") ^ /softs/osx64-clang-9.0.1/release/boost/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE' # define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x))) ^ <scratch space>:313:2: note: expanded from here message("CAUTION: Define BOOST_MATH_DISABLE_DEPRECATED_03_WARNING to suppress this message.") ^ In file included from Progs/boost_math_constants.cpp:1: In file included from /softs/osx64-clang-9.0.1/release/boost/include/boost/math/constants/constants.hpp:11: /softs/osx64-clang-9.0.1/release/boost/include/boost/math/tools/cxx03_warn.hpp:102:1: warning: CAUTION: This message was generated due to the define: BOOST_NO_CXX11_HDR_CHRONO [-W#pragma-messages] BOOST_PRAGMA_MESSAGE("CAUTION: This message was generated due to the define: " BOOST_MATH_CXX03_WARN_REASON) ^ /softs/osx64-clang-9.0.1/release/boost/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE' # define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x))) ^ <scratch space>:316:2: note: expanded from here message("CAUTION: This message was generated due to the define: " "BOOST_NO_CXX11_HDR_CHRONO") ^ 4 warnings generated.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
participants (5)
-
Alexander Grund
-
Andrey Semashev
-
Frédéric
-
Joaquín M López Muñoz
-
John Maddock