ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to move a lot of C code from a LynxOS system to a Fedora 8 system, but I am getting a lot of errors when I try to compile the files on Fedora.
Other than moving the source and makefiles I am not sure what to do - I copied everything that was on the LynxOS system to the Fedora system and moved the C files to the proper locations. The Fedora system does have a C compiler, so it should be able to compile the C files - are there maybe some other files unique to LynxOS that I might need? Or is there some way the C files need to be edited?
Please let me know if you have any suggestions that may help.
Do you really have Fedora 8? That was released in 2007 and all support discontinued at the end of 2008. Using an older compiler may cause problems.
Apart from that, there may be discrepancies in the naming of libraries between the two OS: programming languages are not as standardised as one thinks. As Wim says, tell us exactly what the problems are.
As per post#3, I'd get a current(!) distro eg Fedora 17 if you want Fedora, and just copy over only the C src files, then install the C compiler from the Fedora 17 repo and start from there.
Unfortunately newer versions of Fedora will not work on the hardware I have, so I must use Fedora 8.
Also, this is specialized code designed for data acquisition.
I realized that there were some files I did not copy, and now that has fixed most of the errors, however, when I copied the .a libraries, it could not read them (that is now the only compilation error), so I will need to rebuild them. Now I think I know what needs to go in them, but how would I go about creating .a library files on Fedora?
I have continued to work on this, and have run into the following errors while trying to compile a group of c files using a makefile:
Code:
gcc -o ./maigret ./maigret.o -L. -lmaigret
./maigret.o: In function `dir':
maigret.c:(.text+0x25): undefined reference to `__iob'
maigret.c:(.text+0x53): undefined reference to `__iob'
maigret.c:(.text+0x144): undefined reference to `__iob'
maigret.c:(.text+0x182): undefined reference to `__iob'
maigret.c:(.text+0x1c1): undefined reference to `__iob'
./maigret.o:maigret.c:(.text+0x1ff): more undefined references to `__iob' follow
collect2: ld returned 1 exit status
What is this `__iob' error? this string does not exist in any of the source files, and I have no idea how to fix it.
Thanks - I've been looking at that, and now I'm trying to compile a different library for managing sockets.
But when I try to compile it, I get all these errors:
Code:
gcc -I. -c -O2 -o ./ip_com.o ./ip_com.c
In file included from ./ip_com.c:25:
/usr/include/sys/socket.h:21:2: warning: #warning Using <socket.h> instead of <sys/socket.h>
In file included from ./ip_com.c:26:
/usr/include/sys/time.h:21:2: warning: #warning Using <time.h> instead of <sys/time.h>
In file included from ./ip_com.c:32:
/usr/include/sys/errno.h:21:2: warning: #warning Using <errno.h> instead of <sys/errno.h>
In file included from ./ip_com.c:29:
/usr/include/netinet/in.h:219: error: expected specifier-qualifier-list before ‘__SOCKADDR_COMMON’
/usr/include/netinet/in.h:233: error: expected specifier-qualifier-list before ‘__SOCKADDR_COMMON’
/usr/include/netinet/in.h:281: error: field ‘gr_group’ has incomplete type
/usr/include/netinet/in.h:290: error: field ‘gsr_group’ has incomplete type
/usr/include/netinet/in.h:293: error: field ‘gsr_source’ has incomplete type
/usr/include/netinet/in.h:325: error: field ‘gf_group’ has incomplete type
/usr/include/netinet/in.h:333: error: array type has incomplete element type
In file included from ./ip_com.c:29:
/usr/include/netinet/in.h: In function ‘ntohl’:
/usr/include/netinet/in.h:352: error: expected declaration specifiers before ‘__THROW’
/usr/include/netinet/in.h:354: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__THROW’
/usr/include/netinet/in.h:356: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__THROW’
/usr/include/netinet/in.h:358: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__THROW’
In file included from ./ip_com.c:29:
/usr/include/netinet/in.h:426: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__THROW’
/usr/include/netinet/in.h:430: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__THROW’
In file included from ./ip_com.c:30:
/usr/include/netdb.h:86: error: storage class specified for parameter ‘gethostbyname’
/usr/include/netdb.h:87: error: storage class specified for parameter ‘gethostbyaddr’
/usr/include/netdb.h:88: error: storage class specified for parameter ‘gethostent’
/usr/include/netdb.h:89: error: storage class specified for parameter ‘getnetbyname’
/usr/include/netdb.h:90: error: storage class specified for parameter ‘getnetbyaddr’
/usr/include/netdb.h:91: error: storage class specified for parameter ‘getnetent’
/usr/include/netdb.h:92: error: storage class specified for parameter ‘getservbyname’
/usr/include/netdb.h:93: error: storage class specified for parameter ‘getservbyport’
/usr/include/netdb.h:94: error: storage class specified for parameter ‘getservent’
/usr/include/netdb.h:95: error: storage class specified for parameter ‘getprotobyname’
/usr/include/netdb.h:96: error: storage class specified for parameter ‘getprotobynumber’
/usr/include/netdb.h:97: error: storage class specified for parameter ‘getprotoent’
/usr/include/netdb.h:112: error: storage class specified for parameter ‘_h_errno’
In file included from ./ip_com.c:31:
/usr/include/sys/file.h:239: error: storage class specified for parameter ‘findpath’
/usr/include/sys/file.h:240: error: storage class specified for parameter ‘flock’
In file included from /usr/include/sys/errno.h:26,
from ./ip_com.c:33:
/usr/include/errno.h:258: error: storage class specified for parameter ‘_errno’
/usr/include/errno.h:261: error: storage class specified for parameter ‘_errno’
/usr/include/errno.h:261: error: redefinition of parameter ‘_errno’
/usr/include/errno.h:258: error: previous definition of ‘_errno’ was here
In file included from /usr/include/malloc.h:23,
from ./ip_com.c:34:
/usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h:152: error: storage class specified for parameter ‘ptrdiff_t’
/usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h:326: error: storage class specified for parameter ‘wchar_t’
In file included from ./ip_com.c:34:
/usr/include/malloc.h:30: error: storage class specified for parameter ‘malloc’
/usr/include/malloc.h:31: error: storage class specified for parameter ‘calloc’
/usr/include/malloc.h:32: error: storage class specified for parameter ‘realloc’
/usr/include/malloc.h:33: error: storage class specified for parameter ‘free’
In file included from ./ip_com.c:35:
./ip_com.h:75: warning: empty declaration
./ip_com.h:79: error: storage class specified for parameter ‘report_errors’
./ip_com.h:81: error: storage class specified for parameter ‘init_socket_parms’
./ip_com.h:84: error: storage class specified for parameter ‘init_socket’
./ip_com.h:107: error: storage class specified for parameter ‘accept_socket’
./ip_com.h:118: error: storage class specified for parameter ‘connect_socket’
./ip_com.h:122: error: storage class specified for parameter ‘close_socket’
./ip_com.h:127: error: storage class specified for parameter ‘nslookup’
./ip_com.h:131: error: storage class specified for parameter ‘nsaliases’
./ip_com.h:134: error: storage class specified for parameter ‘isip’
./ip_com.h:137: error: storage class specified for parameter ‘block_socket’
./ip_com.h:140: error: storage class specified for parameter ‘noblock_socket’
./ip_com.h:143: error: storage class specified for parameter ‘raw_read’
./ip_com.h:148: error: storage class specified for parameter ‘probe_read_socket’
./ip_com.c:36: error: parameter ‘report_errors’ is initialized
./ip_com.c:36: error: redefinition of parameter ‘report_errors’
./ip_com.h:79: error: previous definition of ‘report_errors’ was here
./ip_com.c:38: error: redefinition of parameter ‘init_socket’
./ip_com.h:84: error: previous definition of ‘init_socket’ was here
./ip_com.c:39: error: redefinition of parameter ‘close_socket’
./ip_com.h:122: error: previous definition of ‘close_socket’ was here
./ip_com.c:40: error: redefinition of parameter ‘nslookup’
./ip_com.h:127: error: previous definition of ‘nslookup’ was here
./ip_com.c:41: error: redefinition of parameter ‘nsaliases’
./ip_com.h:131: error: previous definition of ‘nsaliases’ was here
./ip_com.c:42: error: redefinition of parameter ‘isip’
./ip_com.h:134: error: previous definition of ‘isip’ was here
./ip_com.c:46: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./ip_com.c:71: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./ip_com.c:169: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./ip_com.c:187: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./ip_com.c:215: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./ip_com.c:268: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./ip_com.c:310: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./ip_com.c:317: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./ip_com.c:323: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./ip_com.c:329: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./ip_com.c:386: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./ip_com.c:417: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./ip_com.c:433: error: old-style parameter declarations in prototyped function definition
./ip_com.c:433: error: expected ‘{’ at end of input
make: *** [ip_com.o] Error 1
Can anyone make sense of that? it looks like it is having trouble with system code that should work already.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.