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

struct errors in socket.c from idevicerestore #319

Closed
Merculous opened this issue Apr 26, 2020 · 5 comments
Closed

struct errors in socket.c from idevicerestore #319

Merculous opened this issue Apr 26, 2020 · 5 comments

Comments

@Merculous
Copy link

Merculous commented Apr 26, 2020

Ubuntu 18.04.4
libipatcher: yes (32 and 64)

Before, I had to add the header "<linux/limits.h>" to ipsw.c also in idevicerestore.

If this may cause any issues later on, I do have liboffsetfinder64 compiled without mach-o related functions.

socket.c: In function ‘socket_connect_unix’:
socket.c:131:7: warning: implicit declaration of function ‘S_ISSOCK’; did you mean ‘S_ISLNK’? [-Wimplicit-function-declaration]
  if (!S_ISSOCK(fst.st_mode)) {
       ^~~~~~~~
       S_ISLNK
socket.c: In function ‘socket_connect’:
socket.c:236:18: error: storage size of ‘hints’ isn’t known
  struct addrinfo hints;
                  ^~~~~
socket.c:260:30: error: invalid application of ‘sizeof’ to incomplete type ‘struct addrinfo’
  memset(&hints, '\0', sizeof(struct addrinfo));
                              ^~~~~~
socket.c:268:8: warning: implicit declaration of function ‘getaddrinfo’ [-Wimplicit-function-declaration]
  res = getaddrinfo(addr, portstr, &hints, &result);
        ^~~~~~~~~~~
socket.c:270:54: warning: implicit declaration of function ‘gai_strerror’; did you mean ‘strerror’? [-Wimplicit-function-declaration]
   fprintf(stderr, "%s: getaddrinfo: %s\n", __func__, gai_strerror(res));
                                                      ^~~~~~~~~~~~
                                                      strerror
socket.c:270:38: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat=]
   fprintf(stderr, "%s: getaddrinfo: %s\n", __func__, gai_strerror(res));
                                     ~^               ~~~~~~~~~~~~~~~~~
                                     %d
socket.c:274:39: error: dereferencing pointer to incomplete type ‘struct addrinfo’
  for (rp = result; rp != NULL; rp = rp->ai_next) {
                                       ^~
socket.c:320:2: warning: implicit declaration of function ‘freeaddrinfo’ [-Wimplicit-function-declaration]
  freeaddrinfo(result);
  ^~~~~~~~~~~~
Makefile:731: recipe for target 'libidevicerestore_la-socket.lo' failed
make[4]: *** [libidevicerestore_la-socket.lo] Error 1
make[4]: Leaving directory '/home/merculous/Documents/futurerestore/external/idevicerestore/src'
Makefile:435: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/merculous/Documents/futurerestore/external/idevicerestore'
Makefile:367: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/home/merculous/Documents/futurerestore/external/idevicerestore'
Makefile:427: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/merculous/Documents/futurerestore'
Makefile:359: recipe for target 'all' failed
make: *** [all] Error 2

@Merculous
Copy link
Author

Ok, I thought I fixed it but I'm still getting this error.

@Merculous Merculous reopened this May 1, 2020
@Merculous
Copy link
Author

Found a fix. At this page adding "#define _POSIX_C_SOURCE 200112L" to socket.c in devicerestore fixed it.

@Merculous
Copy link
Author

Merculous commented May 1, 2020

So, in conclusion, not sure if these are the exact needed headers but adding the headers below will then compile:
<linux/limits.h> in ipsw.c
"#define _POSIX_C_SOURCE 200112L" in socket.c
Add these to idevicerestore in "external/idevicerestore/src"

@lpuv
Copy link

lpuv commented Aug 26, 2021

@Merculous it doesn't work anymore ):

@Merculous
Copy link
Author

This is fixed with the changes mentioned in #302. That will make it compile. This wasn't a good fix and the pr referenced is the correct way of doing it.

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