Giter Site home page Giter Site logo

Compilation problem about iim HOT 4 CLOSED

c00kiemon5ter avatar c00kiemon5ter commented on August 20, 2024
Compilation problem

from iim.

Comments (4)

c00kiemon5ter avatar c00kiemon5ter commented on August 20, 2024

hmm, I cannot see any reason for these errors.
Are you sure the code is clean and not tampered?

The following should just work:

git clone https://github.com/c00kiemon5ter/iim.git iim-test
cd iim-test
make iim CFLAGS="-std=c99 -Os -Wall -Wextra -pedantic"

you can also check with clang using
(I made a small change today, to keep latest clang happy)

make iim CC="clang" CFLAGS="-std=c99 -Os -Wall -Wextra -pedantic"

If this works, you should have an executable named iim.
If this goes well, then I guess the (AUR) package is faulty.

Try this and tell me if I need to look into it further.

Thanks ;)

from iim.

shapeshed avatar shapeshed commented on August 20, 2024

I get errors with both options

gcc (GCC) 6.1.1 20160802
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

clang version 3.8.1 (tags/RELEASE_381/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

gcc

cc -std=c99 -Os -Wall -Wextra -pedantic    iim.c   -o iim
iim.c: In function ‘connect_to_irc’:
iim.c:69:9: error: variable ‘hints’ has initializer but incomplete type
  struct addrinfo *res = NULL, hints = {0};
         ^~~~~~~~
iim.c:69:40: warning: excess elements in struct initializer
  struct addrinfo *res = NULL, hints = {0};
                                        ^
iim.c:69:40: note: (near initialization for ‘hints’)
iim.c:69:31: error: storage size of ‘hints’ isn’t known
  struct addrinfo *res = NULL, hints = {0};
                               ^~~~~
iim.c:76:6: warning: implicit declaration of function ‘getaddrinfo’ [-Wimplicit-function-declaration]
  if (getaddrinfo(host, port, &hints, &res) != 0) return false;
      ^~~~~~~~~~~
iim.c:78:45: error: dereferencing pointer to incomplete type ‘struct addrinfo’
  for (struct addrinfo *ai = res; ai; ai = ai->ai_next) {
                                             ^~
iim.c:84:11: warning: implicit declaration of function ‘freeaddrinfo’ [-Wimplicit-function-declaration]
  if (res) freeaddrinfo(res);
           ^~~~~~~~~~~~
iim.c:69:31: warning: unused variable ‘hints’ [-Wunused-variable]
  struct addrinfo *res = NULL, hints = {0};
                               ^~~~~
make: *** [<builtin>: iim] Error 1

clang

clang -std=c99 -Os -Wall -Wextra -pedantic    iim.c   -o iim
iim.c:69:31: error: variable has incomplete type 'struct addrinfo'
        struct addrinfo *res = NULL, hints = {0};
                                     ^
iim.c:69:9: note: forward declaration of 'struct addrinfo'
        struct addrinfo *res = NULL, hints = {0};
               ^
iim.c:76:6: warning: implicit declaration of function 'getaddrinfo' is invalid in C99 [-Wimplicit-function-declaration]
        if (getaddrinfo(host, port, &hints, &res) != 0) return false;
            ^
iim.c:78:45: error: incomplete definition of type 'struct addrinfo'
        for (struct addrinfo *ai = res; ai; ai = ai->ai_next) {
                                                 ~~^
iim.c:69:9: note: forward declaration of 'struct addrinfo'
        struct addrinfo *res = NULL, hints = {0};
               ^
iim.c:79:25: error: incomplete definition of type 'struct addrinfo'
                if ((ircfd = socket(ai->ai_family, ai->ai_socktype, 0)) == -1) continue;
                                    ~~^
iim.c:69:9: note: forward declaration of 'struct addrinfo'
        struct addrinfo *res = NULL, hints = {0};
               ^
iim.c:79:40: error: incomplete definition of type 'struct addrinfo'
                if ((ircfd = socket(ai->ai_family, ai->ai_socktype, 0)) == -1) continue;
                                                   ~~^
iim.c:69:9: note: forward declaration of 'struct addrinfo'
        struct addrinfo *res = NULL, hints = {0};
               ^
iim.c:80:36: error: incomplete definition of type 'struct addrinfo'
                if ((success = connect(ircfd, res->ai_addr, res->ai_addrlen) == 0)) break;
                                              ~~~^
iim.c:69:9: note: forward declaration of 'struct addrinfo'
        struct addrinfo *res = NULL, hints = {0};
               ^
iim.c:80:50: error: incomplete definition of type 'struct addrinfo'
                if ((success = connect(ircfd, res->ai_addr, res->ai_addrlen) == 0)) break;
                                                            ~~~^
iim.c:69:9: note: forward declaration of 'struct addrinfo'
        struct addrinfo *res = NULL, hints = {0};
               ^
iim.c:84:11: warning: implicit declaration of function 'freeaddrinfo' is invalid in C99 [-Wimplicit-function-declaration]
        if (res) freeaddrinfo(res);
                 ^
2 warnings and 6 errors generated.
make: *** [<builtin>: iim] Error 1

from iim.

c00kiemon5ter avatar c00kiemon5ter commented on August 20, 2024

The easy workaround is to #define _GNU_SOURCE instead of #define _POSIX_SOURCE
or try it in the command line with

make iim CFLAGS="-D_GNU_SOURCE -std=c99 -Os -Wall -Wextra -pedantic"

(notice the -D_GNU_SOURCE part)

That should fix it for now - I'll look into it further, later.

from iim.

shapeshed avatar shapeshed commented on August 20, 2024

Thanks! Can confirm this resolves the issue.

Thank you for creating iim too. I really enjoy using it!

from iim.

Related Issues (6)

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.