I am trying to compile into C++ a shared dll that was generated using Golang as a C binary. And I'm running the compilation using Gyp on Github Actions. This compilation works on both a Mac M1 and Mac x64, but is failing due to these errors.
Does anyone know how to do this? Here's the C header and the logs.
/* Code generated by cmd/cgo; DO NOT EDIT. */
/* package archwayhq/keyring-go/src/go */
#line 1 "cgo-builtin-export-prolog"
#include <stddef.h>
#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H
#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
#endif
#endif
/* Start of preamble from import "C" comments. */
#line 3 "main.go"
#include <stdlib.h>
#include <idl_export.h>
#line 1 "cgo-generated-wrapper"
/* End of preamble from import "C" comments. */
/* Start of boilerplate cgo prologue. */
#line 1 "cgo-gcc-export-header-prolog"
#ifndef GO_CGO_PROLOGUE_H
#define GO_CGO_PROLOGUE_H
typedef signed char GoInt8;
typedef unsigned char GoUint8;
typedef short GoInt16;
typedef unsigned short GoUint16;
typedef int GoInt32;
typedef unsigned int GoUint32;
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
typedef size_t GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
#ifdef _MSC_VER
#include <complex.h>
typedef _Fcomplex GoComplex64;
typedef _Dcomplex GoComplex128;
#else
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;
#endif
/*
static assertion to make sure the file is being used on architecture
at least with matching size of GoInt.
*/
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef _GoString_ GoString;
#endif
typedef void *GoMap;
typedef void *GoChan;
typedef struct { void *t; void *v; } GoInterface;
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
#endif
/* End of boilerplate cgo prologue. */
#ifdef __cplusplus
extern "C" {
#endif
extern void SetOsStore(char* serviceName, char* keyName, char* data);
extern char* GetOsStore(char* serviceName, char* keyName);
// note: ~/ is root of user dir
//
extern char* SetFileStore(char* fileSaveDir, char* fileName, char* data);
extern char* GetFileStore(char* fileSaveDir, char* fileName);
#ifdef __cplusplus
}
#endif
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
nothing.c
win_delay_load_hook.cc
nothing.vcxproj -> D:\a\keyring-go\keyring-go\build\Release\\nothing.lib
keyring.cc
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\include\ccomplex(22,52): warning C4996: '_Header_ccomplex': warning STL4004: <ccomplex>, <cstdalign>, <cstdbool>, and <ctgmath> are deprecated in C++17. You can define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning. [D:\a\keyring-go\keyring-go\build\keyring-go.vcxproj]
D:\a\keyring-go\keyring-go\build\cgo-gcc-export-header-prolog(20,30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\a\keyring-go\keyring-go\build\keyring-go.vcxproj]
D:\a\keyring-go\keyring-go\build\cgo-gcc-export-header-prolog(20,19): error C2146: syntax error: missing ';' before identifier 'GoComplex64' [D:\a\keyring-go\keyring-go\build\keyring-go.vcxproj]
D:\a\keyring-go\keyring-go\build\cgo-gcc-export-header-prolog(21,31): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [D:\a\keyring-go\keyring-go\build\keyring-go.vcxproj]
D:\a\keyring-go\keyring-go\build\cgo-gcc-export-header-prolog(21,19): error C2146: syntax error: missing ';' before identifier 'GoComplex128' [D:\a\keyring-go\keyring-go\build\keyring-go.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\a\keyring-go\keyring-go\node_modules\node-gyp\lib\build.js:203:23)
gyp ERR! stack at ChildProcess.emit (node:events:513:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Windows_NT 10.0.20348
gyp ERR! command "C:\\hostedtoolcache\\windows\\node\\18.14.2\\x64\\node.exe" "D:\\a\\keyring-go\\keyring-go\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "build"
gyp ERR! cwd D:\a\keyring-go\keyring-go
gyp ERR! node -v v18.14.2
gyp ERR! node-gyp -v v9.3.1
gyp ERR! not ok
Error: Process completed with exit code 1.