Ticket Change Details
Bounty program for improvements to Tcl and certain Tcl packages.

Artifact ID: a7a9eea528610115e6dd4a1524b7c37a7aca41713b614f2f50f085de3ebe3c20
Ticket: e01f02a12180ac37cdb96ec16d0e03f89033cd77
Segfault under wish at first tls::import, not under tclsh
User & Date: anonymous on 2020-09-02 06:40:21

  1. icomment:
    Huh, that was easier to solve than I thought.
    First, the easiest way of demonstrating that the symbol bindings 
    are wrong is to set the environment variable DYLD_PRINT_BINDINGS. 
    With that, and the default linker flags for shared-tcltls.dylib, 
    we get (in the vicinity of DH_new):
    dyld: lazy forcedbind: tcltls.dylib:0x100742118 = libcrypto.0.9.8.dylib:_DH_free, *0x100742118 = 0x7FFF8A4E6D50
    dyld: lazy forcedbind: tcltls.dylib:0x100742120 = libcrypto.0.9.8.dylib:_DH_new, *0x100742120 = 0x7FFF8A4E70D0
    dyld: lazy forcedbind: tcltls.dylib:0x100742128 = libcrypto.1.1.dylib:_DH_set0_pqg, *0x100742128 = 0x114E7C52A
    dyld: lazy forcedbind: tcltls.dylib:0x100742130 = libcrypto.0.9.8.dylib:_ERR_clear_error, *0x100742130 = 0x7FFF8A52DB30
    dyld: lazy forcedbind: tcltls.dylib:0x100742138 = libcrypto.0.9.8.dylib:_ERR_get_error, *0x100742138 = 0x7FFF8A52DB10
    dyld: lazy forcedbind: tcltls.dylib:0x100742140 = libcrypto.0.9.8.dylib:_ERR_reason_error_string, *0x100742140 = 0x7FFF8A550810
    dyld: lazy forcedbind: tcltls.dylib:0x100742148 = libcrypto.0.9.8.dylib:_EVP_PKEY_assign, *0x100742148 = 0x7FFF8A4BDBA0
    dyld: lazy forcedbind: tcltls.dylib:0x100742150 = libcrypto.0.9.8.dylib:_EVP_PKEY_free, *0x100742150 = 0x7FFF8A4BDAD0
    dyld: lazy forcedbind: tcltls.dylib:0x100742158 = libcrypto.0.9.8.dylib:_EVP_PKEY_new, *0x100742158 = 0x7FFF8A4BD410
    dyld: lazy forcedbind: tcltls.dylib:0x100742160 = libcrypto.0.9.8.dylib:_EVP_md5, *0x100742160 = 0x7FFF8A4F6F50
    dyld: lazy forcedbind: tcltls.dylib:0x100742168 = libcrypto.0.9.8.dylib:_EVP_sha1, *0x100742168 = 0x7FFF8A55B140
    dyld: lazy forcedbind: tcltls.dylib:0x100742170 = libcrypto.1.1.dylib:_OPENSSL_init_crypto, *0x100742170 = 0x114F10356
    dyld: lazy forcedbind: tcltls.dylib:0x100742178 = libssl.1.1.dylib:_OPENSSL_init_ssl, *0x100742178 = 0x114D244F9
    dyld: lazy forcedbind: tcltls.dylib:0x100742180 = libcrypto.1.1.dylib:_OPENSSL_sk_num, *0x100742180 = 0x114F7B653
    dyld: lazy forcedbind: tcltls.dylib:0x100742188 = libcrypto.1.1.dylib:_OPENSSL_sk_value, *0x100742188 = 0x114F7B67B
    Further up there are a lot more binding to libcrypto.1.1.dylib, 
    so it's not as much 0.9.8 overall as this excerpt might suggest, 
    but any amount of schizophrenic bindings is a crash waiting to happen.
    Now why are the bindings done in this crazy way? It turns out the 
    standard LDFLAGS include
    which literally means "don't pay attention to what library a symbol 
    should be from, just grab the first symbol with the right name that 
    comes along". Pretty much the source of these troubles, isn't it? 
    Indeed, if removing that flag and the subsequent -undefined suppress 
    from the LDFLAGS, tcltls still builds just fine, and the bindings 
    now look sane:
    dyld: lazy forcedbind: tcltls.dylib:0x100642118 = libcrypto.1.1.dylib:_DH_free, *0x100642118 = 0x114F7C221
    dyld: lazy forcedbind: tcltls.dylib:0x100642120 = libcrypto.1.1.dylib:_DH_new, *0x100642120 = 0x114F7BFD0
    dyld: lazy forcedbind: tcltls.dylib:0x100642128 = libcrypto.1.1.dylib:_DH_set0_pqg, *0x100642128 = 0x114F7C52A
    dyld: lazy forcedbind: tcltls.dylib:0x100642130 = libcrypto.1.1.dylib:_ERR_clear_error, *0x100642130 = 0x114FE1ACE
    dyld: lazy forcedbind: tcltls.dylib:0x100642138 = libcrypto.1.1.dylib:_ERR_get_error, *0x100642138 = 0x114FE1BD4
    dyld: lazy forcedbind: tcltls.dylib:0x100642140 = libcrypto.1.1.dylib:_ERR_reason_error_string, *0x100642140 = 0x114FE26A1
    dyld: lazy forcedbind: tcltls.dylib:0x100642148 = libcrypto.1.1.dylib:_EVP_PKEY_assign, *0x100642148 = 0x11500686E
    dyld: lazy forcedbind: tcltls.dylib:0x100642150 = libcrypto.1.1.dylib:_EVP_PKEY_free, *0x100642150 = 0x115006DE8
    dyld: lazy forcedbind: tcltls.dylib:0x100642158 = libcrypto.1.1.dylib:_EVP_PKEY_new, *0x100642158 = 0x115006002
    dyld: lazy forcedbind: tcltls.dylib:0x100642160 = libcrypto.1.1.dylib:_EVP_md5, *0x100642160 = 0x115002E37
    dyld: lazy forcedbind: tcltls.dylib:0x100642168 = libcrypto.1.1.dylib:_EVP_sha1, *0x100642168 = 0x11500353E
    dyld: lazy forcedbind: tcltls.dylib:0x100642170 = libcrypto.1.1.dylib:_OPENSSL_init_crypto, *0x100642170 = 0x115010356
    dyld: lazy forcedbind: tcltls.dylib:0x100642178 = libssl.1.1.dylib:_OPENSSL_init_ssl, *0x100642178 = 0x114E244F9
    dyld: lazy forcedbind: tcltls.dylib:0x100642180 = libcrypto.1.1.dylib:_OPENSSL_sk_num, *0x100642180 = 0x11507B653
    dyld: lazy forcedbind: tcltls.dylib:0x100642188 = libcrypto.1.1.dylib:_OPENSSL_sk_value, *0x100642188 = 0x11507B67B
    Not a 0.9.8 in sight, and now I can have wish eval
       http::geturl https://www.tcl-lang.org/
    without segfaulting. Promising, but maybe a proper fix should rather 
    be in the Tcl build system, since that is what contributes the 
    -flat_namespace. Time for another bug report, I suppose.
  2. login: "anonymous"
  3. mimetype: "text/x-fossil-plain"
  4. type changed to: "Build Problem"
  5. username: "lars_h"