Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#39122 closed defect (fixed)

zmq @3.2.3 test error: ‘strndup’ was not declared in this scope

Reported by: deesto (John S. De Stefano Jr.) Owned by: merijn (Merijn Verstraaten)
Priority: Normal Milestone:
Component: ports Version: 2.1.3
Keywords: Cc: mndavidoff (Monte Davidoff), macports.org@…, watsodw, jdgleeson, eborisch (Eric A. Borisch)
Port: zmq

Description

On 10.6.8 w/Xcode 3.2.5

$ sudo port clean zmq && sudo port -d upgrade zmq

...

test_disconnect_inproc.cpp: In function ‘int main(int, char**)’:
test_disconnect_inproc.cpp:48: error: ‘strndup’ was not declared in this scope
test_disconnect_inproc.cpp:52: error: ‘strndup’ was not declared in this scope
test_disconnect_inproc.cpp:72: error: ‘strndup’ was not declared in this scope
make[1]: *** [test_disconnect_inproc.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_devel_zmq/zmq/work/zeromq-3.2.3/tests'
make: *** [all-recursive] Error 1
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_devel_zmq/zmq/work/zeromq-3.2.3'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_devel_zmq/zmq/work/zeromq-3.2.3" && /usr/bin/make -j4 -w all LIBTOOL=/opt/local/bin/glibtool 
Exit code: 2
Error: org.macports.build for port zmq returned: command execution failed
DEBUG: Error code: CHILDSTATUS 33732 2
DEBUG: Backtrace: command execution failed
    while executing
"system -nice 0 $fullcmdstring"
    ("eval" body line 1)
    invoked from within
"eval system $notty $nice \$fullcmdstring"
    invoked from within
"command_exec build"
    (procedure "portbuild::build_main" line 8)
    invoked from within
"$procedure $targetname"
Warning: targets not executed for zmq: org.macports.install org.macports.build org.macports.destroot
Please see the log file for port zmq for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_devel_zmq/zmq/main.log
DEBUG: couldn't open "/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/tclIndex": no such file or directory
    while executing
"open [file join $dir tclIndex]"
Error: Unable to upgrade port: 1
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets

Attachments (6)

main.log (27.4 KB) - added by deesto (John S. De Stefano Jr.) 12 years ago.
zmq-port-upgrade.log (25.4 KB) - added by deesto (John S. De Stefano Jr.) 12 years ago.
stdout/err
patch-tests-test_disconnect_inproc.cpp.diff (1.3 KB) - added by jdgleeson 12 years ago.
Portfile-zmq.diff (395 bytes) - added by jdgleeson 12 years ago.
zmq.patch (1.5 KB) - added by eborisch (Eric A. Borisch) 11 years ago.
zmq.2.patch (2.3 KB) - added by merijn (Merijn Verstraaten) 11 years ago.
Patch for Portfile + patch

Download all attachments as: .zip

Change History (27)

Changed 12 years ago by deesto (John S. De Stefano Jr.)

Attachment: main.log added

Changed 12 years ago by deesto (John S. De Stefano Jr.)

Attachment: zmq-port-upgrade.log added

stdout/err

comment:1 Changed 12 years ago by cooljeanius (Eric Gallager)

Hm, your system should have a strndup function... try updating your Xcode to 3.2.6 and then try again

comment:2 in reply to:  1 ; Changed 12 years ago by larryv (Lawrence Velázquez)

Owner: changed from macports-tickets@… to merijn@…

Replying to egall@…:

Hm, your system should have a strndup function...

OS X didn’t have strndup until 10.7.

10.6.8: http://www.opensource.apple.com/source/Libc/Libc-594.9.5/include/string.h
10.7.0: http://www.opensource.apple.com/source/Libc/Libc-763.11/include/string.h

comment:3 in reply to:  2 Changed 12 years ago by cooljeanius (Eric Gallager)

Replying to larryv@…:

Replying to egall@…:

Hm, your system should have a strndup function...

OS X didn’t have strndup until 10.7.

10.6.8: http://www.opensource.apple.com/source/Libc/Libc-594.9.5/include/string.h
10.7.0: http://www.opensource.apple.com/source/Libc/Libc-763.11/include/string.h

Really? I could have sworn I'd seen

checking for strndup... yes

scroll by in some configure script before on my Snow Leopard machine... then again my Snow Leopard had a bunch of headers on it that it probably shouldn't have had, so idk...

comment:4 Changed 12 years ago by mndavidoff (Monte Davidoff)

Cc: md14-macports@… added

Cc Me!

comment:5 Changed 12 years ago by macports.org@…

Cc: macports.org@… added

Cc Me!

comment:6 Changed 12 years ago by larryv (Lawrence Velázquez)

Cc: david.w.watson@… added

Has duplicate #39137.

comment:7 Changed 12 years ago by jdgleeson

Cc: jdgleeson@… added

Cc Me!

comment:8 Changed 12 years ago by jdgleeson

Here is a patch taken from this merge of a pull request

https://github.com/zeromq/zeromq3-x/commit/400cbc208a768c4df5039f401dd2688eede6e1ca

which was applied after zmq 3.2.3 was released.

I did not enclose the patch in a version test like

if {${os.platform} == "darwin" && ${os.major} <= 10} {
    patchfiles		patch-tests-test_disconnect_inproc.cpp.diff
}

because the patched upstream code has no version test, but there may be a reason to do so in Macports?

Last edited 11 years ago by jdgleeson (previous) (diff)

Changed 12 years ago by jdgleeson

Changed 12 years ago by jdgleeson

Attachment: Portfile-zmq.diff added

comment:9 Changed 11 years ago by eborisch (Eric A. Borisch)

Here is a patch that provides the function (rather than just commenting it out) and only does it on pre-Lion (can anyone confirm Lion has strndup?)

Changed 11 years ago by eborisch (Eric A. Borisch)

Attachment: zmq.patch added

comment:10 Changed 11 years ago by eborisch (Eric A. Borisch)

Cc: eborisch@… added

Cc Me!

comment:11 Changed 11 years ago by eborisch (Eric A. Borisch)

I see above someone has already confirmed strndup for lion.

comment:12 Changed 11 years ago by jdgleeson

Adding strndup is certainly a logically correct fix. However, the fprintf calls and strndup calls have already been removed upstream (see the link to the zeromq git repository in comment:6).

The zmq maintainers do not explain why they simply deleted strndup, so I will speculate: test_disconnect_inproc.cpp is a test function (i.e., not a part of the zmq library). The calls to strndup occur only in fprintf calls. The fprintf calls were probably used just to debug the test function itself. There is no need for the extra output they would generate. Final decision: simplify the code.

comment:13 Changed 11 years ago by eborisch (Eric A. Borisch)

Aha; should've read farther up the comment stream. Thanks for pointing that out! I've reached out to Merijn; he hopes to test (commit?) this tonight.

comment:14 Changed 11 years ago by merijn (Merijn Verstraaten)

I went with the upstream patch of removing the debugging prints as this was only a test file, I tested the patch on both Snow Leopard and Lion where it works fine, so should be ready for committing.

Changed 11 years ago by merijn (Merijn Verstraaten)

Attachment: zmq.2.patch added

Patch for Portfile + patch

comment:15 Changed 11 years ago by neverpanic (Clemens Lang)

Resolution: fixed
Status: newclosed

Commited in r106263. Thanks.

comment:16 Changed 11 years ago by samuel.bateman@…

Resolution: fixed
Status: closedreopened

The patch file doesn't work for me on Snow Leopard.

--->  Applying patches to zmq
--->  Applying patch-tests-test_disconnect_inproc.cpp.diff
patching file tests/test_disconnect_inproc.cpp
/usr/bin/patch: **** malformed patch at line 20: @@ -66,11 +64,6 @@

Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_zmq/zmq/work/zeromq-3.2.3" && /usr/bin/patch -p0 < '/opt/local/var/macports/sources/rsync.macports.org/release/ports/devel/zmq/files/patch-tests-test_disconnect_inproc.cpp.diff'
Exit code: 2

comment:17 in reply to:  16 Changed 11 years ago by merijn (Merijn Verstraaten)

Replying to samuel.bateman@…:

The patch file doesn't work for me on Snow Leopard.

--->  Applying patches to zmq
--->  Applying patch-tests-test_disconnect_inproc.cpp.diff
patching file tests/test_disconnect_inproc.cpp
/usr/bin/patch: **** malformed patch at line 20: @@ -66,11 +64,6 @@

That is a particularly odd line for patch to fail on...

What happens if you run the same patch command manually? Any other output from it? Relatedly, if you run "patch -v" which version does it output for you?

Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_zmq/zmq/work/zeromq-3.2.3" && /usr/bin/patch -p0 < '/opt/local/var/macports/sources/rsync.macports.org/release/ports/devel/zmq/files/patch-tests-test_disconnect_inproc.cpp.diff'
Exit code: 2

Will look in to this tomorrow to see if I can reproduce.

comment:18 Changed 11 years ago by jdgleeson

I've seen patch get confused like this when I have tried to edit a diff file by hand and incorrectly alterered the line numbers on the @@ lines. I suspect that is what happened here, because the line numbers on the @@ lines are the same as in the patch file I submitted above, but the lines

-                } else {
+                } 
+                else {

have been replaced by

                 } else {

so they are just as mutually inconsistent as if I had tried to do this myself :-)

Last edited 11 years ago by jdgleeson (previous) (diff)

comment:19 Changed 11 years ago by neverpanic (Clemens Lang)

Resolution: fixed
Status: reopenedclosed

I regenerated the patch file. Should be fixed in r106278. The patch now applies fine for me, but I'm on ML; please re-open if the problem persists.

comment:20 Changed 11 years ago by eborisch (Eric A. Borisch)

Succeeded on the Buildbot, for the record.

comment:21 Changed 11 years ago by samuel.bateman@…

Works for me now too, thanks.

Note: See TracTickets for help on using tickets.