Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Robert_B_
Beginner
89 Views

Static library created with icpc, cannot use it using g++

The objects in the library are compiled as follows:

icpc -c  -fPIC -Wno-unused-function -Wall -pthread -static-intel -O3 -axCORE-AVX2 -fma -fp-model fast=2 -funroll-all-loops -unroll-aggressive -D__AVX2__ -ffat-lto-objects -xHost -ipo -ipo-jobs20 -qopenmp-link=dynamic -o "fileN.o" "fileN.cpp"

The library is created:

gcc-ar ruvs ./libtest.a file*.o

When I try to compile with g++:

g++   -Wall -pthread -O3 -march=native -mtune=native -flto=8 -minline-stringops-dynamically -fvariable-expansion-in-unroller -fweb -fgcse-sm -fgcse-las -fgcse-after-reload -fipa-pta -ftree-loop-distribution -ftree-loop-im -ftree-loop-ivcanon -fivopts -funswitch-loops -frename-registers -funroll-loops   -o MyProgram ../lib/libtest.a
./lib/libtest.a(kmp_stub.o): In function `ompc_set_num_threads':
(.text+0x0): multiple definition of `ompc_set_num_threads'
../lib/libtest.a(kmp_csupport.o):(.text+0x11f0): first defined here
collect2: error: ld returned 1 exit status

The thought problem seemed to be with openMP, if I try to make openMP dynamic with 

-qopenmp-link=dynamic

I get the same errors.

How can I create a working static library with icpc?

Thanks.

 

0 Kudos
1 Reply
Viet_H_Intel
Moderator
89 Views

Hi Robert,

Does it work if you remove -ipo and -ipo-jobs20 options?

Best regards,

Viet Hoang 

 

Reply