Programming This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
07-30-2012, 09:35 AM
|
#1
|
|
LQ Newbie
Registered: Aug 2011
Posts: 6
Rep: 
|
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!
|
|
|
|
07-30-2012, 09:46 AM
|
#2
|
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,780
|
If you post the error messages that you get, we might have an idea. Please post them between [code] and [/code].
|
|
|
1 members found this post helpful.
|
07-30-2012, 11:46 AM
|
#3
|
|
Senior Member
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 2,229
|
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.
|
|
|
|
07-30-2012, 10:33 PM
|
#4
|
|
Guru
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.4, Centos 5.9
Posts: 14,938
|
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.
|
|
|
|
07-31-2012, 01:08 PM
|
#5
|
|
Member
Registered: Sep 2008
Location: Ioannina, Greece
Distribution: Gentoo
Posts: 314
Rep:
|
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.
|
|
|
|
08-02-2012, 10:56 PM
|
#6
|
|
LQ Newbie
Registered: Aug 2011
Posts: 6
Original Poster
Rep: 
|
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?
|
|
|
|
08-07-2012, 08:38 AM
|
#7
|
|
LQ Newbie
Registered: Aug 2011
Posts: 6
Original Poster
Rep: 
|
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.
|
|
|
|
08-08-2012, 12:17 PM
|
#8
|
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,780
|
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.
|
|
|
|
08-15-2012, 09:20 AM
|
#9
|
|
LQ Newbie
Registered: Aug 2011
Posts: 6
Original Poster
Rep: 
|
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.
|
|
|
|
08-16-2012, 12:35 AM
|
#10
|
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,780
|
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.
|
|
|
|
08-16-2012, 03:26 PM
|
#11
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,902
|
Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves.
|
|
|
|
08-16-2012, 11:01 PM
|
#12
|
|
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,034
|
Start with the warnings: in ip_com.c change these lines:
Code:
25 #include <socket.h>
26 #include <time.h>
32 #include <errno.h>
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:32 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|