gochilkat

Cannot run Go example applications with Chilkat v9.5.0.88 on Windows


I am trying to update my windows application that uses Chilkat v9.5.0.80 to the latest version v9.5.0.88

I am trying to compile and execute the example1 application.

Go version is 1.17

I followed the how-to and managed to compile chilkat.a library

I downloaded the native library as following:

v9.5.0.88 • 29-Aug-2021 • sha256: e4a46ab3e971786f791f0923e22c9f57005047224477035296a8c3a3f49d5436
Windows 64-bit tdm-64-5.1.0 (dw2) C Static Lib

GCC version is the following:

PS C:\TDM-GCC-64\bin> gcc -v
Using built-in specs.
COLLECT_GCC=C:\TDM-GCC-64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/TDM-GCC-64/bin/../libexec/gcc/x86_64-w64-mingw32/5.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-5.1.0/configure --build=x86_64-w64-mingw32 --enable-targets=all --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: posix
gcc version 5.1.0 (tdm64-1)

Then I compile the example1 application and when I execute it I get this runtime error (details taken from Windows event log):

Faulting application name: chilkat_example1.exe, version: 0.0.0.0, time stamp: 0x617aa189
Faulting module name: libstdc++_64-6.dll, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x000000000001b8d0
Faulting process id: 0x6208
Faulting application start time: 0x01d7d6dd931e7949
Faulting application path: C:\dev\go\src\chilkat_example1\chilkat_example1.exe
Faulting module path: C:\TDM-GCC-64\bin\libstdc++_64-6.dll
Report Id: 6a8d464f-d6f1-4a0b-8e5d-021e1791b22b
Faulting package full name: 
Faulting package-relative application ID: 

I tried to compile example1 application with static linking in order to remove stdc++ dependency as per following instructions: https://cknotes.com/go-language-static-linking-to-remove-libstdc-requirement/

Unfortunately I get another error at runtime:

Faulting application name: chilkat_example1.exe, version: 0.0.0.0, time stamp: 0x618ce644
Faulting module name: chilkat_example1.exe, version: 0.0.0.0, time stamp: 0x618ce644
Exception code: 0xc0000005
Fault offset: 0x0000000000775410
Faulting process id: 0x7adc
Faulting application start time: 0x01d7d6e10ef429bb
Faulting application path: C:\dev\go\src\chilkat_example1\chilkat_example1.exe
Faulting module path: C:\dev\go\src\chilkat_example1\chilkat_example1.exe
Report Id: 0c74132f-a3b7-4b28-a5a8-0e1f6a562a11
Faulting package full name: 
Faulting package-relative application ID: 

Solution

  • I managed to solve the issue by uninstalling old TDM-GCC and installing MinGW 64 version x86_64-8.1.0-posix-seh-rt_v6-rev0.

    Then I repeated the whole process with this native library:

    v9.5.0.88 • 29-Aug-2021 • sha256: 8e6c56ee7c13f86f95d18b41b6fe7df305a040f74dade3526407f1099122ac8d
    MinGW-w64 GCC-8.1.0 x86_64-8.1.0-posix-seh C Static Lib
    

    Everything is now working as expected