cctbx_project icon indicating copy to clipboard operation
cctbx_project copied to clipboard

Problems compiling cma_es with C++11

Open whart222 opened this issue 2 years ago • 5 comments

I've had problems building cctbx with the cma_es package. I'm using an intel compiler, and I am seeing warnings that indicate that this code is not C++11 compliant. I think I may be hitting a bug in the compiler, but the issue with C++11 compliance is something that the CCTBX team could resolve.

whart222 avatar Dec 15 '21 21:12 whart222

What is the error from the Intel compiler?

The xfel and dials builders enable C++11 by default so the cma_es module does compile using C++11 on other compilers.

bkpoon avatar Dec 15 '21 21:12 bkpoon

I get a lot of warnings like the following:

cmaes.cpp:233:16: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings] t->version = "3.11.00.beta";

I don't get any errors ... but then the build hangs someplace.

whart222 avatar Dec 15 '21 21:12 whart222

I don't remember why I did this, but cmaes.cpp is just cmaes.c with some minor changes. Maybe a better approach would be to just compile cmaes.c as C.

bkpoon avatar Dec 15 '21 22:12 bkpoon

That's definitely worth exploring. Alternatively, you can use 'extern "C"' blocks to treat code as C.

whart222 avatar Dec 15 '21 22:12 whart222

Alternatively, this change would remove the warning:

t->version = (char )"3.11.00.beta"; This would cast the text to char rather than const char*.

Nick

On Wed, Dec 15, 2021 at 2:11 PM William Hart @.***> wrote:

That's definitely worth exploring. Alternatively, you can use 'extern "C"' blocks to treat code as C.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cctbx/cctbx_project/issues/700#issuecomment-995254008, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADQ24VR7BRK5WD2ROT5FMITUREHCVANCNFSM5KEW2N5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

nksauter avatar Dec 16 '21 01:12 nksauter