erickt / rust-zmq

Rust zeromq bindings.
Apache License 2.0
886 stars 189 forks source link

Compilation failure on old system #356

Open zephod77 opened 1 year ago

zephod77 commented 1 year ago

I'm trying to compile on an old Centos7 machine. All I've done is add the zmq = "0.10.0" dependency to my Cargo.toml file and rebuild and zmq-sys fails with this error:

[zmq-sys 0.12.0] cargo:warning=/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and li brary support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or - std=gnu++11 compiler options.

So my question is where do I add that c++ compiler option?

zephod77 commented 1 year ago

Update: The files that are failing to compile is mailbox_safe.cpp and mailbox.cpp. If I manually add the -std=c++11 flag, then it will compile. I can see that autoconf tools are being used and that there are tests for "gnu11" to set the -std flag so they must be failing for some reason.

zephod77 commented 1 year ago

Found a solution. I had to create an environment variable CXXFLAGS and set it to -std=c++11. I ended up creating a .cargo directory in my project's home and adding a file config.toml with the contents:

[env]
CXXFLAGS = "-std=c++11"

I don't know if this is considered a "good" solution but it works for me.

hikaricai commented 1 year ago

Same issue,thanks for the solution