Code Monkey home page Code Monkey logo

Comments (21)

LK4D4 avatar LK4D4 commented on May 23, 2024

@vielmetti Did you set your GOPATH to /Users/emv?

from runc.

chmouel avatar chmouel commented on May 23, 2024

I have the same issue on linux and i did setup my GOPATH as well

from runc.

pims avatar pims commented on May 23, 2024

Different error on OS X Yosemite:

cd runc/
tim@home /go/src/github.com/opencontainers/runc> make
go get github.com/tools/godep
godep go build -o runc .
# github.com/opencontainers/runc/libcontainer/configs
libcontainer/configs/namespaces.go:5: undefined: Namespace
# github.com/opencontainers/runc/libcontainer/nsenter
libcontainer/nsenter/nsexec.c:8:10: fatal error: 'linux/limits.h' file not found
godep: go exit status 2
make: *** [all] Error 1

from runc.

krobertson avatar krobertson commented on May 23, 2024

Since runc does the containerization directly, I believe it is only intended to be built/ran on Linux.

from runc.

LK4D4 avatar LK4D4 commented on May 23, 2024

I'm pretty sure it should build on MacOS and FreeBSD.

from runc.

AndrewVos avatar AndrewVos commented on May 23, 2024

Looks like libcontainers hasn't been vendored?

[~/runc] master ∞ ls Godeps/_workspace/src/github.com/opencontainers
ls: cannot access Godeps/_workspace/src/github.com/opencontainers: No such file or directory

from runc.

AndrewVos avatar AndrewVos commented on May 23, 2024

Install instructions should probably be:

go get github.com/opencontainers/runc
cd $GOPATH/src/github.com/opencontainers/runc
make

from runc.

vielmetti avatar vielmetti commented on May 23, 2024

+1 to @AndrewVos who got me closer with his install instructions. Again on Mac OS X 10.9, some progress:

Edwards-MacBook-Air:runc emv$ go get github.com/opencontainers/runc
# github.com/opencontainers/runc/libcontainer/configs
../github.com/opencontainers/runc/libcontainer/configs/namespaces.go:5: undefined: Namespace
# github.com/opencontainers/runc/libcontainer/nsenter
../github.com/opencontainers/runc/libcontainer/nsenter/nsexec.c:8:10: fatal error: 'linux/limits.h' file not found
Edwards-MacBook-Air:runc emv$ cd $GOPATH/src/github.com/opencontainers/runc
Edwards-MacBook-Air:runc emv$ make
go get github.com/tools/godep
godep go build -o runc .
# github.com/opencontainers/runc/libcontainer/configs
libcontainer/configs/namespaces.go:5: undefined: Namespace
# github.com/opencontainers/runc/libcontainer/nsenter
libcontainer/nsenter/nsexec.c:8:10: fatal error: 'linux/limits.h' file not found
godep: go exit status 2
make: *** [all] Error 1

at least that suggests where a change might be made.

from runc.

vielmetti avatar vielmetti commented on May 23, 2024

And digging a little deeper, when I patch so that I do

#include <limits.h>

instead of including linux/limits.h, I discover that this all depends on the clone(2) syscall which Darwin does not have. Not sure that there's an easy way around that on OS X without delving way deeper into kernel space that I don't pretend to understand.

http://linux.die.net/man/2/clone is a man page.

from runc.

vincepri avatar vincepri commented on May 23, 2024

Same thing happens on OSX 10.10.3

# github.com/opencontainers/runc/libcontainer/configs
libcontainer/configs/namespaces.go:5: undefined: Namespace
# github.com/opencontainers/runc/libcontainer/nsenter
libcontainer/nsenter/nsexec.c:8:10: fatal error: 'linux/limits.h' file not found
godep: go exit status 2
make: *** [all] Error 1

from runc.

didip avatar didip commented on May 23, 2024

@vielmetti is onto something here.
It should be #include <limits.h> because on OS X Yosemite that file is located here:

/Library/Developer/CommandLineTools/usr/lib/clang/6.1.0/include/limits.h

Once I changed the include to limits.h, I got different errors:

make
go get github.com/tools/godep
godep go build -o runc .
# github.com/opencontainers/runc/libcontainer/configs
libcontainer/configs/namespaces.go:5: undefined: Namespace
# github.com/opencontainers/runc/libcontainer/nsenter
libcontainer/nsenter/nsexec.c:61:10: warning: implicit declaration of function 'clone' is invalid in C99 [-Wimplicit-function-declaration]
libcontainer/nsenter/nsexec.c:61:42: error: use of undeclared identifier 'CLONE_PARENT'
libcontainer/nsenter/nsexec.c:135:7: warning: implicit declaration of function 'setns' is invalid in C99 [-Wimplicit-function-declaration]
libcontainer/nsenter/nsexec.c:154:8: warning: implicit declaration of function 'dup3' is invalid in C99 [-Wimplicit-function-declaration]
godep: go exit status 2
make: *** [all] Error 1

Going further down the rabbit hole, I added the following:

int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ... /* pid_t *ptid, struct user_desc *tls, pid_t *ctid */ );
int setns(int fd, int nstype);
int dup3(int oldfd, int newfd, int flags);

#if __APPLE__
#define CLONE_PARENT 0
#endif

Which leads me to this error:

Undefined symbols for architecture x86_64:
  "_clone", referenced from:
      _clone_parent in nsexec.o
  "_dup3", referenced from:
      _nsexec in nsexec.o
  "_setns", referenced from:
      _nsexec in nsexec.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Funny that https://github.com/docker/libcontainer does not have the same problem even though the code looks identical.

from runc.

exaexa avatar exaexa commented on May 23, 2024

On linux (debian jessie), the exact reported error is fixed by using:

GOPATH=$PWD PATH=$PWD/bin:$PATH  make
#wait for it to fail, fixup dependencies
mkdir -p src/github.com/opencontainers/runc/
ln -sf $PWD/libcontainer src/github.com/opencontainers/runc/
GOPATH=$PWD PATH=$PWD/bin:$PATH  make
#works now

I think this is preferred for not using systemwide Go dependencies.

from runc.

collinanderson avatar collinanderson commented on May 23, 2024

the above snippet fixed the problem for me.

from runc.

ggiamarchi avatar ggiamarchi commented on May 23, 2024

Using godep the build is straightforward (tested on Ubuntu 14.04).

go get github.com/tools/godep
godep get github.com/opencontainers/runc
cd $GOPATH/src/github.com/opencontainers/runc
make

from runc.

alfonsodev avatar alfonsodev commented on May 23, 2024

@collinanderson fixed it on Mac OS ? from which folder do you run those lines ?

from runc.

collinanderson avatar collinanderson commented on May 23, 2024

This was linux. I ran it from the runc git checkout. @ggiamarchi's snippet looks promising too.

from runc.

alfonsodev avatar alfonsodev commented on May 23, 2024

unfortunately @ggiamarchi's snippet fails in mac (Mac OS 10.10.2)

godep get github.com/opencontainers/runc
# github.com/opencontainers/runc/libcontainer/configs
libcontainer/configs/namespaces.go:5: undefined: Namespace
# github.com/opencontainers/runc/libcontainer/nsenter
libcontainer/nsenter/nsexec.c:8:10: fatal error: 'linux/limits.h' file not found
godep: go exit status 2
godep: exit status 1

from runc.

maxkueng avatar maxkueng commented on May 23, 2024

Using make or manually running the commands in the Makefile also didn't work for me on Arch Linux and also in a golang:latest Docker container with the GOPATH set properly. But @exaexa 's snippet works.

from runc.

rajasec avatar rajasec commented on May 23, 2024

even in Linux, for runc and libcontainers to be compiled vendor list need to be pulled.

from runc.

mattfarina avatar mattfarina commented on May 23, 2024

I wouldn't expect it to build on Mac because the spec won't exist there. spec.go is an interface. The only implementation is spec_linux.go which only builds on linux.

from runc.

pushrax avatar pushrax commented on May 23, 2024

The documentation should be updated and this issue closed - it makes no sense to build this on OS X (yet).

from runc.

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.