Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Problems linking to IPP libs on 64-bit Linux

frenet
Beginner
2,400 Views

I am statically linking to the ipp, umc & uic libraries. I am using IPP 6.1.6.063 and have downloaded the 6.1 sample code. I am using g++.

I can build my own shared object that statically links to ipp and umc, but when I try to build an application that links to my shared object, I get the following link error:

/opt/intel/ipp/6.1.6.063/emt64/sharedlib/libiomp5.so: undefined reference to `pthread_atfork'

I did see the following note in this article: http://software.intel.com/en-us/articles/how-to-build-ipp-application-in-linux-environment/

Error message: /opt/intel/ipp/6.1.6.063/em64t/sharedlib/libiomp5.so: undefined reference to `pthread_atfork'

* Please make sure to link "-lpthread" library in your command line.

I do have -lpthread specified, but the error still occurs.

I originally had this problem under 32-bit linux, but this was resolved after specifying -lpthread after -libiomp5 in the linker file list. Using the same build command does not work under 64-bit linux though. I still get the same error.

One way to resolve this problem is to specify -lpthread when building the application. But this would require anyone using my shared object to do the same which shouldn't be necessary because as I mentioned it works properly under 32-bit linux.

Is there something specific to 64-bit that I am not considering?

Thanks.

0 Kudos
1 Solution
Chao_Y_Intel
Moderator
2,400 Views

Hello,

It looks the code is using OpenMP threading with GCC. please try to add the following two linkage flag, and see how it works:

LIBS = .... -lgomp -lpthread

Thanks,
Chao

View solution in original post

0 Kudos
8 Replies
Naveen_G_Intel
Employee
2,400 Views
Hi,
Give me link line information, change the order of link libraries, mention -lpthread after IPP link libraries.

Regards,
Naveen Gv
0 Kudos
frenet
Beginner
2,400 Views
Hi,

Below is the link info for my shared object. The application only specifies this object in its link line.

Another thing that I noticed was that when building the application I needed to specify the path to libiomp in LD_LIBRARY_PATH or I would get

"/usr/bin/ld: warning: libiomp5.so, needed by ../../lib/libfrenet.so, not found"

I did not need to add the path when building the app under 32-bit linux.



UIC_LIBS = "${UIC_IMAGE_DIR}/_bin/linux$(UIC_LIB_ARCH)_/lib/uic_core_l.a" \
"${UIC_IMAGE_DIR}/_bin/linux$(UIC_LIB_ARCH)_/lib/uic_io_l.a" \
"${UIC_IMAGE_DIR}/_bin/linux$(UIC_LIB_ARCH)_/lib/uic_jpeg_enc_l.a" \
"${UIC_IMAGE_DIR}/_bin/linux$(UIC_LIB_ARCH)_/lib/uic_jpeg_dec_l.a" \
"${UIC_IMAGE_DIR}/_bin/linux$(UIC_LIB_ARCH)_/lib/uic_jpeg_common_l.a"

UMC_LIBS = "${UMC_AVCODEC_DIR}/_bin/linux$(UMC_LIB_ARCH)_/lib/libmpeg4_mux.a" \
"${UMC_AVCODEC_DIR}/_bin/linux$(UMC_LIB_ARCH)_/lib/libscene_analyzer.a" \
"${UMC_AVCODEC_DIR}/_bin/linux$(UMC_LIB_ARCH)_/lib/libh264_enc.a" \
"${UMC_AVCODEC_DIR}/_bin/linux$(UMC_LIB_ARCH)_/lib/libcolor_space_converter.a" \
"${UMC_AVCODEC_DIR}/_bin/linux$(UMC_LIB_ARCH)_/lib/libumc_io.a" \
"${UMC_AVCODEC_DIR}/_bin/linux$(UMC_LIB_ARCH)_/lib/libmedia_buffers.a" \
"${UMC_AVCODEC_DIR}/_bin/linux$(UMC_LIB_ARCH)_/lib/libcommon.a" \
"${UMC_AVCODEC_DIR}/_bin/linux$(UMC_LIB_ARCH)_/lib/libumc.a" \
"${UMC_AVCODEC_DIR}/_bin/linux$(UMC_LIB_ARCH)_/lib/libvm_plus.a" \
"${UMC_AVCODEC_DIR}/_bin/linux$(UMC_LIB_ARCH)_/lib/libvm.a"

