-staticlib option bug in Composer XE 2011 Update 7 for Mac OS X, aka 12.1.1.246

-staticlib option bug in Composer XE 2011 Update 7 for Mac OS X, aka 12.1.1.246

Ronald W Green (Intel)'s picture

bug in -staticlib option starting with Composer XE 2011 for Mac OS X Update 7, aka version 12.1.1.246. Affects both Intel C++ and Intel Fortran compilers.

Does not affect linux or Windows compilers, as this option is ONLY supported on Mac OS X platforms.

Knowledge Base article is here:

Afffected compilers: Intel C++ and Fortran Composer XE 2011 for Mac OS X Update 7, aka version 12.1.1.246

Background: The Intel Composer XE 2011 compilers for Mac OS X support the option -staticlib for compatibility with gcc. This option allows creation of a static library in one-step, taking a source file as input and producing a .a static library as output. This option worked in the Composer XE 2011 Update 6 compilers.

Scope: This option is ONLY supported on the Mac OS X platform. Thus, this bug is limited in scope to the Mac OS X compilers. this affects both the Intel C++ and Intel Fortran compilers for Mac OS X.

Symptom: Compiling with -staticlib causes the error:

Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64

Examples:

C/C++:
cat foo.c

extern double pow(double, double);

double foo(double x, double y)
{
return pow(x, y);
}

$ icc -staticlib foo.c -o foo.a
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64

Fortran:
cat subrout.f90

subroutine pow( x, y)
real (8) :: x,y
y = 2*x
end subroutine pow

$ ifort -staticlib subrout.f90 -o subrout.a
Undefined symbols for architecture x86_64:
"_MAIN__", referenced from:
_main in for_main.o
ld: symbol(s) not found for architecture x86_64

ISSUE ID: DPD200175631

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.