- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm trying to compile a Mac version of our lib for a customer that wants to include it in a Photoshop plugin, and he is having trouble linking our lib into his app. More detailed info: His plugin is built using gcc and the 10.4 Mac OS base SDK. My lib is a static one, compiled with the Intel compiler 10.1 and the base SDK is also set as 10.4. While its fine for me, my customer cannot manage to link with my lib. The problem is the following:
absolute addressing (perhaps -mdynamic-no-pic) used in _Cholesky from /mylib.a(Cholesky.o) not allowed in slidable image. Use '-read_only_relocs suppress' to enable text relocs
I really do not understand why ICC is generating position-dependent code for a library?! Any idea on how to fix this? Or a way to work around it?
A
Link Copied
10 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
icc should observe the same options as gcc for generating pic code. The default (non-pic) would be expected to be the same as gcc. Reasons for the default likewise would be same as gcc, including performance of globally visible entry points.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Position independent code is slower, so it is normal that it is disabled by default.
Use -fPIC to generate position independent code. This is a must for a shared library (.so), but optional for static one (.a)
You may also wish to check this thread:
http://stackoverflow.com/questions/813980/why-isnt-all-code-compiled-position-independent
Use -fPIC to generate position independent code. This is a must for a shared library (.so), but optional for static one (.a)
You may also wish to check this thread:
http://stackoverflow.com/questions/813980/why-isnt-all-code-compiled-position-independent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - dpeterc
Position independent code is slower, so it is normal that it is disabled by default.
Use -fPIC to generate position independent code. This is a must for a shared library (.so), but optional for static one (.a)
You may also wish to check this thread:
http://stackoverflow.com/questions/813980/why-isnt-all-code-compiled-position-independent
Use -fPIC to generate position independent code. This is a must for a shared library (.so), but optional for static one (.a)
You may also wish to check this thread:
http://stackoverflow.com/questions/813980/why-isnt-all-code-compiled-position-independent
I'm using Xcode to compile. I just looked at the compilation output on the command-line, and there does not seem to be any options related to position (in)dependent code. More specifically, a search for pic or fpic returns nothing.
I would expect Xcode or ICC to handle this, after I'm requesting them to build a static lib. Shouldn't -fPIC be there by default?
Thanks,
A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - vectorizor
I'm using Xcode to compile. I just looked at the compilation output on the command-line, and there does not seem to be any options related to position (in)dependent code. More specifically, a search for pic or fpic returns nothing.
I would expect Xcode or ICC to handle this, after I'm requesting them to build a static lib. Shouldn't -fPIC be there by default?
icc --help
will show you, among many other things:
-fpic, -fPIC
generate position independent code (-fno-pic/-fno-PIC is DEFAULT)
The way I am used to program, the programer needs to know and decide compiler options.
I don't have a mac, but looking at the xcode documentation
http://developer.apple.com/tools/xcode/xcodebuildsettings.html
it looks like a fancy gui make.
I think you are being seduced by shiny buttons into thinking, that xcode will do more for you than it can ;-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - dpeterc
icc --help
will show you, among many other things:
-fpic, -fPIC
generate position independent code (-fno-pic/-fno-PIC is DEFAULT)
I think you are being seduced by shiny buttons into thinking, that xcode will do more for you than it can ;-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - dpeterc
icc --help
will show you, among many other things:
-fpic, -fPIC
generate position independent code (-fno-pic/-fno-PIC is DEFAULT)
The way I am used to program, the programer needs to know and decide compiler options.
I don't have a mac, but looking at the xcode documentation
http://developer.apple.com/tools/xcode/xcodebuildsettings.html
it looks like a fancy gui make.
I think you are being seduced by shiny buttons into thinking, that xcode will do more for you than it can ;-)
Thanks for the answer. I did have a good look at all compiler options available, but I cannot find anything that would help solve my issue. The -fPIC sounds interesting, but it does not appear on 10.1. Any other ideas?
And for the comment about xcode doing more for me than it can, I requested to generate a static library. If it is too much to ask of a IDE/compiler to generate by default pic code for a shared library, then my bad.
Thanks again
A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
Such as guess your desires? As mentioned earlier, static libraries typically contain no-pic objects, so the additional option is needed to change that selection.
A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - vectorizor
A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - vectorizor
Thanks for the answer. I did have a good look at all compiler options available, but I cannot find anything that would help solve my issue. The -fPIC sounds interesting, but it does not appear on 10.1. Any other ideas?
http://www.nacad.ufrj.br/intel/cc/main_cls/mergedProjects/copts_cls/common_options/option_fpic.htm
I would assume that in that case, -fPIC behavior would be the default, there must be some technical reasons for it.
I think you need advice from someone with actual OSX experience, not me ;-(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The -fpic compiler option is available in icc 10.1. You may use it for generating position independent code.
$ icc -c -fpic mysource.cpp
$ icc -V
Intel C Compiler for applications running on IA-32, Version 10.1 Build 20080312 Package ID: m_cc_p_10.1.014
Copyright (C) 1985-2008 Intel Corporation. All rights reserved.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page