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

src/nix/main.cc:38:25: error: 'sockaddr_in' was not declared in this scope #3186

Closed
ghost opened this issue Oct 31, 2019 · 0 comments · Fixed by #3192
Closed

src/nix/main.cc:38:25: error: 'sockaddr_in' was not declared in this scope #3186

ghost opened this issue Oct 31, 2019 · 0 comments · Fixed by #3192

Comments

@ghost
Copy link

ghost commented Oct 31, 2019

Hi,

I'm working on packaging nix for pkgsrc, and I'm building on NetBSD 9.99.17 (which I realize is unsupported, but will eventually work on porting nix).

The build fails with this:

c++ -std=c++17 -o src/nix/main.o -c src/nix/main.cc -g -Wall -include config.h -fPIC -g -I . -I src -I src/libutil -I src/libstore -I src/libmain -I src/libexpr -I src/nix  -I/usr/pkg/include -I/usr/pkg/include /usr/pkg/include -I/usr/pkg/include /usr/include -I/usr/pkg/include -O2 -D_FORTIFY_SOURCE=2 -pthread -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/sodium -I/usr/include/krb5  -MMD -MF src/nix/.main.o.dep -MP
In file included from /usr/include/stdlib.h:37,
                 from /usr/include/g++/cstdlib:75,
                 from /usr/include/g++/bits/stl_algo.h:59,
                 from /usr/include/g++/algorithm:62,
                 from src/nix/main.cc:1:
