Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building on macOS #14

Open
msingla403 opened this issue Feb 8, 2022 · 2 comments
Open

Building on macOS #14

msingla403 opened this issue Feb 8, 2022 · 2 comments

Comments

@msingla403
Copy link

Can we use the same Makefile to build on macOS?

The riscv64-unkown-linux-gnu- toolchain got successfully installed but I am getting below error in buildroot.

>>> host-attr 2.4.48 Building
PATH="/Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/host/bin:/Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/host/sbin:/Users/mohit/riscv-rss-sdk/toolchain/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/flex/bin:/usr/local/opt/libtool/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:/usr/local/opt/make/libexec/gnubin:/usr/local/opt/bison/bin:/usr/local/sbin:/usr/local/opt/openjdk/bin:/opt/riscv-xor-linux/bin:/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS" PKG_CONFIG="/Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/host/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_LIBDIR="/Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/host/lib/pkgconfig:/Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/host/share/pkgconfig"  /usr/local/opt/make/libexec/gnubin/make -j13  -C /Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/build/host-attr-2.4.48/
make[2]: Entering directory '/Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/build/host-attr-2.4.48'
Making all in po
make[3]: Entering directory '/Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/build/host-attr-2.4.48/po'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/build/host-attr-2.4.48/po'
make[3]: Entering directory '/Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/build/host-attr-2.4.48'
  CC       libattr/libattr_la-attr_copy_check.lo
  CC       libattr/libattr_la-attr_copy_action.lo
  CC       libattr/libattr_la-attr_copy_fd.lo
  CC       libattr/libattr_la-attr_copy_file.lo
  CC       libattr/libattr_la-libattr.lo
  CC       libattr/libattr_la-syscalls.lo
  CC       libmisc/high_water_alloc.lo
  CC       libmisc/next_line.lo
  CC       libmisc/quote.lo
  CC       libmisc/walk_tree.lo
  CC       libmisc/unquote.lo
  CC       tools/attr.o
  CC       tools/getfattr.o
tools/getfattr.c: In function 'do_getxattr':
tools/getfattr.c:85:28: error: 'lgetxattr' undeclared (first use in this function); did you mean 'fgetxattr'?
   85 |                 getxattr : lgetxattr)(path, name, value, size);
      |                            ^~~~~~~~~
      |                            fgetxattr
tools/getfattr.c:85:28: note: each undeclared identifier is reported only once for each function it appears in
tools/getfattr.c: In function 'do_listxattr':
tools/getfattr.c:91:29: error: 'llistxattr' undeclared (first use in this function); did you mean 'flistxattr'?
   91 |                 listxattr : llistxattr)(path, list, size);
      |                             ^~~~~~~~~~
      |                             flistxattr
tools/attr.c: In function 'main':
tools/attr.c:69:20: warning: implicit declaration of function 'basename' [-Wimplicit-function-declaration]
   69 |         progname = basename(argv[0]);
      |                    ^~~~~~~~
tools/attr.c:69:18: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   69 |         progname = basename(argv[0]);
      |                  ^
make[3]: *** [Makefile:964: tools/getfattr.o] Error 1
make[3]: *** Waiting for unfinished jobs....
libattr/syscalls.c: In function 'libattr_setxattr':
libattr/syscalls.c:36:24: error: '__NR_setxattr' undeclared (first use in this function); did you mean 'SYS_setxattr'?
   36 |         return syscall(__NR_setxattr, path, name, value, size, flags);
      |                        ^~~~~~~~~~~~~
      |                        SYS_setxattr
libattr/syscalls.c:36:24: note: each undeclared identifier is reported only once for each function it appears in
libattr/syscalls.c: In function 'libattr_lsetxattr':
libattr/syscalls.c:42:24: error: '__NR_lsetxattr' undeclared (first use in this function); did you mean 'SYS_setxattr'?
   42 |         return syscall(__NR_lsetxattr, path, name, value, size, flags);
      |                        ^~~~~~~~~~~~~~
      |                        SYS_setxattr
libattr/syscalls.c: In function 'libattr_fsetxattr':
libattr/syscalls.c:48:24: error: '__NR_fsetxattr' undeclared (first use in this function); did you mean 'SYS_fsetxattr'?
   48 |         return syscall(__NR_fsetxattr, filedes, name, value, size, flags);
      |                        ^~~~~~~~~~~~~~
      |                        SYS_fsetxattr
