[CXX-1097] Compiling driver on rhel 7 with Oracle Solaris studio 12.5 Created: 20/Oct/16  Updated: 11/Sep/19  Resolved: 20/Oct/16

Status: Closed
Project: C++ Driver
Component/s: Build
Affects Version/s: 3.0.2
Fix Version/s: None

Type: Task Priority: Trivial - P5
Reporter: Alex Vilensky Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux Redhat 7



 Description   

I was wondering if you ever attempted to compile your C+11 driver with Oracle Solaris studio v12.5 on RedHat 7. I had no problems building libbson and the C driver, but for some reason the compiler choked on the C+ driver.



 Comments   
Comment by Andrew Morrow (Inactive) [ 20/Oct/16 ]

nistar - OK, I'm going to close this issue. Hopefully Oracle will bring their toolchain up to spec!

Comment by Alex Vilensky [ 20/Oct/16 ]

Just opened a ticket with Oracle. Thank you for your help.

Comment by Andrew Morrow (Inactive) [ 20/Oct/16 ]

I'd report it to your vendor then. Since we don't have access to this compiler it is unlikely that we will be able to help find a workaround.

Comment by Alex Vilensky [ 20/Oct/16 ]

CC -std=c++11 -g -o static_assert static_assert.cpp
"static_assert.cpp", line 9: Error: Static assertion failed: YYY.
1 Error(s) detected.

It seems to me the compiler is not standards compliant.

Comment by Andrew Morrow (Inactive) [ 20/Oct/16 ]

Tracing this through, it appears that the static assertion on line 38 of value.cpp is firing for the b_double type:

        static_assert(std::is_nothrow_destructible<b_##name>::value, "Destruction may throw"); \

This is pretty strange, as b_double::value is a typedef for double.

What happens if you compile the following program with your compiler:

#include <type_traits>
static_assert(std::is_nothrow_destructible<double>::value, "XXX");
 
struct struct_with_double {
    double x;
};
 
static_assert(std::is_nothrow_destructible<struct_with_double>::value, "YYY");

Does that compile for you?

Comment by Alex Vilensky [ 20/Oct/16 ]

[ 3%] Building CXX object src/bsoncxx/CMakeFiles/bsoncxx.dir/types/value.cpp.o
cd /home/alex.vilensky/tools/mongo-cxx-driver/build/src/bsoncxx && /home/alex.vilensky/tools/OracleDeveloperStudio12.5-linux-x86-bin/developerstudio12.5/bin/CC -DBSONCXX_EXPORT -DMONGO_CXX_DRIVER_COMPILING -I/home/alex.vilensky/tools/libmongoc/include/libbson-1.0 -I/home/alex.vilensky/tools/mongo-cxx-driver/src -I/home/alex.vilensky/tools/mongo-cxx-driver/build/src -I/home/alex.vilensky/tools/mongo-cxx-driver/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core/include -xO3 -DNDEBUG -KPIC -std=c++11 -o CMakeFiles/bsoncxx.dir/types/value.cpp.o -c /home/alex.vilensky/tools/mongo-cxx-driver/src/bsoncxx/types/value.cpp
"/home/alex.vilensky/tools/mongo-cxx-driver/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core/include/core/optional.hpp", line 632: Warning: attribute gnu::deprecated is unsupported and will be skipped.
"/home/alex.vilensky/tools/mongo-cxx-driver/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core/include/core/optional.hpp", line 997: Warning: attribute gnu::deprecated is unsupported and will be skipped.
"/home/alex.vilensky/tools/mongo-cxx-driver/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core/include/core/optional.hpp", line 963: Warning: ptr hides core::v1::expected<void>::ptr.
"/home/alex.vilensky/tools/mongo-cxx-driver/src/bsoncxx/enums/type.hpp", line 19: Error: Static assertion failed: Destruction may throw.

Comment by Andrew Morrow (Inactive) [ 20/Oct/16 ]

Those first issues are with libbson, so I recommend that you open a ticket in the CDRIVER project.

For the second issue, I'll need more. Does it give you an include stack or some other context? We need to know which expansion of the BSONCXX_ENUM is causing this (it is an X macros style mechanism). What .cpp file was being compiled?

Comment by Alex Vilensky [ 20/Oct/16 ]

Hi Andrew, the first error I got was caused by a missing #define in bson-atomic.h on line 97. I had to change
#elif defined(__SUNPRO_C)

  1. include <mbarrier.h>
  2. define bson_memory_barrier() __machine_rw_barrier()
    to
    #elif defined(_SUNPRO_C) || defined(_SUNPRO_CC)
  3. include <mbarrier.h>
  4. define bson_memory_barrier() __machine_rw_barrier()
    to make sure the code gets picked up by the C++ compiler.
    Now i'm getting the following error:
    "/home/alex.vilensky/tools/mongo-cxx-driver/src/bsoncxx/enums/type.hpp", line 19: Error: Static assertion failed: Destruction may throw.
Comment by Andrew Morrow (Inactive) [ 20/Oct/16 ]

Can you provide the error it emitted? As far as I know, we have never tried to use that compiler.

Generated at Wed Feb 07 22:01:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.