justinethier / cyclone

:cyclone: A brand-new compiler that allows practical application development using R7RS Scheme. We provide modern features and a stable system capable of generating fast native binaries.
http://justinethier.github.io/cyclone/
MIT License
823 stars 42 forks source link

Tests fail on Mac #493

Open clartaq opened 1 year ago

clartaq commented 1 year ago

I started down this path after seeing failures when trying to use cyclone format.

I installed cyclone-bootstrap as directed in the documentation for the Mac since the brew installation is not working.

The make test command produced an error "outside of tests".

...
make-list: .
1 out of 1 (100.0%) test passed in 0.0 seconds.
error in group outside of tests
("Unable to open input memory stream" 0)I/O: 0 out of 1 (0.0%) tests passed in 0.0 seconds.
1 error (100.0%).
rationals: ..
2 out of 2 (100.0%) tests passed in 0.0 seconds.
...

But no errors in the tests themselves were noted.

I tried running the tests in the main cyclone repository since they are more extensive and have tests for SRFI 28, the one causing my original problem. The same error as above was noted in addition to a crash:

...
131 out of 131 (100.0%) tests passed in 0.0 seconds.
2 out of 2 (100.0%) subgroups passed.
rm -rf tests/srfi-143-tests
icyc -p "(cond-expand (linux (begin (define-syntax foo (syntax-rules () ((foo) 123))) (foo))))"
Error: Unable to open input memory stream: 0
Call history, most recent first:
[1] scheme/base.sld:foldl
[2] icyc.scm:collect-opt-values
[3] scheme/base.sld:not
[4] scheme/base.sld:foldl
[5] icyc.scm:collect-opt-values
[6] scheme/base.sld:foldl
[7] icyc.scm:collect-opt-values
[8] scheme/base.sld:make-string
[9] scheme/cyclone/pretty-print.sld:lib-init:schemecyclonepretty_91print

make: *** [test] Error 1

It doesn't appear to have made it to the tests for the format library.

Any ideas?

justinethier commented 1 year ago

Hmm. You would see this error if fmemopen is not available on your system. Cyclone's makefile uses the following test to check for support:

echo "main(){char *buf; fmemopen(&buf, 0, \"r\");}" | cc -xc - >/dev/null 2>/dev/null && echo 1 || echo 0

I installed cyclone-bootstrap as directed in the documentation for the Mac since the brew installation is not working.

What happens when you try to install using brew?

clartaq commented 1 year ago

When I did try brew, there was a message about installing cyclone-bootstrap, then make started. After awhile there was an error message. Here's the transcript.

 brew install cyclone
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 4 taps (homebrew/cask-versions, homebrew/core, homebrew/cask and homebrew/cask-fonts).

You have 1 outdated formula installed.
You can upgrade it with brew upgrade
or list it with brew outdated.

==> Downloading https://github.com/justinethier/cyclone-bootstrap/archive/v0.35.0.tar.gz
Already downloaded: /Users/david/Library/Caches/Homebrew/downloads/7cec8ce3f88253ff73404f06d3d57403e5d57ba656158b610599f5a2b6f1fad5--cyclone-bootstrap-0.35.0.tar.gz
==> Downloading https://github.com/justinethier/cyclone/archive/v0.35.0.tar.gz
Already downloaded: /Users/david/Library/Caches/Homebrew/downloads/860bc1e0a961aaace1ce723c583db421688e8e24bbb7379739015b687289bdba--cyclone-0.35.0.tar.gz
==> Installing cyclone from cyclone-scheme/cyclone
==> Installing dependencies for cyclone-scheme/cyclone/cyclone: cyclone-bootstrap
==> Installing cyclone-scheme/cyclone/cyclone dependency: cyclone-bootstrap
==> make
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/winds
Target /usr/local/bin/winds
already exists. You may want to remove it:
  rm '/usr/local/bin/winds'

To force the link and overwrite all conflicting files:
  brew link --overwrite cyclone-bootstrap

To list all files that would be deleted:
  brew link --overwrite --dry-run cyclone-bootstrap

Possible conflicting files are:
/usr/local/bin/winds
==> Summary
🍺  /usr/local/Cellar/cyclone-bootstrap/v0.35.0: 439 files, 65.8MB, built in 2 minutes 5 seconds
==> Installing cyclone-scheme/cyclone/cyclone
==> make
Last 15 lines from /Users/david/Library/Logs/Homebrew/cyclone/01.make:
a - bn_s_mp_reverse.o
a - bn_s_mp_sqr.o
a - bn_s_mp_sqr_fast.o
a - bn_s_mp_sub.o
a - bn_s_mp_toom_mul.o
a - bn_s_mp_toom_sqr.o
ranlib libcyclonebn.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcyclonebn.a(bn_mp_set_double.o) has no symbols
libtool -static -o libcyclone.a runtime.o gc.o ffi.o mstreams.o hashset.o libcyclonebn.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: libcyclonebn.a(bn_mp_set_double.o) has no symbols
cyclone -A . cyclone.scm
Error: Unable to open file:
"/usr/local/share/cyclone/cyclone/foreign.sld"

make: *** [cyclone] Error 1

Do not report this issue to Homebrew/brew or Homebrew/core!
clartaq commented 1 year ago

it is probably useful to you to run the brew install again after removing the /usr/local/bin/winds file it complained about above.

brew install cyclone
==> Downloading https://github.com/justinethier/cyclone/archive/v0.35.0.tar.gz
Already downloaded: /Users/david/Library/Caches/Homebrew/downloads/860bc1e0a961aaace1ce723c583db421688e8e24bbb7379739015b687289bdba--cyclone-0.35.0.tar.gz
==> Installing cyclone from cyclone-scheme/cyclone
==> make
Last 15 lines from /Users/david/Library/Logs/Homebrew/cyclone/01.make:
a - bn_s_mp_reverse.o
a - bn_s_mp_sqr.o
a - bn_s_mp_sqr_fast.o
a - bn_s_mp_sub.o
a - bn_s_mp_toom_mul.o
a - bn_s_mp_toom_sqr.o
ranlib libcyclonebn.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libcyclonebn.a(bn_mp_set_double.o) has no symbols
libtool -static -o libcyclone.a runtime.o gc.o ffi.o mstreams.o hashset.o libcyclonebn.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: libcyclonebn.a(bn_mp_set_double.o) has no symbols
cyclone -A . cyclone.scm
Error: Unable to open file:
"/usr/local/share/cyclone/cyclone/foreign.sld"

make: *** [cyclone] Error 1

Do not report this issue to Homebrew/brew or Homebrew/core!

Similar result.

clartaq commented 1 year ago

Also, running the test you mention:

echo "main(){char *buf; fmemopen(&buf, 0, \"r\");}" | cc -xc - >/dev/null 2>/dev/null && echo 1 || echo 0
0