jdc8 / tclzmq

Tcl wrapper for zeromq
Other
14 stars 6 forks source link

MacOS build doesn't need -lgcc_eh #11

Open mpcjanssen opened 6 years ago

mpcjanssen commented 6 years ago

When trying to build on MacOS I get the error:

gcc
    -bundle
    -arch
    x86_64
    -o
    /Users/mark.janssen/Src/tclzmq/BUILD.zmq/v3117_00000000000000000000000000000027.dylib
    /Users/mark.janssen/Src/tclzmq/BUILD.zmq/v3117_00000000000000000000000000000027_pic.o
    /Users/mark.janssen/Src/tclzmq/BUILD.zmq/v3117_00000000000000000000000000000021_pic.o
    -L/usr/local/Cellar/zeromq/4.2.2/lib
    -L/usr/local/Cellar/tcl-tk/8.6.7/lib/tcl8.6
    -lzmq
    -lpthread
    -lm
    -lgcc_eh

ld: library not found for -lgcc_eh
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Following diff fixes the build

diff --git a/zmq.tcl b/zmq.tcl
index 106fea3..be59227 100644
--- a/zmq.tcl
+++ b/zmq.tcl
@@ -40,7 +40,6 @@ if {[string match "win32*" [::critcl::targetplatform]]} {
     critcl::clibraries -lpthread -lm

     if {[string match "macosx*" [::critcl::targetplatform]]} {
-       critcl::clibraries -lgcc_eh
     } elseif {[string match "*mingw32*" [::critcl::targetplatform]]} {
        critcl::clibraries -luuid
     } else {
mpcjanssen commented 6 years ago

After this change the build succeeds, but in the hello world example the client sometimes segfaults when receiving the hello world message.

$ tclsh client.tcl
Received World @ Thu Nov 16 15:24:55 CET 2017/36
Received World @ Thu Nov 16 15:24:55 CET 2017/36
Received World @ Thu Nov 16 15:24:55 CET 2017/36
Received World @ Thu Nov 16 15:24:55 CET 2017/36
Received World @ Thu Nov 16 15:24:55 CET 2017/36
Received World @ Thu Nov 16 15:24:55 CET 2017/36
Received World @ Thu Nov 16 15:24:55 CET 2017/36
Received World @ Thu Nov 16 15:24:55 CET 2017/36
Received World @ Thu Nov 16 15:24:55 CET 2017/36
Received World @ Thu Nov 16 15:24:55 CET 2017/36
alloc: invalid block: 0x7ff7e888c480: 0 0
Abort trap: 6