libattr/syscalls.c: In function 'libattr_getxattr':
libattr/syscalls.c:54:24: error: '__NR_getxattr' undeclared (first use in this function); did you mean 'SYS_getxattr'?
   54 |         return syscall(__NR_getxattr, path, name, value, size);
      |                        ^~~~~~~~~~~~~
      |                        SYS_getxattr
libattr/syscalls.c: In function 'libattr_lgetxattr':
libattr/syscalls.c:60:24: error: '__NR_lgetxattr' undeclared (first use in this function)
   60 |         return syscall(__NR_lgetxattr, path, name, value, size);
      |                        ^~~~~~~~~~~~~~
libattr/attr_copy_fd.c: In function 'attr_copy_fd':
libattr/attr_copy_fd.c:76:16: error: too few arguments to function 'flistxattr'
   76 |         size = flistxattr (src_fd, NULL, 0);
      |                ^~~~~~~~~~
In file included from libattr/attr_copy_fd.c:25:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:75:9: note: declared here
   75 | ssize_t flistxattr(int fd, char *namebuff, size_t size, int options);
      |         ^~~~~~~~~~
libattr/attr_copy_fd.c:92:16: error: too few arguments to function 'flistxattr'
   92 |         size = flistxattr (src_fd, names, size);
      |                ^~~~~~~~~~
In file included from libattr/attr_copy_fd.c:25:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:75:9: note: declared here
   75 | ssize_t flistxattr(int fd, char *namebuff, size_t size, int options);
      |         ^~~~~~~~~~
libattr/syscalls.c: In function 'libattr_fgetxattr':
libattr/attr_copy_file.c: In function 'attr_copy_file':
libattr/syscalls.c:66:24: error: '__NR_fgetxattr' undeclared (first use in this function); did you mean 'SYS_fgetxattr'?
   66 |         return syscall(__NR_fgetxattr, filedes, name, value, size);
      |                        ^~~~~~~~~~~~~~
      |                        SYS_fgetxattr
libattr/attr_copy_file.c:74:16: warning: implicit declaration of function 'llistxattr'; did you mean 'flistxattr'? [-Wimplicit-function-declaration]
   74 |         size = llistxattr (src_path, NULL, 0);
      |                ^~~~~~~~~~
      |                flistxattr
libattr/attr_copy_fd.c:111:24: error: too few arguments to function 'fgetxattr'
  111 |                 size = fgetxattr (src_fd, name, NULL, 0);
      |                        ^~~~~~~~~
In file included from libattr/attr_copy_fd.c:25:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:63:9: note: declared here
   63 | ssize_t fgetxattr(int fd, const char *name, void *value, size_t size, u_int32_t position, int options);
      |         ^~~~~~~~~
libattr/attr_copy_fd.c:128:24: error: too few arguments to function 'fgetxattr'
  128 |                 size = fgetxattr (src_fd, name, value, size);
      |                        ^~~~~~~~~
In file included from libattr/attr_copy_fd.c:25:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:63:9: note: declared here
   63 | ssize_t fgetxattr(int fd, const char *name, void *value, size_t size, u_int32_t position, int options);
      |         ^~~~~~~~~