IPP_STATIC_LIBS = -L/work/netcdrom/Intel/IPP/6.1.6.063/$(IPP_LIB_ARCH)/lib \
-lippdcemerged$(IPP_FILE_EXT) -lippdcmerged$(IPP_FILE_EXT) \
-lippccemerged$(IPP_FILE_EXT) -lippccmerged$(IPP_FILE_EXT) \
-lippcvemerged$(IPP_FILE_EXT) -lippcvmerged$(IPP_FILE_EXT) \
-lippjemerged$(IPP_FILE_EXT) -lippjmerged$(IPP_FILE_EXT) \
-lippvcemerged$(IPP_FILE_EXT) -lippvcmerged$(IPP_FILE_EXT) \
-lippiemerged$(IPP_FILE_EXT) -lippimerged$(IPP_FILE_EXT) \
-lippsemerged$(IPP_FILE_EXT) -lippsmerged$(IPP_FILE_EXT) \
-lippcore$(IPP_FILE_EXT)

IPP_SHARED_LIBS = -L/work/netcdrom/Intel/IPP/6.1.6.063/$(IPP_LIB_ARCH)/sharedlib -liomp5

LIBS = -lraw1394 -lrt ${BOOST_LIB} ${BASE_LIB} ${LIBUSB} ${FREEIMAGE_LIB} ${IPP_SHARED_LIBS} ${UIC_LIBS} ${UMC_LIBS} ${IPP_STATIC_LIBS} -lpthread

g++ -Wl,-z,defs,-soname,libfrenet.so.2 -shared -o ${FULL_LIB_NAME} ${OBJS} ${LIBS} -lc


Thanks.
0 Kudos
frenet
Beginner
2,400 Views
Hi,

I was wondering if anyone saw anything wrong with the library order specified in my last reply. As I mentioned before, not only does this work fine under 32-bit Linux, I do no have to specify the libiomp5.so path nor link to pthread at the application level.

Thanks.
0 Kudos
Chao_Y_Intel
Moderator
2,400 Views

Hello,

It looks that you are linking with non threaded static libraries. I think the OpenMP library is not required for your code.

If you remove the following line and "-lpthread" from the link command line, how does it work for you?

IPP_SHARED_LIBS = -L/work/netcdrom/Intel/IPP/6.1.6.063/$(IPP_LIB_ARCH)/sharedlib -liomp5

Thanks,
Chao

0 Kudos
frenet
Beginner
2,400 Views
Hi Chao,

If I remove the the "-lpthread" and the "-liomp" line, then my shared object fails to build. Here are a few errors from the linking stage:

Linking...
/work/netcdrom/Intel/IPP/ipp-samples-6.1.6.073/audio-video-codecs/_bin/linuxem64t_/lib/libh264_enc.a(umc_h264_video_encoder.o): In function `UMC_H264_ENCODER::H264CoreEncoder_CheckEncoderParameters_16u32s(void*)':
umc_h264_video_encoder.cpp:(.text+0x341f): undefined reference to `omp_set_num_threads'
umc_h264_video_encoder.cpp:(.text+0x3931): undefined reference to `omp_get_max_threads'

/work/netcdrom/Intel/IPP/ipp-samples-6.1.6.073/audio-video-codecs/_bin/linuxem64t_/lib/libh264_enc.a(umc_h264_gen_enc.o): In function `UMC_H264_ENCODER::H264CoreEncoder_CompressFrame_16u32s(void*, UMC_H264_ENCODER::EnumPicCodType&, UMC_H264_ENCODER::EnumPicClass&, UMC::MediaData*)':
umc_h264_gen_enc.cpp:(.text+0x3d1b): undefined reference to `GOMP_parallel_start'
umc_h264_gen_enc.cpp:(.text+0x3d2a): undefined reference to `GOMP_parallel_end'
umc_h264_gen_enc.cpp:(.text+0x4173): undefined reference to `GOMP_parallel_start'
umc_h264_gen_enc.cpp:(.text+0x4182): undefined reference to `GOMP_parallel_end'
umc_h264_gen_enc.cpp:(.text+0x41bd): undefined reference to `GOMP_parallel_start'
umc_h264_gen_enc.cpp:(.text+0x41cf): undefined reference to `GOMP_parallel_end'



Thanks.
0 Kudos
Chao_Y_Intel
Moderator
2,401 Views

Hello,

It looks the code is using OpenMP threading with GCC. please try to add the following two linkage flag, and see how it works:

LIBS = .... -lgomp -lpthread

Thanks,
Chao

0 Kudos
frenet
Beginner
2,400 Views
Hi Chao,

Using -lgomp and -lpthread works for me. My shared object builds and applications linking to my shared object do not require to link to -lpthread anymore. Also the path to the omp library does not need to be defined in LD_LIBRARY_PATH when building applications.

I am curious to why this happened in the first place. Is it due to the way that I built the UIC/UMC libraries on the 64-bit system?

Thanks for your help.
0 Kudos
Chao_Y_Intel
Moderator
2,400 Views

Hi,

Glad to know it works for you now. For the reason, you do not need the 'LD_LIBRARY_PATH' GCC omp library (libgomp) is in system folder, the loder can find these libraries by default.

Thanks,
Chao

0 Kudos
Reply