This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Linux applications using RVDS

Note: This was originally posted on 28th July 2010 at http://forums.arm.com

hi

I  cross compiled some linux code using RVDS .

i used the instructions given in the following document

Building linux Applications using RVCT 4.0 and GNU tools

i used the latest CODE sourcery tool chain for this..


The compilation went through and it created a dynamically linked excuetable which uses shared libs.

My aim is to create a static excuetable which does not depend on any shared obj .

(basically something like gcc --static ) but i am not able to find such a option with armcc.

Kindly help

Regards
Sundar
  • Note: This was originally posted on 9th August 2010 at http://forums.arm.com

    My aim is to create a static excuetable which does not depend on any shared obj .

    (basically something like gcc --static ) but i am not able to find such a option with armcc.


    Using 'armcc --translate_gcc --arm_linux_config_file=... --static ...' should behave like 'gcc --static ...'.  What command-line options are you using?
  • Note: This was originally posted on 17th August 2010 at http://forums.arm.com

    Using 'armcc --translate_gcc --arm_linux_config_file=... --static ...' should behave like 'gcc --static ...'.  What command-line options are you using?


    Hi  Scott

    Thanks for the reply

    I used the following command line

    armcc  --cpu=..  --arm_linux_paths --arm_linux_config_file=/opt/config/armcc_config.xml

    As u suggested  i tried using 
    armcc --translate_gcc --arm_linux_config_file=... --static ...' should behave like 'gcc --static ..

    But it still produces a Dynamically linked library. Basically i guess it is because of the config.xml file

    When i look through the file i find options like --fpic --shared which actually tells the comliler to produce a dynamically linked executable

    Is there any way i can override  the  options given in the config file . ?

    while creating the config file i use the automatic configuration like

    armcc --arm_linux_configure --arm_linux_config_file=config_file_path
    --configure_gcc=path_to_gcc

    where path to gcc i give the path of codesourcery gcc .

    it automatically detects the libraries and it creates the config.xml ..
    and the config files has options like --fpic --shared which actually tells the comliler to produce a dynamically linked executable.

    No while configuring can i tell the xml file not to add these options? Any other options for armcc --arm_linux_configure 

    thanks
    Sundar
  • Note: This was originally posted on 17th August 2010 at http://forums.arm.com

    it automatically detects the libraries and it creates the config.xml ..
    and the config files has options like --fpic --shared which actually tells the comliler to produce a dynamically linked executable.

    The config.xml describes what implicit options (-Idir1, -Ldir2, obj1.o, ...) to use for various different cases -- not all of it will be used every time.  Which parts are used depend on the other command-line options you give along with --arm_linux_config_file=...

    I think you can see the actual armcc/armlink command lines by adding '-v'.  Can you post the command line that does your linking and the output when you add '-v' to it?  If that doesn't show the armcc/armlink command lines try adding '-Wrvct,--show_cmdline' which is how you can pass a raw RVCT option through --translate_gcc (but it's not a good idea for options that need to be handled by the translation).

    By the way, I notice that I made a mistake in an earlier post:  the GNU spelling of the option is '-static' (single '-', not '--'), so I should have said:
    Using 'armcc --translate_gcc --arm_linux_config_file=... -static ...' should behave like 'gcc -static ...'.
  • Note: This was originally posted on 17th August 2010 at http://forums.arm.com

    By the way, I notice that I made a mistake in an earlier post:  the GNU spelling of the option is '-static' (single '-', not '--'), so I should have said:


    Hi Scott

    Thanks, it worked for me. I was giving --static as a command line option which was the reason it was not working. When i changed it to -static as you said it worked.

    I have one last question regarding  the translate_gcc option with armcc and compiling of linux application using RVDS in general

    Does it affect the performance which RVDS promises to give over gcc ? i mean For compiling linux applications we use all gcc libraries ( code sourcery libraries, use gcc options ). The effect of this on RVDS performance over gcc.?
     

    Thanks
    Sundar
  • Note: This was originally posted on 17th August 2010 at http://forums.arm.com

    Thanks, it worked for me. [...]

    Glad to hear it; you're welcome.

    I have one last question regarding  the translate_gcc option with armcc and compiling of linux application using RVDS in general

    Does it affect the performance which RVDS promises to give over gcc ? i mean For compiling linux applications we use all gcc libraries ( code sourcery libraries, use gcc options ). The effect of this on RVDS performance over gcc.?

    That really depends on how much time your application spends in the libraries and how much in the armcc-built code.  Profiling with something like DS-5 Streamline or oprofile is probably the right place to start.  If you find out you're spending a lot of time in the libraries (for example memcpy) it might be worth trying to use those functions from the RVDS libraries -- but it can be messy or impossible if the library functions are OS-dependant (file i/o, signals, sockets, ...).
  • Note: This was originally posted on 18th August 2010 at http://forums.arm.com

    Glad to hear it; you're welcome.


    That really depends on how much time your application spends in the libraries and how much in the armcc-built code.  Profiling with something like DS-5 Streamline or oprofile is probably the right place to start.  If you find out you're spending a lot of time in the libraries (for example memcpy) it might be worth trying to use those functions from the RVDS libraries -- but it can be messy or impossible if the library functions are OS-dependant (file i/o, signals, sockets, ...).


    Hi Scott

    Now i am stuck in another issue.
    I was able to build a static binary as mentioned . but now
    The binaries which i built are all seg faulting in the target.

    A statically linked binary segfaulting in the target baffles me :unsure:.

    Some details

    My target runs Angstrom linux . I used Code sourcery tools to cross compile for the target.

    Any light on this
    ?

    I have another question.



      Like you said the options in the config file are implicit options provided to the compiler. But now when i compile i give the path to the config file ( xml file) and there are some options in it which was automatically configured.

    You said it depends on the options which you give inthe comand line depending on which it will be decided that whether the options are to be taken or not.

    now armcc by default produces a static binary until u give the option --shared. Problem is my config file has this option called --shared which  is why it produces a dynamic lib. how can i tell the compiler not to take this option ? \

    If this works i need not work around using translate_gcc



    Thanks
    Sundar
  • Note: This was originally posted on 19th August 2010 at http://forums.arm.com

    Now i am stuck in another issue.
    I was able to build a static binary as mentioned . but now
    The binaries which i built are all seg faulting in the target.

    A statically linked binary segfaulting in the target baffles me :unsure:.

    First, it would be better to start a new thread for this question since it is about a different topic instead of mixing a new topic into this thread.  But: I don't think I can help you much.  A statically linked binary can seg fault for lots of reasons -- you'll need to debug it using something like gdb or DS-5 or just printfs.  Once you have more details (like "my app seg faults on this source line" or "in this library call" or "before it reaches main") then posting them (in a new thread) might be appropriate if you need help figuring it out.

    I have another question.

      Like you said the options in the config file are implicit options provided to the compiler. But now when i compile i give the path to the config file ( xml file) and there are some options in it which was automatically configured.

    You said it depends on the options which you give inthe comand line depending on which it will be decided that whether the options are to be taken or not.

    now armcc by default produces a static binary until u give the option --shared. Problem is my config file has this option called --shared which  is why it produces a dynamic lib. how can i tell the compiler not to take this option ? \

    If this works i need not work around using translate_gcc


    [This continues part of this thread, so I don't think a new thread is needed.]
    By "config file" I mean the file being passed to --arm_linux_config_file=...

    The config file tells armcc how gcc behaves, by default and when various options are given.  So it will encode rules like "if were compiling for C++ then use these include paths", "if we're linking for -mthumb then use these objects & libraries and library paths", and a lot of other things.  Looking at the contents of the config file is probably not that helpful since it's hard to know what parts of the file are used for a given armcc invocation.  Using '-v' (with --translate_gcc) will show the "full" command-lines.

    The --translate_gcc option is not directly related to the config file.  It tells armcc that it should interpret the other command line options as gcc options (e.g. -mthumb) instead of RVCT options (e.g. --thumb).

    Can you give an example of a command-line that you're using now that works and explain what part of it you want to change or don't like?