Linking of IPP 2018 with mingw

荒凉一梦 提交于 2020-06-08 06:40:59

问题


I am trying to use the 2018 version of Intel IPP with mingw, and I have trouble linking the .lib that Intel provides to my program. The program I am compiling is the IPP example at https://software.intel.com/en-us/ipp-dev-guide-building-intel-ipp-applications

Here is the makefile:

HDIR = "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.1.156\windows\ipp\include"
LDADD = "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.1.156\windows\ipp\lib\intel64_win"
SOURCES= test.cpp 
OBJECTS1=$(patsubst %.cpp,%.o,$(SOURCES))
OBJECTS=$(patsubst %.c,%.o,$(OBJECTS1))

all debug profile static depend: $(OBJECTS)
    g++ -o test.exe test.o $(CXXFLAGS) -L$(LDADD) -lippcc -lippi -lipps -lippcore -lm


%.o: %.cpp
    g++ -c $< -I $(HDIR) $(CXXFLAGS) 

%.o: %.c
    g++ -c $< -I $(HDIR) $(CXXFLAGS)

clean:
    rm -f *.o

and here's the gcc output:

g++ -c test.cpp -I "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_
2018.1.156\windows\ipp\include"
g++ -o test.exe test.o  -L"C:\Program Files (x86)\IntelSWTools\compilers_and_lib
raries_2018.1.156\windows\ipp\lib\intel64_win" -lippcc -lippi -lipps -lippcore -
lm
test.o:test.cpp:(.text+0x14): undefined reference to `ippInit'
test.o:test.cpp:(.text+0x19): undefined reference to `ippGetLibVersion'
test.o:test.cpp:(.text+0x5f): undefined reference to `ippGetCpuFeatures'
test.o:test.cpp:(.text+0x79): undefined reference to `ippGetEnabledCpuFeatures'
collect2: error: ld returned 1 exit status
Makefile:8: recipe for target 'all' failed
make: *** [all] Error 1

The linker is finding the libraries, but I don't understand why I am getting undefined references. Has anybody had any success in compiling recent IPP versions with mingw ?


回答1:


I solved it by linking to the .dll instead of the .lib, and using the 32-bit version of the dll (stupidly I though my gcc was 64-bits but it was not).

The correct path to give to the linker for the libraries is:

LDADD = "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.1.156\windows\redist\ia32_win\ipp"

(if you are using 32-bits)



来源:https://stackoverflow.com/questions/47698137/linking-of-ipp-2018-with-mingw

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!