Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7957 Discussions

ipo and linux static library, undefined symbol

Robert_C_Intel
Employee
342 Views

I am using icc 10.0 on linux. I have not been able to use static libraries with ipo. Any suggestions?

[rscohn1@vs-lin64-3 itest]$ ./build.csh
set CC=icc -ipo
set AR=xiar cru
cat foo.c
void foo(void)
{}
cat x.c
extern void foo(void);

main()
{
foo();
}
icc -ipo -c foo.c
icc -ipo -c x.c
rm foo.a
xiar cru foo.a foo.o
xiar: executing 'ar'
icc -ipo -o x.iponolib x.o foo.o
ipo: remark #11000: performing multi-file optimizations
ipo: remark #11005: generating object file /tmp/ipo_iccSfjJO2.o
icc -ipo -o x.ipolib x.o foo.a
ipo: warning #11041: unresolved foo
Referenced in /tmp/ipo_icc4KKyt5.o
ipo: remark #11001: performing single-file optimizations
ipo: remark #11005: generating object file /tmp/ipo_icc4KKyt5.o
/tmp/ipo_icc4KKyt5.o(.text+0x1b): In function `main':
: undefined reference to `foo'
[rscohn1@vs-lin64-3 itest]$

0 Kudos
2 Replies
TimP
Honored Contributor III
342 Views
You could use icc -ipo-c to make normal .o files to build the libraries.
0 Kudos
Robert_C_Intel
Employee
342 Views

My mistake. My path was picking up the 10.0 icc, but the 8.0 xiar. Using the correct xiar lets it link.

Robert

0 Kudos
Reply