error: unknown type size with struct sockaddr_in sa

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

error: unknown type size with struct sockaddr_in sa

Julio Carchi
Hello,

my name is Julio Carchi, and I am from Ecuador, I am trying to compile  
several things with TCC, I am using the latest rev on the mob branch of  
the repo.

This time I am compiling bftpd but in one of the files I am getting an  
error message:

commands.c:66 error: unknown type size

the line 66 is as follows:

66 struct sockaddr_in sa;

If I comment that line fails in a similar line below.

136   struct sockaddr foo;

I don't know if is a problem with TCC or incompatibility with GCC, so  
please let me know what is happening and how could I fix it.

Thanks.

--
Usando el cliente de correo de Opera: http://www.opera.com/mail/

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: error: unknown type size with struct sockaddr_in sa

Christian Jullien-3
Hello Julio,

Many thanks for your interest in tcc.

Here is a good way to reproduce your error:

struct sockaddr;  // forward and incomplete declaration of sockaddr

void bar() {
        struct sockaddr foo;
}

$ tcc -c foo.c
foo.c:4: error: unknown type size

If this is really the same source of your problem, it looks that, for one reason or another, tcc has not include the .h which contains struct sockaddr definition.

For example, changing this sample with:

#include <sys/socket.h>
// struct sockaddr;
void bar() {
        struct sockaddr foo;
}

Solves the compilation issue. If bftpd uses configure, I advise you to check ./configure log and see differences in config.h when this package is compiled with gcc and tcc. I bet they are different.
Sometimes, systems definitions rely on GCC specific macros like __GNU_something.

Tell us

M2c.

Christian

-----Original Message-----
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=[hidden email]] On Behalf Of Julio Carchi
Sent: Friday, March 27, 2020 11:47
To: [hidden email]
Subject: [Tinycc-devel] error: unknown type size with struct sockaddr_in sa

Hello,

my name is Julio Carchi, and I am from Ecuador, I am trying to compile  
several things with TCC, I am using the latest rev on the mob branch of  
the repo.

This time I am compiling bftpd but in one of the files I am getting an  
error message:

commands.c:66 error: unknown type size

the line 66 is as follows:

66 struct sockaddr_in sa;

If I comment that line fails in a similar line below.

136   struct sockaddr foo;

I don't know if is a problem with TCC or incompatibility with GCC, so  
please let me know what is happening and how could I fix it.

Thanks.

--
Usando el cliente de correo de Opera: http://www.opera.com/mail/

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: error: unknown type size with struct sockaddr_in sa

Julio Carchi
In reply to this post by Julio Carchi
Here is a paste of the config.log file

https://pastebin.com/xqmUSKpj

Seems that the ./configure script was unable to find the proper paths  
where are the include files.
--
Usando el cliente de correo de Opera: http://www.opera.com/mail/

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: error: unknown type size with struct sockaddr_in sa

Michael Matz
Hello,

On Fri, 27 Mar 2020, Julio Carchi wrote:

> Here is a paste of the config.log file
>
> https://pastebin.com/xqmUSKpj
>
> Seems that the ./configure script was unable to find the proper paths where
> are the include files.

You seem to miss the glibc-kernel interface headers, e.g.
  /usr/include/asm/socket.h.  (You do seem to have a system based on glibc,
looking at some of the error message in the above)

Can you compile this file with gcc on your system as is?

% cat checkme.c
#include <sys/socket.h>
% gcc -c checkme.c

If it doesn't work with gcc either, then you have an incomplete
installation of your basic development system and you need to fix that
first.

If it does work it might be useful to look at the output of:

% gcc -E -dD checkme.c

to see which macros are defined where for you on your system and maybe see
why it doesn't fail in the same way as with tcc.


Ciao,
Michael.

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel