Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9d3082173a0862b6a116cad007f33ca95ca32c0c804093b145f573ea4eb0789b
Ticket: 6f22c7a1fc97841d58a8d5fb2dc40bf82b839af6
Cannot load sampleextension when built with mingw64
User & Date: apnadkarni on 2023-08-01 08:00:44
Changes

  1. icomment:
    Right, I realized as much but the question is why this happens. Both Ubuntu and Mingw64 have a system Tcl installed but this error only shows up on Mingw64. In both cases `--with-tcl` specifies the Tcl9 installation and the config.log shows the correct 9.0 tclConfig.sh being picked up.
    
    Tracing through it appears this is caused by the following fragment from the `configure` script
    
    ```
    if test -n "$CONFIG_SITE"; then
      ac_site_files="$CONFIG_SITE"
    elif test "x$prefix" != xNONE; then
      ac_site_files="$prefix/share/config.site $prefix/etc/config.site"
    else
      ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
    fi
    for ac_site_file in $ac_site_files
    do
      case $ac_site_file in #(
      */*) :
         ;; #(
      *) :
        ac_site_file=./$ac_site_file ;;
    esac
      if test -f "$ac_site_file" && test -r "$ac_site_file"; then
        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
    printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;}
        sed 's/^/| /' "$ac_site_file" >&5
        . "$ac_site_file" \
          || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
    ```
    
    On mingw, the system picks up /etc/config.site resulting in `prefix` being set to `/mingw64`. On Ubuntu, the equivalent site file does not exist resulting in `prefix` staying as `NONE`. Later on `includedir` is set to `$(prefix)/include` and **this is preferred over `$(TCL_PREFIX)/include` in the search for `tcl.h`**.
    
    It does not make sense to me as that the site path is given preference over the path specified via `--with-tcl` to `configure`. If that option is specified, all paths should target that directory. But then again, I know little about Unix conventions. It seems to me though, every extension writer is going to run into this and wonder if they have made some error in porting to Tcl 9. As I did.
    
    Using `--with-tclinclude` in `configure` fixes the problem but really should not be required once --with-tcl is specified.
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"