[CXX-865] Could not build with clang 3.8 Created: 14/Mar/16  Updated: 30/Mar/16  Resolved: 22/Mar/16

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

Type: Bug Priority: Major - P3
Reporter: Pavel Odintsov Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Hello, folks!

I'm trying to build C++ 11 mongo client library but could not do it:
mongocxx/test/pool.cpp:146:5: error: no type named 'max_align_t' in namespace 'std'; did you mean simply 'max_align_t'?
std::max_align_t dummy_address;
^~~~~~~~~~~~~~~~
max_align_t
/opt/dps/libraries/clang_3_8_0/bin/../lib/clang/3.8.0/include/__stddef_max_align_t.h:40:3: note: 'max_align_t' declared here
} max_align_t;
^
1 error generated.

Could you fix it?



 Comments   
Comment by Githook User [ 22/Mar/16 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: CXX-865 Enable building with clang with libstdc++ from GCC 4.8
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/105e83ea7d91003b7fa815df9a75c3f4c96e2e27

Comment by Andrew Morrow (Inactive) [ 22/Mar/16 ]

pavel.odintsov - Could you try out the PR in https://github.com/mongodb/mongo-cxx-driver/pull/468 and see if allows you to build with clang against your GCC 4.8 libstdc++? That is not a configuration that I have handy to test.

Comment by Andrew Morrow (Inactive) [ 21/Mar/16 ]

https://github.com/mongodb/mongo-cxx-driver/pull/468

Comment by Andrew Morrow (Inactive) [ 16/Mar/16 ]

pavel.odintsov - Were you able to get the driver building with clang and libc++?

Comment by Andrew Morrow (Inactive) [ 14/Mar/16 ]

You would need to do something with CMAKE_CXX_FLAGS. Maybe:

cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=-stdlib=libc++ ...

I'd start with that, or something close to it. Basically, you need to use the CMake mechanisms for passing compiler flags through.

Comment by Pavel Odintsov [ 14/Mar/16 ]

libc++ is works for me How I could build Mongo C++ 1 1driver with clang and libc++?

Comment by Andrew Morrow (Inactive) [ 14/Mar/16 ]

pavel.odintsov - As a potential workaround, I think you could either try libstdc++ 4.9 or newer, or try libc++.

Comment by Andrew Morrow (Inactive) [ 14/Mar/16 ]

I think the logic in pool.cpp to decide whether max_align_t is in the std:: or global namespace isn't quite right. It won't work, for instance, when using clang to build against a pre GCC-4.9 libstdc++. I think we need to do this as a configure check.

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