Giter Site home page Giter Site logo

Comments (6)

salamehsameera avatar salamehsameera commented on June 7, 2024 1

I just updated the description to point out to the tutorial page I was referring to. It should be https://nix.dev/tutorials/nixos/building-and-running-docker-images.

I'm on mac, and the tutorial suggests to cross compile to linux:
Screenshot 2023-12-21 at 12 54 50 PM

Here is a screenshot of the error when executing the code from the tutorial
Screenshot 2023-12-21 at 12 56 34 PM

Full error is:

these 6 derivations will be built:
  /nix/store/26bcr8wfcx4lv09rjb9ivl1y420cfqm8-jshon-20170302.drv
  /nix/store/8nr28caac7chz1c31grj7czn59cw90z3-hello-x86_64-unknown-linux-musl-2.12.1.drv
  /nix/store/cfarcfgic55nf1g2ahaf0x2fmvys371a-hello-docker-config.json.drv
  /nix/store/86yi7zkjpcxp2syr17c64r6w6r9cczfb-docker-layer-hello-docker.drv
  /nix/store/x6mhgpvqgj8kp97la682yjx0b46p3rd1-runtime-deps.drv
  /nix/store/nlvyp9f3gbhavi0qqdnby8h9carxifsf-docker-image-hello-docker.tar.gz.drv
these 2 paths will be fetched (0.02 MiB download, 0.11 MiB unpacked):
  /nix/store/5pnq935mmp8b13sbnq99yvqvvv54j4gr-stdenv-darwin
  /nix/store/j5hdavfzx22avjg2d9zjk1c6ydscxcsa-x86_64-unknown-linux-musl-gcc-wrapper-12.3.0
warning: Ignoring setting 'auto-allocate-uids' because experimental feature 'auto-allocate-uids' is not enabled
warning: Ignoring setting 'impure-env' because experimental feature 'configurable-impure-env' is not enabled
building '/nix/store/26bcr8wfcx4lv09rjb9ivl1y420cfqm8-jshon-20170302.drv'...
copying path '/nix/store/j5hdavfzx22avjg2d9zjk1c6ydscxcsa-x86_64-unknown-linux-musl-gcc-wrapper-12.3.0' from 'https://cache.nixos.org'...
copying path '/nix/store/5pnq935mmp8b13sbnq99yvqvvv54j4gr-stdenv-darwin' from 'https://cache.nixos.org'...
unpacking sources
unpacking source archive /nix/store/6qrdq6xjpycpwjj39xxww6gzg9biqifl-source
source root is source
patching sources
applying patch /nix/store/65ychbjyrl6md08s2zskzfn7cgwl4bnn-96b4e9dbf578be7b31f29740b608aa7b34df3318.patch
patching file jshon.c
configuring
no configure script, doing nothing
building
build flags: SHELL=/nix/store/0ly5lpwanagc5qpmnqrw8aqxb4ivw7kf-bash-5.2-p15/bin/bash
clang -std=c99 -Wall -pedantic -Wextra -Werror    -c -o jshon.o jshon.c
jshon.c:189:25: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
json_t** stack_safe_peek()
                        ^
                         void
jshon.c:222:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
mapping* map_safe_peek()
                      ^
                       void
jshon.c:229:13: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void MAPPUSH()
            ^
             void
jshon.c:251:13: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void MAPNEXT()
            ^
             void
jshon.c:276:12: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void MAPPOP()
           ^
            void
jshon.c:846:15: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void debug_map()
              ^
               void
6 errors generated.
make: *** [<builtin>: jshon.o] Error 1
error: builder for '/nix/store/26bcr8wfcx4lv09rjb9ivl1y420cfqm8-jshon-20170302.drv' failed with exit code 2;
       last 10 log lines:
       > jshon.c:276:12: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
       > void MAPPOP()
       >            ^
       >             void
       > jshon.c:846:15: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
       > void debug_map()
       >               ^
       >                void
       > 6 errors generated.
       > make: *** [<builtin>: jshon.o] Error 1
       For full logs, run 'nix-store -l /nix/store/26bcr8wfcx4lv09rjb9ivl1y420cfqm8-jshon-20170302.drv'.
error: 1 dependencies of derivation '/nix/store/nlvyp9f3gbhavi0qqdnby8h9carxifsf-docker-image-hello-docker.tar.gz.drv' failed to build

from nix.dev.

fricklerhandwerk avatar fricklerhandwerk commented on June 7, 2024

Thanks for reporting. There is a highlight box saying

macOS/Darwin is a special case, as not the whole OS is open-source. It’s only possible to cross compile between aarch64-darwin and x86_64-darwin. aarch64-darwin support was recently added, so cross compilation is barely tested.

We should probably point that out more clearly.

The whole point of cross compilation (and much of Nix) is exactly that one doesn't need virtual machines, but that recent macOS work in fact allows using VMs transparently. @olafklingt I can imagine we could provide simple VM instructions for macOS, most of that is already in place, right?

from nix.dev.

salamehsameera avatar salamehsameera commented on June 7, 2024

@fricklerhandwerk sorry I can't even find that part in the tutorial. Can you please screenshot it / point it out with a link?

from nix.dev.

olafklingt avatar olafklingt commented on June 7, 2024

@salamehsameera which architecture are you on? you can find the mentioned comment here Can you describe in detail what is not working? I am not on mac-os so i don't know the pitfalls yet.

from nix.dev.

fricklerhandwerk avatar fricklerhandwerk commented on June 7, 2024

@salamehsameera oh sorry, I made a mistake and looked at the linked article, as @olafklingt noted: https://nix.dev/tutorials/cross-compilation What I wanted to say is that the instruction to do cross compilation may not actually work, as the note on that other page suggests. Both pages were not actively maintained until you asked.

Please show what exactly you did (post the expressions you used and the commands you ran), otherwise we can't help figuring it out.

from nix.dev.

karlhepler avatar karlhepler commented on June 7, 2024

I tried something similar, except with my own cross-compiled binary, and got exactly the same error. MacOS Sonoma 14.5 on Apple M2 Pro.

from nix.dev.

Related Issues (20)

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.