libattr/attr_copy_fd.c:139:21: error: too few arguments to function 'fsetxattr'
  139 |                 if (fsetxattr (dst_fd, name, value, size, 0) != 0) {
      |                     ^~~~~~~~~
In file included from libattr/attr_copy_fd.c:25:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:67:5: note: declared here
   67 | int fsetxattr(int fd, const char *name, const void *value, size_t size, u_int32_t position, int options);
      |     ^~~~~~~~~
libattr/attr_copy_file.c:109:24: warning: implicit declaration of function 'lgetxattr'; did you mean 'fgetxattr'? [-Wimplicit-function-declaration]
  109 |                 size = lgetxattr (src_path, name, NULL, 0);
      |                        ^~~~~~~~~
      |                        fgetxattr
libattr/libattr.c: In function 'attr_get':
libattr/libattr.c:114:43: error: 'lgetxattr' undeclared (first use in this function); did you mean 'fgetxattr'?
  114 |                 flags & ATTR_DONTFOLLOW ? lgetxattr : getxattr;
      |                                           ^~~~~~~~~
      |                                           fgetxattr
libattr/libattr.c:114:43: note: each undeclared identifier is reported only once for each function it appears in
libattr/attr_copy_file.c:137:21: warning: implicit declaration of function 'lsetxattr'; did you mean 'fsetxattr'? [-Wimplicit-function-declaration]
  137 |                 if (lsetxattr (dst_path, name, value, size, 0) != 0) {
      |                     ^~~~~~~~~
      |                     fsetxattr
libattr/libattr.c: In function 'attr_getf':
libattr/libattr.c:150:21: error: too few arguments to function 'fgetxattr'
  150 |                 c = fgetxattr(fd, name, attrvalue, *valuelength);
      |                     ^~~~~~~~~
In file included from libattr/libattr.c:26:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:63:9: note: declared here
   63 | ssize_t fgetxattr(int fd, const char *name, void *value, size_t size, u_int32_t position, int options);
      |         ^~~~~~~~~
libattr/libattr.c:156:28: error: too few arguments to function 'fgetxattr'
  156 |                 int size = fgetxattr(fd, name, NULL, 0);
      |                            ^~~~~~~~~
In file included from libattr/libattr.c:26:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:63:9: note: declared here
   63 | ssize_t fgetxattr(int fd, const char *name, void *value, size_t size, u_int32_t position, int options);
      |         ^~~~~~~~~
libattr/libattr.c: In function 'attr_set':
libattr/libattr.c:186:29: warning: implicit declaration of function 'lsetxattr'; did you mean 'fsetxattr'? [-Wimplicit-function-declaration]
  186 |                         c = lsetxattr(path, name, buffer, valuelength, lflags);
      |                             ^~~~~~~~~
      |                             fsetxattr
libattr/libattr.c:188:29: error: too few arguments to function 'setxattr'
  188 |                         c = setxattr(path, name, buffer, valuelength, lflags);
      |                             ^~~~~~~~
In file included from libattr/libattr.c:26:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:65:5: note: declared here
   65 | int setxattr(const char *path, const char *name, const void *value, size_t size, u_int32_t position, int options);
      |     ^~~~~~~~
libattr/syscalls.c: In function 'libattr_listxattr':
libattr/syscalls.c:71:24: error: '__NR_listxattr' undeclared (first use in this function); did you mean 'SYS_listxattr'?
   71 |         return syscall(__NR_listxattr, path, list, size);
      |                        ^~~~~~~~~~~~~~
      |                        SYS_listxattr
libattr/libattr.c: In function 'attr_setf':
libattr/libattr.c:212:21: error: too few arguments to function 'fsetxattr'
  212 |                 c = fsetxattr(fd, name, buffer, valuelength, lflags);
      |                     ^~~~~~~~~
In file included from libattr/libattr.c:26:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:67:5: note: declared here
   67 | int fsetxattr(int fd, const char *name, const void *value, size_t size, u_int32_t position, int options);
      |     ^~~~~~~~~
libattr/libattr.c: In function 'attr_remove':
libattr/libattr.c:230:29: warning: implicit declaration of function 'lremovexattr'; did you mean 'fremovexattr'? [-Wimplicit-function-declaration]
  230 |                         c = lremovexattr(path, name);
      |                             ^~~~~~~~~~~~
      |                             fremovexattr
libattr/libattr.c:232:29: error: too few arguments to function 'removexattr'
  232 |                         c = removexattr(path, name);
      |                             ^~~~~~~~~~~
In file included from libattr/libattr.c:26:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:69:5: note: declared here
   69 | int removexattr(const char *path, const char *name, int options);
      |     ^~~~~~~~~~~
libattr/libattr.c: In function 'attr_removef':
libattr/libattr.c:249:21: error: too few arguments to function 'fremovexattr'
  249 |                 c = fremovexattr(fd, name);
      |                     ^~~~~~~~~~~~
In file included from libattr/libattr.c:26:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:71:5: note: declared here
   71 | int fremovexattr(int fd, const char *name, int options);
      |     ^~~~~~~~~~~~
libattr/libattr.c: In function 'attr_list':
libattr/libattr.c:304:26: warning: implicit declaration of function 'llistxattr'; did you mean 'flistxattr'? [-Wimplicit-function-declaration]
  304 |                 length = llistxattr(path, lbuf, sizeof(lbuf));
      |                          ^~~~~~~~~~
      |                          flistxattr
libattr/libattr.c:306:26: error: too few arguments to function 'listxattr'
  306 |                 length = listxattr(path, lbuf, sizeof(lbuf));
      |                          ^~~~~~~~~
In file included from libattr/libattr.c:26:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:73:9: note: declared here
   73 | ssize_t listxattr(const char *path, char *namebuff, size_t size, int options);
      |         ^~~~~~~~~
make[3]: *** [Makefile:1001: libattr/libattr_la-attr_copy_fd.lo] Error 1
libattr/libattr.c:317:35: warning: implicit declaration of function 'lgetxattr'; did you mean 'fgetxattr'? [-Wimplicit-function-declaration]
  317 |                         vlength = lgetxattr(path, l, NULL, 0);
      |                                   ^~~~~~~~~
      |                                   fgetxattr
libattr/libattr.c:319:36: error: too few arguments to function 'getxattr'
  319 |                         vlength =  getxattr(path, l, NULL, 0);
      |                                    ^~~~~~~~
libattr/syscalls.c: In function 'libattr_llistxattr':
In file included from libattr/libattr.c:26:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:61:9: note: declared here
   61 | ssize_t getxattr(const char *path, const char *name, void *value, size_t size, u_int32_t position, int options);
      |         ^~~~~~~~
libattr/syscalls.c:76:24: error: '__NR_llistxattr' undeclared (first use in this function); did you mean 'SYS_flistxattr'?
   76 |         return syscall(__NR_llistxattr, path, list, size);
      |                        ^~~~~~~~~~~~~~~
      |                        SYS_flistxattr
libattr/libattr.c: In function 'attr_listf':
libattr/libattr.c:353:18: error: too few arguments to function 'flistxattr'
  353 |         length = flistxattr(fd, lbuf, sizeof(lbuf));
      |                  ^~~~~~~~~~
In file included from libattr/libattr.c:26:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:75:9: note: declared here
   75 | ssize_t flistxattr(int fd, char *namebuff, size_t size, int options);
      |         ^~~~~~~~~~
libattr/libattr.c:363:27: error: too few arguments to function 'fgetxattr'
  363 |                 vlength = fgetxattr(fd, l, NULL, 0);
      |                           ^~~~~~~~~
In file included from libattr/libattr.c:26:
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/xattr.h:63:9: note: declared here
   63 | ssize_t fgetxattr(int fd, const char *name, void *value, size_t size, u_int32_t position, int options);
      |         ^~~~~~~~~
libattr/syscalls.c: In function 'libattr_flistxattr':
libattr/syscalls.c:81:24: error: '__NR_flistxattr' undeclared (first use in this function); did you mean 'SYS_flistxattr'?
   81 |         return syscall(__NR_flistxattr, filedes, list, size);
      |                        ^~~~~~~~~~~~~~~
      |                        SYS_flistxattr
libattr/syscalls.c: In function 'libattr_removexattr':
libattr/syscalls.c:86:24: error: '__NR_removexattr' undeclared (first use in this function); did you mean 'SYS_removexattr'?
   86 |         return syscall(__NR_removexattr, path, name);
      |                        ^~~~~~~~~~~~~~~~
      |                        SYS_removexattr
make[3]: *** [Makefile:1015: libattr/libattr_la-libattr.lo] Error 1
libattr/syscalls.c: In function 'libattr_lremovexattr':
libattr/syscalls.c:91:24: error: '__NR_lremovexattr' undeclared (first use in this function); did you mean 'SYS_removexattr'?
   91 |         return syscall(__NR_lremovexattr, path, name);
      |                        ^~~~~~~~~~~~~~~~~
      |                        SYS_removexattr
libattr/syscalls.c: In function 'libattr_fremovexattr':
libattr/syscalls.c:96:24: error: '__NR_fremovexattr' undeclared (first use in this function); did you mean 'SYS_fremovexattr'?
   96 |         return syscall(__NR_fremovexattr, filedes, name);
      |                        ^~~~~~~~~~~~~~~~~
      |                        SYS_fremovexattr
make[3]: *** [Makefile:1022: libattr/libattr_la-syscalls.lo] Error 1
make[3]: Leaving directory '/Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/build/host-attr-2.4.48'
make[2]: *** [Makefile:1212: all-recursive] Error 1
make[2]: Leaving directory '/Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/build/host-attr-2.4.48'
make[1]: *** [package/pkg-generic.mk:250: /Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/build/host-attr-2.4.48/.stamp_built] Error 2
make[1]: Leaving directory '/Users/mohit/riscv-rss-sdk/repo/buildroot'
make: *** [Makefile:83: /Users/mohit/riscv-rss-sdk/build/buildroot_initramfs/images/rootfs.tar] Error 2
@Phantom1003
Copy link
Member

I'm sorry I don't have a Mac on hand for testing, you can try buildroot-osx to see if it can solve your problem.

@msingla403
Copy link
Author

The buildroot has dependency on Linux headers. I got it working on a Linux virtual machine.

Leaving the issue open if anyone finds a workaround for macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants