-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
z/OS: Updated to build libzmq git master #1139
Conversation
Updated: builds/zos/README.md: Outlined process to transfer source from GitHub to z/OS UNIX System Services, including character set conversion for the source
Updated: src/metdata.hpp: Remove explicit "const" from key of std::map<> because the key is implicitly const already (see http://en.cppreference.com/w/cpp/container/map and http://www.cplusplus.com/reference/map/map/). On some platforms (such as z/OS UNIX System Services) explicitly declaring the map key as "const" causes template expansion errors as it tries to create separate allocators for "const const std::string" and "const std::string" only to find that they clash. (Presumably some compilers collapse these into one earlier.) There are no template expansion errors if the map key is left to be implicitly const.
Updated: tests/test_connect_delay_tipc.cpp tests/test_sub_forward_tipc.cpp tests/test_term_endpoint_tipc.cpp
Updated: builds/zos/cxxall: Defines ZMQ_HAVE_ZOS for platform portability; define ZMQ_USE_POLL _instead_ of ZMQ_FORCE_POLL, due to change in src/poller.hpp since ZeroMQ 4.0.x branch
Updated: builds/zos/runtests: Extract tests to run from tests/Makefile.am at runtime, rather than hard coding tests list (to simplfy later maintenance). test_*_tipc is excluded as BUILD_TIPC is not defined on z/OS UNIX System Services. XFAIL_TESTS are also excluded, following current logic in tests/Makefile.am
Updated: src/thread.cpp: On older z/OS UNIX System Services, pthread_{get,set}schedparam is not present (searching the Internet suggests it may be present in later version than the one being used for z/OS UNIX System Services porting). Make zmq::thread_t::setSchedulingParameters() a no-op on z/OS UNIX System Services. NOTE: pthread_{get,set}schedparam appear to have been introduced by POSIX.1-2001 or IEEE 1003.1-2004 so may not be universally available, and thus more platforms may need this "no-op" treatment.
Updated: builds/zos/README.md: Updated with portability notes resulting from building zeromq/libzmq/master as of 2014-07-23 on z/OS UNIX System Services. Current z/OS UNIX status: all expected tests pass, except "test_proxy", which hangs and times out.
@@ -31,7 +31,7 @@ namespace zmq | |||
{ | |||
public: | |||
|
|||
typedef std::map <const std::string, const std::string> dict_t; | |||
typedef std::map <std::string, const std::string> dict_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you drop the const qualifier here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because (a) it's implicitly const anyway (the keys of a map<>
are made const in the definition), and (b) if it is marked as const explicitly, then std:map<const std::string, const std::string>
expands into (effectively) std::map<const const std::string, const std::string>
and on the IBM XL C/C++ that results in template expansion failure (deep in std:allocate, once it realises it's been tricked into expanding two things that work out the same :-( ).
This, plus some references for the std::map key being implicitly const, are all in the commit message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference this is what the build errors look like on z/OS with the IBM XL C/C++ compiler:
> cat map-string.cpp
#include <map>
#include <string>
int main(int argc, char *argv[]) {
typedef std::map<const std::string, const std::string> dict;
dict map;
}
> c++ -+ -Wc,xplink -Wl,xplink -o map-string map-string.cpp
"/usr/include/xmemory", line 390.23: CCN5401 (S) The member "std::allocator<const std::_EBCDIC::_LFS_OFF::basic_string<char,std::char_traits<char>,std::allocator<char> > >::address(const_reference) const" is already declared.
"/usr/include/xmemory", line 388.17: CCN5425 (I) "address" is defined on line 388 of "/usr/include/xmemory".
"/usr/include/xtree", line 149.17: CCN5700 (I) The previous message was produced while processing "class std::allocator<const std::_EBCDIC::_LFS_OFF::basic_string<char,std::char_traits<char>,std::allocator<char> > >".
"/usr/include/xtree", line 132.15: CCN5700 (I) The previous message was produced while processing "class std::_Tree<std::_Tmap_traits<const std::_EBCDIC::_LFS_OFF::basic_string<char,std::char_traits<char>,std::allocator<char> >,const std::_EBCDIC::_LFS_OFF::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<const std::_EBCDIC::_LFS_OFF::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<const std::_EBCDIC::_LFS_OFF::basic_string<char,std::char_traits<char>,std::allocator...".
"/usr/include/map", line 108.15: CCN5700 (I) The previous message was produced while processing "class std::map<const std::_EBCDIC::_LFS_OFF::basic_string<char,std::char_traits<char>,std::allocator<char> >,const std::_EBCDIC::_LFS_OFF::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<const std::_EBCDIC::_LFS_OFF::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<const std::_EBCDIC::_LFS_OFF::basic_string<char,std::char_traits<char>,std::allocator<char> >,const std::...".
"./map-string.cpp", line 4.5: CCN5700 (I) The previous message was produced while processing "main(int, char *[])".
CCN0793(I) Compilation failed for file ./map-string.cpp. Object file not created.
FSUM3065 The COMPILE step ended with return code 12.
FSUM3017 Could not compile map-string.cpp. Correct the errors and try again.
>
Without the const on the key to std::map it compiles without errors:
> !cat
cat map-string.cpp
#include <map>
#include <string>
int main(int argc, char *argv[]) {
typedef std::map<std::string, const std::string> dict;
dict map;
}
> c++ -+ -Wc,xplink -Wl,xplink -o map-string map-string.cpp
>
z/OS: Updated to build libzmq git master
These patches make it possible to build and run libzmq git master (4.1.x-development) on z/OS UNIX System Services by:
Tests to run are now auto-detected by parsing tests/Makefile.am in shell script (pretty rough'n'ready); tests known to fail are skipped including all TIPC tests as these appear to be Linux specific. All but one of the remaining tests pass (test_proxy currently hangs, and times out; unsure why.)
Includes additional build/portability fixes found while trying to build:
Plus one possible-ZOS-specific change (src/thread.cpp) to avoid calling pthread_{get,set}schedparam() on z/OS. (In practice I think this applies to some other platforms so may require some more portability attention.)