LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 06-30-2009, 04:46 AM   #1
eljuventino
LQ Newbie
 
Registered: May 2009
Posts: 26
Blog Entries: 1

Rep: Reputation: 15
gcc and xlc


hi everyone!!i'm very happy to be one of the most great linux forums in the world and thanks for all great work that u do here!!
i'm new to linux i have some basic but still newer!!i have a project that i work on!!it's a product that has been installed and compiled in AIX system with xlc compiler!!my job here is to migrate this one to red hat linux entreprise 5 and compile all the makefile with GCC
i'l traying to do the max to find a similarity between xlc and gcc but i'm stuck in one or two option that i can't figure out the solution specially -D option
there is one example of makefile that i do compile but with using the line that contains -D option:
gcc -c -DAIX41_OPSYS -I/home/oracle/Open2/COMMON/inc -I/home/oracle/Open2/dbg -DSYSV -D_NO_LONGLONG -I../inc -g -g -c afp_dump.c
i’m gratful if someone help me resolve this !!
 
Old 06-30-2009, 06:24 AM   #2
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
Hello,
the -D option tells to GCC preprocessor to define the symbol next to it, so in the given line afp_dump.c is compiled with the AIX41_OPSYS symbol defined, as if you've add "define AIX41_OPSYS" in the file.
There is strange things in the line I can see: -g and -c options appear twice, that certainly means that the Makefile isn't well wrotten.
If you need more info "man gcc" is the way to go.
 
Old 06-30-2009, 08:22 AM   #3
eljuventino
LQ Newbie
 
Registered: May 2009
Posts: 26

Original Poster
Blog Entries: 1

Rep: Reputation: 15
thanks man for your answer !!as i understand i have to define AIX41_OPSYS in the file afp_dump.c and the compilation will go correctly if u can give me an exeample that explain how this -D option works!!anyway thanks man for your replies again!!!
 
Old 06-30-2009, 09:12 AM   #4
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
Nooo!
-DAIX41_OPSYS define the AIX41_OPSYS symbol _AS_IF_ you add "#define AIX41_OPSYS" in every src files you're compiling.
Try this:
Code:
#include <stdio.h>
int main (void) {
   #ifdef MY_SYMBOL
   printf ("MY_SYMBOL is defined\n");
   #else
   printf ("MY_SYMBOL is not defined\n");
   #endif
   retun 0;
}
compile it with and without -DMY_SYMBOL option.

As you want to port from AIX to LINUX I guess that you have to port every pieces of code surrounded by "#ifdef AIX41_OPSYS"
 
Old 06-30-2009, 09:22 AM   #5
eljuventino
LQ Newbie
 
Registered: May 2009
Posts: 26

Original Poster
Blog Entries: 1

Rep: Reputation: 15
waaaaaaaw!!thanks man ,u are the best!!! now i see what -D option means !!!just one question what do u mean that i have to port every pieces of code surrounded by "#ifdef AIX41_OPSYS"!!belive me your answer was great and after 2 weeks in saerching in the net and no result, u come with a simple and good explaination !!!thanks again !!!
 
Old 06-30-2009, 10:39 AM   #6
eljuventino
LQ Newbie
 
Registered: May 2009
Posts: 26

Original Poster
Blog Entries: 1

Rep: Reputation: 15
i see what do u mean know!!thanks a lot for the help it was very helpful thanks again!!
 
Old 07-01-2009, 03:47 AM   #7
eljuventino
LQ Newbie
 
Registered: May 2009
Posts: 26

Original Poster
Blog Entries: 1

Rep: Reputation: 15
thanks man i foud AIX41_OPSYS in one of my .c files and i found this code!!u think that i can to port to linux:
#if (defined(UNIX_OPSYS) && !defined(sun)) || defined(IRIX53_OPSYS) || defined(AIX41_OPSYS) || defined(AIX)
/****************************************************************************/
/* Function: set_signal() - VERSIONE UNIX */
/* Date L.M.: 26-May-1998 */
/* Description: Assign sig_handler() for all signals */
/****************************************************************************/

void set_signal()
{
struct sigaction act = { 0, 0, 0 };
int sig;

act.sa_handler = sig_handler;

for (sig = 1; sig < SIGMAX; sig++)
if (sig != SIGKILL && sig != 21 && sig != SIGCHLD)
sigaction(sig, &act, 0);

}

#endif

#ifdef sun
/****************************************************************************/
/* Function: set_signal() */
/* Date L.M.: 23-Nov-1998 */
/* Description: Assign sig_handler() for all signals */
/****************************************************************************/

void set_signal()
{
struct sigaction act = { 0, 0, 0 };
int sig;

act.sa_handler = sig_handler;

for (sig = 1; sig < SIGRTMAX; sig++)
if (sig != SIGKILL && sig != SIGTTIN && sig != SIGCHLD)
sigaction(sig, &act, 0);

}


#endif /* ifdef sun */
 
Old 07-02-2009, 10:13 AM   #8
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
there are some differences with signals between unix versions.

you must read the man signal pages for AIX and compare with linux to see if you can work
out how to rewrite the signal functions.

It looks at a cursory glance if it's simply disabling the signals.

I think in older unix versions the sigaction needs to be reset after a catch.

though, of course, i could be wrong.

you could always try it!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error creating library file from object files using xlc montylee AIX 3 03-04-2024 11:21 AM
Downgrade xlC compiler version in AIX 5.3 vathsan AIX 4 02-22-2009 02:22 PM
Installing xlc on CentOS5 - where do I find it? neocontrol Linux - Software 1 06-15-2008 12:35 PM
Using xlc libraries with gcc compiled apps dogsby AIX 0 11-16-2006 05:15 AM
gcc wont install, 'failed dependencies: glibc-devel is needed by gcc-3.3.3-41' TdlSnare SUSE / openSUSE 3 11-29-2004 02:13 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration