Community
cancel
Showing results for 
Search instead for 
Did you mean: 
bennettk
Beginner
87 Views

Linux Port - Linker problems

Jump to solution
I have been trying to move an IPP-based application I've developed in Xcode on Mac OS X to a Linux environment. I have a makefile (which was generated from my Xcode project by the very handy utility PBTOMAKE) that is successfully compiling all of the files but fails at the linking stage. I've read through all I could find on these forums as far as linker problems in a Linux environment but still have had no luck-- but I'm probably missing something subtle here.

I have tried all three of these as the linker options, based on various suggestions I've seen on these forums:

LNK_OPTIONS = $(IPPROOT)/lib/libippiemerged.a $(IPPROOT)/lib/libippimerged.a $(IPPROOT)/lib/libippsemerged.a $(IPPROOT)/lib/libippsmerged.a $(IPPROOT)/lib/libippcore.a

LNK_OPTIONS = -L /opt/intel/ipp/6.0.1.071/ia32/sharedlib/ -lippimerged -lippsemerged -lippsmerged -lippcore -pthread

LNK_OPTIONS = -L /opt/intel/ipp/6.0.1.071/ia32/sharedlib -libippcore -pthread



...but the linker always fails with undefined references to all of the IPP functions, i.e.:

./main.o: In function `main':
main.cpp:(.text+0x13f): undefined reference to `ippsMalloc_16s'
main.cpp:(.text+0x166): undefined reference to `ippsMalloc_32f'
main.cpp:(.text+0x213): undefined reference to `ippsMalloc_16s'



Also, as far as installing the executable on a different computer (also x86 linux, but possibly a different flavor of linux)- would it be as simple as copying the generated executable? Or do I have to distribute some IPP libraries with it? Yes, my grasp on static / dynamic linking is tenuous at best...

Any help would be appreciated!
0 Kudos
1 Solution
Ying_H_Intel
Employee
87 Views
Quoting - bennettk
ok, sorry for the naivete, I've answered the second part of my question by doing a bit more research (I'm going to want to statically link the project just to make distribution easier). But I'm quite in need of some guidance on the first half of my question.

I've broken the problem down into a single compile / link statement:

g++ -static /opt/intel/ipp/6.0.1.071/ia32/lib/libippiemerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippimerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippsemerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippsmerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippcore.a -pthread -I /opt/intel/ipp/6.0.1.071/ia32/include -I tools/include -o main main.cpp pick_peak.cpp get_starting_segments.cpp get_segment_timing_differences.cpp recast_and_normalize_wave_file.cpp rhythm_score.cpp pitch_score.cpp pitch_curve.cpp tools/source/LocalBuffer.cpp tools/source/wave.cpp distance.cpp

...but this still returns a linker error for every reference to any IPP function that is made. FYI, I am able to compile and link the application with the following dependencies in the Xcode / OS X version of the project:
"-lippiemerged",
"-lippimerged",
"-lippsemerged",
"-lippsmerged",
"-lippcore",

I'll seriously send whoever solves this $50 over paypal (if I don't somehow happen to figure it out first)-- I'm desperate! (is bribing allowed on the IPP forums?)

Thanks for any help.
Hello bennettk,

The error is caused by yourcommand order.

Could you please try
>g++ -static -I /opt/intel/ipp/6.0.1.071/ia32/include -I tools/include -o main main.cpp pick_peak.cpp get_starting_segments.cpp get_segment_timing_differences.cpp recast_and_normalize_wave_file.cpp rhythm_score.cpp pitch_score.cpp pitch_curve.cpp tools/source/LocalBuffer.cpp tools/source/wave.cpp distance.cpp
/opt/intel/ipp/6.0.1.071/ia32/lib/libippiemerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippimerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippsemerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippsmerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippcore.a -lpthread

and see if it works?

g++'s linker is one time scan, so you can't link required library before call it.


Some comments about other two options:
LNK_OPTIONS = -L /opt/intel/ipp/6.0.1.071/ia32/sharedlib/ --lippimerged -lippsemerged -lippsmerged -lippcore -pthread
// two problems here
A: -L /opt/intel/ipp/6.0.1.071/ia32/sharedlib/ => -L /opt/intel/ipp/6.0.1.071/ia32/lib/ (static linking)
B: missing -lippiemerged. Please See more from below on-line FAQ

LNK_OPTIONS = -L /opt/intel/ipp/6.0.1.071/ia32/sharedlib -libippcore -pthread
// missing ipp library, the commmand should be -L /opt/intel/ipp/6.0.1.071/ia32/sharedlib/ -lippi -lipps -lippcore -lpthread. This is a common shared linking model.

For more link sample, please refer to user guide documentation: userguide_lnx_ia32.pdf under IPPROOT/doc or on-line FAQ: << http://software.intel.com/en-us/articles/how-to-build-ipp-application-in-linux-environment/>>.



View solution in original post

4 Replies
bennettk
Beginner
87 Views
ok, sorry for the naivete, I've answered the second part of my question by doing a bit more research (I'm going to want to statically link the project just to make distribution easier). But I'm quite in need of some guidance on the first half of my question.

I've broken the problem down into a single compile / link statement:

g++ -static /opt/intel/ipp/6.0.1.071/ia32/lib/libippiemerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippimerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippsemerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippsmerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippcore.a -pthread -I /opt/intel/ipp/6.0.1.071/ia32/include -I tools/include -o main main.cpp pick_peak.cpp get_starting_segments.cpp get_segment_timing_differences.cpp recast_and_normalize_wave_file.cpp rhythm_score.cpp pitch_score.cpp pitch_curve.cpp tools/source/LocalBuffer.cpp tools/source/wave.cpp distance.cpp

...but this still returns a linker error for every reference to any IPP function that is made. FYI, I am able to compile and link the application with the following dependencies in the Xcode / OS X version of the project:
"-lippiemerged",
"-lippimerged",
"-lippsemerged",
"-lippsmerged",
"-lippcore",

I'll seriously send whoever solves this $50 over paypal (if I don't somehow happen to figure it out first)-- I'm desperate! (is bribing allowed on the IPP forums?)

Thanks for any help.
Ying_H_Intel
Employee
88 Views
Quoting - bennettk
ok, sorry for the naivete, I've answered the second part of my question by doing a bit more research (I'm going to want to statically link the project just to make distribution easier). But I'm quite in need of some guidance on the first half of my question.

I've broken the problem down into a single compile / link statement:

g++ -static /opt/intel/ipp/6.0.1.071/ia32/lib/libippiemerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippimerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippsemerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippsmerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippcore.a -pthread -I /opt/intel/ipp/6.0.1.071/ia32/include -I tools/include -o main main.cpp pick_peak.cpp get_starting_segments.cpp get_segment_timing_differences.cpp recast_and_normalize_wave_file.cpp rhythm_score.cpp pitch_score.cpp pitch_curve.cpp tools/source/LocalBuffer.cpp tools/source/wave.cpp distance.cpp

...but this still returns a linker error for every reference to any IPP function that is made. FYI, I am able to compile and link the application with the following dependencies in the Xcode / OS X version of the project:
"-lippiemerged",
"-lippimerged",
"-lippsemerged",
"-lippsmerged",
"-lippcore",

I'll seriously send whoever solves this $50 over paypal (if I don't somehow happen to figure it out first)-- I'm desperate! (is bribing allowed on the IPP forums?)

Thanks for any help.
Hello bennettk,

The error is caused by yourcommand order.

Could you please try
>g++ -static -I /opt/intel/ipp/6.0.1.071/ia32/include -I tools/include -o main main.cpp pick_peak.cpp get_starting_segments.cpp get_segment_timing_differences.cpp recast_and_normalize_wave_file.cpp rhythm_score.cpp pitch_score.cpp pitch_curve.cpp tools/source/LocalBuffer.cpp tools/source/wave.cpp distance.cpp
/opt/intel/ipp/6.0.1.071/ia32/lib/libippiemerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippimerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippsemerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippsmerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippcore.a -lpthread

and see if it works?

g++'s linker is one time scan, so you can't link required library before call it.


Some comments about other two options:
LNK_OPTIONS = -L /opt/intel/ipp/6.0.1.071/ia32/sharedlib/ --lippimerged -lippsemerged -lippsmerged -lippcore -pthread
// two problems here
A: -L /opt/intel/ipp/6.0.1.071/ia32/sharedlib/ => -L /opt/intel/ipp/6.0.1.071/ia32/lib/ (static linking)
B: missing -lippiemerged. Please See more from below on-line FAQ

LNK_OPTIONS = -L /opt/intel/ipp/6.0.1.071/ia32/sharedlib -libippcore -pthread
// missing ipp library, the commmand should be -L /opt/intel/ipp/6.0.1.071/ia32/sharedlib/ -lippi -lipps -lippcore -lpthread. This is a common shared linking model.

For more link sample, please refer to user guide documentation: userguide_lnx_ia32.pdf under IPPROOT/doc or on-line FAQ: << http://software.intel.com/en-us/articles/how-to-build-ipp-application-in-linux-environment/>>.



View solution in original post

Ying_H_Intel
Employee
87 Views
On-line documentation: how to build ipp in linux environment

http://software.intel.com/en-us/articles/how-to-build-ipp-application-in-linux-environment/
bennettk
Beginner
87 Views
Quoting - Ying Hu (Intel)
Hello bennettk,

The error is caused by yourcommand order.

Could you please try
>g++ -static -I /opt/intel/ipp/6.0.1.071/ia32/include -I tools/include -o main main.cpp pick_peak.cpp get_starting_segments.cpp get_segment_timing_differences.cpp recast_and_normalize_wave_file.cpp rhythm_score.cpp pitch_score.cpp pitch_curve.cpp tools/source/LocalBuffer.cpp tools/source/wave.cpp distance.cpp
/opt/intel/ipp/6.0.1.071/ia32/lib/libippiemerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippimerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippsemerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippsmerged.a /opt/intel/ipp/6.0.1.071/ia32/lib/libippcore.a -lpthread

and see if it works?

g++'s linker is one time scan, so you can't link required library before call it.

thank you so much, Ying-- this worked!
Reply