src/nix/main.cc: In function 'bool nix::haveInternet()':
src/nix/main.cc:38:25: error: 'sockaddr_in' was not declared in this scope
             if (ntohl(((sockaddr_in *) i->ifa_addr)->sin_addr.s_addr) != INADDR_LOOPBACK) {
                         ^~~~~~~~~~~
src/nix/main.cc:38:25: note: suggested alternative: 'sockaddr'
src/nix/main.cc:38:38: error: expected primary-expression before ')' token
             if (ntohl(((sockaddr_in *) i->ifa_addr)->sin_addr.s_addr) != INADDR_LOOPBACK) {
                                      ^
src/nix/main.cc:38:40: error: expected ')' before 'i'
             if (ntohl(((sockaddr_in *) i->ifa_addr)->sin_addr.s_addr) != INADDR_LOOPBACK) {
                       ~                ^
src/nix/main.cc:40:14: error: expected ')' before '}' token
             }
              ^
              )
         } else if (i->ifa_addr->sa_family == AF_INET6) {
         ~     
In file included from /usr/include/stdlib.h:37,
                 from /usr/include/g++/cstdlib:75,
                 from /usr/include/g++/bits/stl_algo.h:59,
                 from /usr/include/g++/algorithm:62,
                 from src/nix/main.cc:1:
src/nix/main.cc:38:17: note: to match this '('
             if (ntohl(((sockaddr_in *) i->ifa_addr)->sin_addr.s_addr) != INADDR_LOOPBACK) {
                 ^~~~~
src/nix/main.cc:40:14: error: expected ')' before '}' token
             }
              ^
              )
         } else if (i->ifa_addr->sa_family == AF_INET6) {
         ~     
src/nix/main.cc:40:14: error: expected ')' before '}' token
             }
              ^
              )
         } else if (i->ifa_addr->sa_family == AF_INET6) {
         ~     
In file included from /usr/include/stdlib.h:37,
                 from /usr/include/g++/cstdlib:75,
                 from /usr/include/g++/bits/stl_algo.h:59,
                 from /usr/include/g++/algorithm:62,
                 from src/nix/main.cc:1:
src/nix/main.cc:38:17: note: to match this '('
             if (ntohl(((sockaddr_in *) i->ifa_addr)->sin_addr.s_addr) != INADDR_LOOPBACK) {
                 ^~~~~
src/nix/main.cc:40:14: error: expected ')' before '}' token
             }
              ^
              )
         } else if (i->ifa_addr->sa_family == AF_INET6) {
         ~     
src/nix/main.cc:40:14: error: expected ')' before '}' token
             }
              ^
              )
         } else if (i->ifa_addr->sa_family == AF_INET6) {
         ~     
src/nix/main.cc:38:16: note: to match this '('
             if (ntohl(((sockaddr_in *) i->ifa_addr)->sin_addr.s_addr) != INADDR_LOOPBACK) {
                ^
src/nix/main.cc:41:9: error: expected primary-expression before '}' token
         } else if (i->ifa_addr->sa_family == AF_INET6) {
         ^
src/nix/main.cc:42:42: error: 'sockaddr_in6' was not declared in this scope
             if (!IN6_IS_ADDR_LOOPBACK(&((sockaddr_in6 *) i->ifa_addr)->sin6_addr) &&
                                          ^~~~~~~~~~~~
src/nix/main.cc:42:42: note: suggested alternative: 'sockaddr'
             if (!IN6_IS_ADDR_LOOPBACK(&((sockaddr_in6 *) i->ifa_addr)->sin6_addr) &&
                                          ^~~~~~~~~~~~
                                          sockaddr
src/nix/main.cc:42:56: error: expected primary-expression before ')' token
             if (!IN6_IS_ADDR_LOOPBACK(&((sockaddr_in6 *) i->ifa_addr)->sin6_addr) &&
                                                        ^
src/nix/main.cc:42:57: error: expected ')' before 'i'
             if (!IN6_IS_ADDR_LOOPBACK(&((sockaddr_in6 *) i->ifa_addr)->sin6_addr) &&
                                        ~                ^~
                                                         )
src/nix/main.cc:44:28: error: expected ')' before ';' token
                 return true;
                            ^
                            )
src/nix/main.cc:42:16: note: to match this '('
             if (!IN6_IS_ADDR_LOOPBACK(&((sockaddr_in6 *) i->ifa_addr)->sin6_addr) &&
                ^
gmake: *** [mk/patterns.mk:3: src/nix/main.o] Error 1
gmake: *** Waiting for unfinished jobs....
g++: warning: /usr/pkg/include: linker input file unused because linking not done
g++: warning: /usr/include: linker input file unused because linking not done
In file included from /usr/include/g++/cassert:44,
                 from src/libutil/json.hh:5,
                 from src/nix/ls.cc:6:
src/libutil/json.hh: In destructor 'nix::JSONPlaceholder::~JSONPlaceholder()':
src/libutil/json.hh:173:31: warning: 'bool std::uncaught_exception()' is deprecated [-Wdeprecated-declarations]
         assert(!first || std::uncaught_exception());
                               ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/g++/ios:39,
                 from /usr/include/g++/ostream:38,
                 from /usr/include/g++/iostream:39,
                 from src/libutil/args.hh:3,
                 from src/nix/command.hh:3,
                 from src/nix/ls.cc:1:
/usr/include/g++/exception:102:8: note: declared here
   bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
        ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/g++/cassert:44,
                 from src/libutil/json.hh:5,
                 from src/nix/ls.cc:6:
src/libutil/json.hh:173:50: warning: 'bool std::uncaught_exception()' is deprecated [-Wdeprecated-declarations]
         assert(!first || std::uncaught_exception());
                                                  ^
In file included from /usr/include/g++/ios:39,
                 from /usr/include/g++/ostream:38,
                 from /usr/include/g++/iostream:39,
                 from src/libutil/args.hh:3,
                 from src/nix/command.hh:3,
                 from src/nix/ls.cc:1:
/usr/include/g++/exception:102:8: note: declared here
   bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
        ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/g++/cassert:44,
                 from src/libutil/json.hh:5,
                 from src/nix/ls.cc:6:
src/libutil/json.hh:173:50: warning: 'bool std::uncaught_exception()' is deprecated [-Wdeprecated-declarations]
         assert(!first || std::uncaught_exception());
                                                  ^
In file included from /usr/include/g++/ios:39,
                 from /usr/include/g++/ostream:38,
                 from /usr/include/g++/iostream:39,
                 from src/libutil/args.hh:3,
                 from src/nix/command.hh:3,
                 from src/nix/ls.cc:1:
/usr/include/g++/exception:102:8: note: declared here
   bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
        ^~~~~~~~~~~~~~~~~~
g++: warning: /usr/pkg/include: linker input file unused because linking not done
g++: warning: /usr/include: linker input file unused because linking not done
g++: warning: /usr/pkg/include: linker input file unused because linking not done
g++: warning: /usr/include: linker input file unused because linking not done
*** Error code 2

Stop.
make[1]: stopped in /usr/pkgsrc/wip/nix
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/wip/nix
edolstra pushed a commit that referenced this issue Jan 4, 2020
Fixes #3186

(cherry picked from commit b811bd2)
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

Successfully merging a pull request may close this issue.

0 participants