Skip to content
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

undefined variable _s in stream_engine_base.cpp cause build failure on kFreeBSD #4113

Closed
jonassmedegaard opened this issue Jan 3, 2021 · 5 comments · Fixed by #4114 or #4121
Closed

Comments

@jonassmedegaard
Copy link

libzmq fails to build on kFreeBSD:

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I./src -I/usr/include/pgm-5.3 -isystem /usr/include/mit-krb5 -D__BSD_VISIBLE -D_REENTRANT -D_THREAD_SAFE -Wdate-time -D_FORTIFY_SOURCE=2 -fvisibility=hidden -pedantic -Werror -Wall -Wno-long-long -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -ffat-lto-objects -c src/stream_listener_base.cpp -o src/libzmq_la-stream_listener_base.o >/dev/null 2>&1
src/stream_engine_base.cpp: In function ‘std::string get_peer_address(zmq::fd_t)’:
src/stream_engine_base.cpp:87:26: error: ‘_s’ was not declared in this scope; did you mean ‘s_’?
   87 |         if (!getsockopt (_s, 0, LOCAL_PEERCRED, &cred, &size)
      |                          ^~
      |                          s_
src/stream_engine_base.cpp:94:13: error: ‘_peer_address’ was not declared in this scope; did you mean ‘peer_address’?
   94 |             _peer_address += buf.str ();
      |             ^~~~~~~~~~~~~
      |             peer_address
make[2]: *** [Makefile:5866: src/libzmq_la-stream_engine_base.lo] Error 1

(full build log)

It seems the cause is that in shuffling around some code 2 years ago variable _s was oddly and inconsistently (probably accidentally) renamed to s_: 091df74

Fix seems to be to revert to use _s at its current locations:
https://github.com/zeromq/libzmq/blob/master/src/stream_engine_base.cpp#L66
https://github.com/zeromq/libzmq/blob/master/src/stream_engine_base.cpp#L70
https://github.com/zeromq/libzmq/blob/master/src/stream_engine_base.cpp#L77

...so that it is defined at https://github.com/zeromq/libzmq/blob/master/src/stream_engine_base.cpp#L87

bluca added a commit to bluca/libzmq that referenced this issue Jan 3, 2021
Solution: fix refactor mistake introduced by:

091df74

Fixes zeromq#4113
bluca added a commit that referenced this issue Jan 6, 2021
Solution: fix refactor mistake introduced by:

091df74

Fixes #4113
@bigon
Copy link

bigon commented Jan 8, 2021

Hello,

The patch here seems to address _s but not _peer_address, am I missing something?

@bluca
Copy link
Member

bluca commented Jan 8, 2021

Sigh, no I missed that, my bad. Can you send a PR?

@jonassmedegaard
Copy link
Author

jonassmedegaard commented Jan 8, 2021 via email

@bigon
Copy link

bigon commented Jan 8, 2021

Well the initial build log also mention _peer_address

@jonassmedegaard
Copy link
Author

Ohhh, indeed it does - and in Debian indeed it continues to fail with my proposed patch: https://buildd.debian.org/status/fetch.php?pkg=zeromq3&arch=kfreebsd-amd64&ver=4.3.3-5&stamp=1610053267&raw=0

I am so sorry that I didn't properly test :-(

@bluca bluca reopened this Jan 8, 2021
bluca added a commit to bluca/libzmq that referenced this issue Jan 8, 2021
Solution: fix refactor mistake introduced by:

    091df74

    Fixes zeromq#4113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants