Giter Club home page Giter Club logo

raco-cross's Introduction

raco cross

This the source for the Racket packages "raco-cross", "raco-cross-doc", and "raco-cross-lib".

Contributing

Contribute to Racket by submitting a pull request, reporting an issue, joining the development mailing list, or visiting the IRC or Slack channels.

License

Racket, including these packages, is free software, see LICENSE for more details.

By making a contribution, you are agreeing that your contribution is licensed under the Apache 2.0 license and the MIT license.

raco-cross's People

Contributors

jasonhemann avatar mflatt avatar samth avatar sschwarzer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raco-cross's Issues

rumble exception during `raco setup`

I wasn't sure whether or not to report this in the main Racket repo or here. I chose to report it here because the problem doesn't occur when I run raco setup using the same Racket version on Linux.

When I run

$ raco cross --target x86_64-linux pkg install a-package/

I see several exceptions like this during setup:

Exception: invalid bound variable #[#{literal-placeholder kbkqt2cjt71krl4k849g6n05s-14} 0] in (let ((#[...] (...))) #[#{literal-placeholder kbkqt2cjt71krl4k849g6n05s-14} 0]) near line 972, char 22 of rumble/procedure.ss

and the process eventually hangs.

>> Cross configuration
 Target:    x86_64-linux
 Host:      x86_64-macosx
 Version:   8.3
 VM:        cs
 Workspace: /Users/bogdan/Library/Racket/raco-cross/8.3

Binary built on Linux for Windows gives linklet contract violation

Finally, I had a chance to test a binary cross-compiled on Linux (host) for Windows (target). The binary is supposed to be a standalone binary, i. e. with all dependencies included to run under Windows.

When running the binary, I get:

C:\Users\...\Downloads>sudoku-solver-x86_64-windows.exe --help
instantiate-linklet: contract violation
  expected: linklet?
  given: #<correlated-linklet>

The build log is at
https://builds.sr.ht/~sschwarzer/job/531096
starting for the Windows build at
https://builds.sr.ht/~sschwarzer/job/531096#task-build-all-170

The cross-compilation itself is done with

raco cross --target "x86_64-win32" --vm cs -j 4 exe --orig-exe --embed-dlls \
	-o "build/x86_64-windows/sudoku-solver-x86_64-windows" games/sudoku-solver.rkt

(raco-cross is installed with installation scope) and results in this binary:
https://patchouli.sr.ht/builds.sr.ht/artifacts/~sschwarzer/531096/12b4f3e2df65899d/sudoku-solver-x86_64-windows.exe

In case it's relevant, the Makefile I use for building is at
https://git.sr.ht/~sschwarzer/sudoku-solver/tree/main/item/Makefile

Error during `raco cross pkg install`: find-dir: unable to locate "lib" executable: GRacket.app/Contents/MacOS/Gracket

Racket version: 8.3 cs
Host platform: x86_64-linux
Target platform: x86_64-macosx

The second command in the sequence

$ raco cross --target x86_64-macosx --remove
$ raco cross --target x86_64-macosx pkg install --auto data

fails with

...
raco setup: --- installing collections ---                         [22:02:57]
raco setup: installing: <collects>/racket
raco setup: installing: <pkgs>/gui-lib/mred
find-dir: unable to locate "lib" executable: GRacket.app/Contents/MacOS/Gracket
  context...:
   /.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/launcher/launcher.rkt:385:0: make-unix-launcher
   /.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/share/pkgs/gui-lib/mred/installer.rkt:16:0: do-installer
   /.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/setup/setup-core.rkt:926:2: do-install-part
   /.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/setup/setup.rkt:78:3
   /.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/pkg/main.rkt:17:0: setup
   body of (submod "/.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/pkg/main.rkt" main)
   /.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/raco/raco.rkt:41:0
   body of "/.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/raco/raco.rkt"
   body of "/.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/raco/main.rkt"
raco setup: installing: <pkgs>/gui-lib/racket/gui
find-dir: unable to locate "lib" executable: GRacket.app/Contents/MacOS/Gracket
  context...:
   /.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/launcher/launcher.rkt:385:0: make-unix-launcher
   /.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/share/pkgs/gui-lib/racket/gui/installer.rkt:48:0: do-installer
   /.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/setup/setup-core.rkt:926:2: do-install-part
   /.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/setup/setup.rkt:78:3
   /.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/pkg/main.rkt:17:0: setup
   body of (submod "/.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/pkg/main.rkt" main)
   /.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/raco/raco.rkt:41:0
   body of "/.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/raco/raco.rkt"
   body of "/.../.local/share/racket/raco-cross/8.3/x86_64-macosx-cs/collects/raco/main.rkt"
raco setup: installing: <pkgs>/racket-doc/help
raco setup: --- post-installing collections ---                    [22:02:57]
raco setup: --- summary of errors ---                              [22:02:57]
raco setup: error: during general install for <pkgs>/gui-lib/mred
raco setup:   find-dir: unable to locate "lib" executable: GRacket.app/Contents/MacOS/Gracket
raco setup: error: during general install for <pkgs>/gui-lib/racket/gui
raco setup:   find-dir: unable to locate "lib" executable: GRacket.app/Contents/MacOS/Gracket
raco pkg install: packages installed, although setup reported errors
raco cross: command failed

... is my home directory.

The same problem happens with the target aarch64-macosx, whereas the installation for x86_64-linux and x86_64-win32 succeeds. I'm quite sure that I haven't seen this problem in the past, so it might be an issue with changes in Racket, raco-cross or the info.rkt files in the dependency tree (or something else, of course ;-) ).

It seems that for my use case, I can continue with the incomplete installation and generate my binaries with raco cross exe afterward. However, while this is only slightly annoying locally, it's more inconvenient for the CI build environment (see https://builds.sr.ht/~sschwarzer/job/666177#task-build-all ).

raco cross error on macOS after installing linux compiler

What version of Racket are you using?
8.2 [cs]

What program did you run?

$ raco pkg install raco-cross
$ raco cross # download files for macOS target
$ raco cross --target x86_64-linux
$ raco cross

What should have happened?
raco cross should run normally.

If you got an error message, please include it here.

fasl-read: incompatible fasl-object machine-type 'ta6le found in #<binary input port bytevector>
  context...:
   body of data
   /Applications/Racket v8.2/collects/raco/raco.rkt:41:0
   body of "/Applications/Racket v8.2/collects/raco/raco.rkt"
   body of "/Applications/Racket v8.2/collects/raco/main.rkt"

Please include any other relevant details
macOS 11.4

Setup fails with 8.7 target on macOS running HEAD

My local Racket is running the latest commit. I am able to cross compile to 8.6 just fine, but 8.7 fails during initial setup as below:

raco cross --version 8.7 --target x86_64-linux pkg install threading-lib
>> Cross configuration
 Target:    x86_64-linux
 Host:      x86_64-macosx
 Version:   8.7
 VM:        cs
 Workspace: /Users/bogdan/Library/Racket/raco-cross/8.7
>> Setting up for x86_64-linux-cs
Exception: failed assertion (fx= (fx+ (length used) (length unused)) (length (app-opnds ctxt))) at line 693, char 22 of cp0.ss
integer-bytes->integer: contract violation
  expected: bytes?
  given: #<eof>
^Cuser break
  context...:
   /Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt:686:0: compile-zo*
   /Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt:627:0: compile-zo*/cross-compile
   /Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt:452:15
   /Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt:441:12: build
   /Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt:412:0: maybe-compile-zo
   /Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt:210:0: compile-root
   /Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt:1020:0: check-recompile-module-dependencies
   /Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt:686:0: compile-zo*
   /Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt:627:0: cuser breakompile-zo*/cross-compile

  context...:
   /Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt/Users/bogdan/sandbox/racket/racket/collects/racket/system.rkt:452::17415:
   0/Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt: :441do-system*/exit-code:
   12: /Users/bogdan/sandbox/racket/racket/collects/racket/system.rkt:211build:
   0: system*/Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt
   :412:0/Users/bogdan/sandbox/racket/racket/share/pkgs/raco-cross-lib/private/cross/setup.rkt: maybe-compile-zo:
   13:0/Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt: :setup-distribution210:
   0: compile-root/Users/bogdan/sandbox/racket/racket/share/pkgs/raco-cross-lib/private/cross/command.rkt
   :/Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt:2541020:4: download-and-setup:
   0.../racket/cmdline.rkt: check-recompile-module-dependencies:191
   :51/Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt: :...s/racket/cmdline.rkt:191:51
   686body of "/Users/bogdan/sandbox/racket/racket/share/pkgs/raco-cross-lib/private/cross/command.rkt"
   :0/Users/bogdan/sandbox/racket/racket/collects/raco/raco.rkt: :compile-zo*41
   :0/Users/bogdan/Library/Racket/raco-cross/8.7/x86_64-linux-cs/collects/compiler/private/cm-minimal.rkt
   :body of "/Users/bogdan/sandbox/racket/racket/collects/raco/raco.rkt"627
   :body of "/Users/bogdan/sandbox/racket/racket/collects/raco/main.rkt"
0: compile-zo*/cross-compile
   ...
make: *** [cross_setup] Error 1

Incorrect labels

Consider:

$ raco cross --workspace ~/my-workspace --version 8.1
$ raco cross --workspace ~/my-workspace pkg install --asd
>> Cross configuration
 Target:    aarch64-macosx [native]
 Host:      aarch64-macosx
 Version:   8.2
 VM:        cs
 Workspace: /Users/sorawee/my-workspace
racket pkg install: unknown switch: --asd

Two weird outputs:

  1. I expect that --version 8.1 needs not to be given for raco cross to know that in this workspace, the version is 8.1, not 8.2 (or if it's expected, perhaps it should error for the mismatch?)
  2. It should be raco pkg install rather than racket pkg install.

fasl-read: incompatible fasl-object machine-type 'ta6nt found in #<binary input port bytevector>

The error message is the same as for #3 and mflatt/raco-cross#3 , but this issue seems to be different.

The host system is Fedora Linux 34 with Racket 8.2 cs and the newest version of raco cross. (I even checked in the source code, if the change 79de835 is present.) Also, the Racket installation is set to use installation scope anyway.

I tried to narrow down the problem, but I still need my project directory from https://git.sr.ht/~sschwarzer/sudoku-solver . On the other hand, at least you don't need the makefile. :-)

Now, if I clone my repo, remove ~/.local/share/racket/raco-cross/8.2 and run this script,

$ cat reproduce_issue.sh 
#! /bin/sh

# Compiled files cause trouble if they were compiled for a different target/VM.
find . -type d -name compiled | xargs rm -rf
# Ignore uninstalled package.
raco cross --target x86_64-win32 pkg remove sudoku-solver || true
# Implicitly install dependencies.
raco cross --target x86_64-win32 pkg install --deps search-auto
raco cross --target x86_64-win32 pkg remove sudoku-solver
# If the `compiled` directories are deleted here, the `raco cross exe`
# invocation fails with
# fasl-read: incompatible fasl-object machine-type 'ta6nt found in #<binary input port bytevector>
#
# If the `compiled` directories are left alone _here_, the
# `raco cross exe` invocation generates the binary, but the _next_
# run of `reproduce_issue.sh` fails with the `fasl-read` exception.
#
# find . -type d -name compiled | xargs rm -rf
raco cross --target x86_64-win32 exe --orig-exe --embed-dlls \
    -o sudoku-solver.exe games/sudoku-solver.rkt

The Windows binary is created as expected. However, if the line find . -type d -name compiled | xargs rm -rf is commented out, the raco cross exe invocation after that line fails with

fasl-read: incompatible fasl-object machine-type 'ta6nt found in #<binary input port bytevector>
  context...:
   body of syntax-literals
   /home/schwa/.local/share/racket/raco-cross/8.2/x86_64-win32-cs/collects/compiler/embed.rkt:445:0: get-code
   [repeats 1 more time]
   /home/schwa/.local/share/racket/raco-cross/8.2/x86_64-win32-cs/collects/racket/private/map.rkt:267:2: gen-for-each
   /home/schwa/.local/share/racket/raco-cross/8.2/x86_64-win32-cs/collects/compiler/embed.rkt:1178:0: do-write-module-bundle
   /home/schwa/.local/share/racket/raco-cross/8.2/x86_64-win32-cs/collects/compiler/embed.rkt:1658:15: write-module
   /home/schwa/.local/share/racket/raco-cross/8.2/x86_64-win32-cs/collects/compiler/embed.rkt:1562:6
   /home/schwa/.local/share/racket/raco-cross/8.2/x86_64-win32-cs/share/pkgs/compiler-lib/compiler/commands/exe.rkt:100:0
   body of "/home/schwa/.local/share/racket/raco-cross/8.2/x86_64-win32-cs/share/pkgs/compiler-lib/compiler/commands/exe.rkt"
   /home/schwa/.local/share/racket/raco-cross/8.2/x86_64-win32-cs/collects/raco/raco.rkt:41:0
   body of "/home/schwa/.local/share/racket/raco-cross/8.2/x86_64-win32-cs/collects/raco/raco.rkt"
   body of "/home/schwa/.local/share/racket/raco-cross/8.2/x86_64-win32-cs/collects/raco/main.rkt"
raco cross: command failed

If the find ... command is not commented out, the next run of reproduce_issue.sh fails with the same stacktrace. The only workaround I've found is to remove ~/.local/share/racket/raco-cross/8.2 and then re-run the script (or rather the equivalent section from the Makefile).

I've tried for hours to find out what happens here, without success. It's really strange (to me) why the files under the compiled directories should be needed even after the package is removed. After all, I can run a native raco exe -o sudoku-solver-linux games/sudoku-solver.rkt (when the dependencies are installed) without needing the files under compiled.

Ideally, I'd be interested in an explanation what's going on, but I'd also be relatively content with a suggestion of a workaround that doesn't require to remove and bootstrap the target installation for each compilation. Of course, if this can be fixed in raco cross or possibly Racket, this would be even better. By the way, I'm rather sure the Makefile used to work previously, so I wonder if there's possibly a change from Racket 8.1 to 8.2 that triggers the problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.