2

In MSYS2, I tried to intall a Chicken egg with::

chicken-install http-client

I get several errors like the following:

"c:\msys64\usr\local\bin\csc" -feature compiling-extension -setup-mode    mathh.scm -shared -optimize-leaf-routines -inline -output-file mathh.so -emit-import-library mathh -emit-type-file mathh.types -local -no-procedure-checks
mathh.c:24:1: error: static declaration of 'log2' follows non-static declaration
 log2( double x )
 ^~~~
In file included from c:/msys64/usr/local/include/chicken/chicken.h:131:0,
                 from mathh.c:11:
C:/msys64/mingw64/x86_64-w64-mingw32/include/math.h:773:25: note: previous declaration of 'log2' was here
   extern double __cdecl log2 (double);
                         ^~~~
mathh.c:41:1: error: static declaration of 'log1p' follows non-static declaration
 log1p( double x )
^~~~~

Edit

The dependency:

chicken-install mathh

gives:

...
mathh.c: In function 'stub181':
mathh.c:357:19: warning: implicit declaration of function 'mm_hypot'; did you mean '_hypot'? [-Wimplicit-function-declaration]
 C_r=C_flonum(&C_a,mm_hypot(t0,t1));
                   ^~~~~~~~
                   _hypot
mathh.o:mathh.c:(.text+0x177f): undefined reference to `mm_hypot'
collect2.exe: error: ld returned 1 exit status

Error: shell command terminated with non-zero exit status 1: ""gcc" "mathh.o" -o "mathh.so" -Wl,--enable-auto-import -shared -Lc:\msys64\usr\local\lib\ -lchicken -lm -lws2_32"

Error: shell command failed with nonzero exit status 1:

  ""c:\msys64\usr\local\bin\csc" -feature compiling-extension -setup-mode    mathh.scm -shared -optimize-leaf-routines -inline -output-file mathh.so -emit-import-library mathh -emit-type-file mathh.types -local -no-procedure-checks"


Error: shell command terminated with nonzero exit code
70
"\"\"c:\\msys64\\usr\\local\\bin\\csi\" -bnq -setup-mode -e \"(require-lib...

Edit

Fix proposed by @krl:

msys2_shell.cmd -mingw64 # see http://wiki.call-cc.org/msys2
export CHICKEN_PREFIX="c:\msys64\usr\local\\"
export CHICKEN_REPOSITORY="c:\msys64\usr\local\lib\chicken\8\\"
chicken-install -retrieve mathh
sed  -i.bak -r 's/define +mathh-compile-options.+\(/&\n  -C -mwin32/' ./mathh/mathh.setup
chicken-install test
chicken-install -test -transport local -location . mathh

That still gives the following errors:

...

installing mathh: ...
changing current directory to C:\msys64\home\user\.\mathh
  ""c:\msys64\usr\local\bin\csi" -bnq -setup-mode -e "(require-library setup-api)" -e "(import setup-api)" -e "(setup-error-handling)" -e "(extension-name-and-version '(\"mathh\" \"\"))" "mathh.setup""
  "c:\msys64\usr\local\bin\csc" -feature compiling-extension -setup-mode mathh.scm -shared -optimize-leaf-routines -inline -output-file mathh.so -emit-import-library mathh -emit-type-file mathh.types -local -no-procedure-checks
mathh.c:29:1: error: static declaration of 'log2' follows non-static declaration
 log2( double x )
 ^~~~
In file included from c:/msys64/usr/local/include/chicken/chicken.h:131:0,
                 from mathh.c:11:
C:/msys64/mingw64/x86_64-w64-mingw32/include/math.h:773:25: note: previous                                   declaration of 'log2' was here
   extern double __cdecl log2 (double);
                         ^~~~
... further errors like above
antonio
  • 10,629
  • 13
  • 68
  • 136

3 Answers3

2

It looks like this is a bug in the mathh egg. I've asked its author to take a look and he's published a new version. Can you try again?

sjamaan
  • 2,282
  • 10
  • 19
1

from http://www.davidegrayson.com/windev/msys2/ it appears the MSYS2 -mwin32 gcc option is needed to define _WIN32. mathh uses defined(_WIN32) to trigger expansion of the q&d implementations of log2, etc. for windows.

the mathh egg mathh.setup file can be modified to supply compile-options. see the definition of mathh-compile-options in mathh.setup.

ex: (define mathh-compile-options '(-local -no-procedure-checks -mwin32))
krl
  • 11
  • 2
  • sorry : (define mathh-compile-options '(-local -no-procedure-checks -C -mwin32)) – krl Feb 17 '18 at 20:39
  • As I understand, this assumes that I should make a separate download of the `mathh` egg, modify `mathh.setup` and recompile. Any pointer on how to do this? – antonio Feb 17 '18 at 22:38
  • cd chicken-install -retrieve mathh ... edit ./mathh/mathh.setup ... chicken-install -test -transport local -location . mathh – krl Feb 18 '18 at 02:39
  • Still get build errors. Please, check my last question edit. – antonio Feb 18 '18 at 15:31
  • why isn't _WIN32 defined? try explicit def : (define mathh-compile-options `(-local -no-procedure-checks -C -D_WIN32) – krl Feb 18 '18 at 19:48
  • seems log2, log1p, ... are now available. remove the offending C procedures from the source (where the compiler complains of a math.h extern). – krl Feb 18 '18 at 21:56
  • Yes! In fact, in `mathh.scm`, after `#elif defined(__CYGWIN__) || ...`, I added the 3 lines: `#if defined(_WIN32) `, `#pragma message "_WIN32" `, `#endif `. I always get the #pragma message: with `-C -mwin32`, and also with no compiler options. So the code conditional to `_WIN32` is executed, and the related maths functions are defined. But they have been already defined in `C:/msys64/mingw64/x86_64-w64-mingw32/include/math.h`. Hence the error: "static declaration of 'log2' follows non-static declaration". – antonio Feb 18 '18 at 22:24
  • Note also that I am using `msys2_shell.cmd -mingw64` as from [wiki.call-cc.org/msys2](http://wiki.call-cc.org/msys2) and not the subsystem `msys` of MSYS2. – antonio Feb 18 '18 at 22:25
0

I've just released http-client version 0.16 where I ripped out the overly complex md5 dependency, and replaced it with the new simple-md5 egg.

This should be much easier to install. It should appear on the egg mirrors shortly.

sjamaan
  • 2,282
  • 10
  • 19