- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i'm compiling c++ code using intel compiler (11) for linux.
i'm getting a very large *.so file.
how can i reduce the file size?
are there any tools i can use to try and understand why it is so big.
thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i'm compiling c++ code using intel compiler (11) for linux.
i'm getting a very large *.so file.
how can i reduce the file size?
are there any tools i can use to try and understand why it is so big.
thanks.
I don't know of an user-friendly, easy to use tools, but 'objdump' will do the job. Start with 'objdump -s'.
Debug information is often the culprit, as is accidentally statically-include libraries you mean to dynamically-link to. You can run 'ldd' on a .so file to make sure it's itself dynamically-linked to the libraries it uses. (And statically-linking to core libraries inside a shared object causes serious problems.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It depends what is very large?
Do you compare it to .so compiled with some other compiler, like gcc?
Is it 20% bigger or two times bigger?
Can you share your compilation options with us, so we won't be guessing so much.
I am also trying to reduce my code size, and this is my experience:
With icc, -O1 generates both fastest and smallest object in my case (lots of integer math). Your results may differ, but it is worth a try.
The options
-fno-inline
-fno-exceptions
will also make much smaller C++ object, if your code does not use exceptions, or if the performance won't suffer by omitting the inline optimization.
You should also strip your .so file, if size matters to you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel compiler may be doing inlining. It would be nice if you can help if you can quantify the increase in code size. Could you help us with sample testcase to help us review the code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using -g? Sometimes that can be pretty hefty.
As always, an example is helpful to get a complete and knowledgeable answer.
Dale
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page