LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Moving C code from LynxOS to Fedora8 (https://www.linuxquestions.org/questions/programming-9/moving-c-code-from-lynxos-to-fedora8-4175419376/)

User8472 07-30-2012 09:35 AM

Moving C code from LynxOS to Fedora8
 
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.

Thanks!

Wim Sturkenboom 07-30-2012 09:46 AM

If you post the error messages that you get, we might have an idea. Please post them between [code] and [/code].

DavidMcCann 07-30-2012 11:46 AM

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.

chrism01 07-30-2012 10:33 PM

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.

segmentation_fault 07-31-2012 01:08 PM

Also, what kind of c code are you talking about? It's one thing to compile "hello world\n" and a whole other to compile glibc.

User8472 08-02-2012 10:56 PM

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?

User8472 08-07-2012 08:38 AM

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.

Wim Sturkenboom 08-08-2012 12:17 PM

io block, io byte

Make your pick :) My guess is that it's specific to LynxOS or to a certain library that you have installed on the LynxOS system.

User8472 08-15-2012 09:20 AM

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.

Wim Sturkenboom 08-16-2012 12:35 AM

Sorry, can't help you further at this moment.

This question might also be better off in the programming section. I will report your post with the request to move it there.

Tinkster 08-16-2012 03:26 PM

Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves.

NevemTeve 08-16-2012 11:01 PM

Start with the warnings: in ip_com.c change these lines:
Code:

25 #include <socket.h>
26 #include <time.h>
32 #include <errno.h>



All times are GMT -5. The time now is 11:56 PM.