我怎么告诉acgmake使用-pthread?

时间:2012-06-17 19:06:04

标签: c++ linux gcc makefile

我正在构建这个应用程序,它可以在其他Linux机器上,在VMware虚拟机(linux guest)上运行。它有一个makefile并且make完成。然后我运行acgmake,它应该使所有需要的文件运行。我收到这个错误:

Build executable  Debian64_gcc4.6_dbg/libsrc_CadModel.so  ->  Debian64_gcc4.6_dbg/cadmodel
/home///intel/mkl/10.2.2.025/lib/em64t/libiomp5.so: undefined reference     to `pthread_atfork'

我发现我需要为gcc(或其他)指定-pthread标志。这是怎么做到的? ACGMakefile包含:(编辑:CadModel / ACGmakefile)

#==  SYSTEM PART -- DON'T TOUCH  ==============================================
include $(ACGMAKE)/Config
#==============================================================================
CXX_CFLAGS += -DQT_THREAD_SUPPORT

ifeq ($(findstring g++,$(CXX_COMP)),g++)
CXX_CFLAGS +=  -Wno-write-strings -Wno-ignored-qualifiers
CXX_LDFLAGS += -Xlinker --no-warn-search-mismatch
endif

SUBDIRS     = $(call find-subdirs)
PACKAGES   := ftgl opencascade qt4 glut opengl x11 math mkl
PROJ_LIBS   =  OpenMesh/Core
MODULES    := moc4 rcc cxxlib cxx

 all: build

info:
@echo "Using compiler $(filter g++, $(CXX_COMP))"
#   @echo "CFLAGS = $(CXX_LDFLAGS)"

#==  SYSTEM PART -- DON'T TOUCH  ==============================================
include $(ACGMAKE)/Rules
#==============================================================================

 run: $(cxx-exes)
./$(cxx-exes)

2 个答案:

答案 0 :(得分:2)

-lpthread-pthread是链接器所需要的。

如果未使用LD_LIBRARY_PATH选项在-L/path/to/lib中设置库,您可能还想告诉链接器查找库的位置。

答案 1 :(得分:1)

尝试将-pthread添加到

ifeq ($(findstring g++,$(CXX_COMP)),g++)
CXX_CFLAGS +=  -Wno-write-strings -Wno-ignored-qualifiers -pthread
CXX_LDFLAGS += -Xlinker --no-warn-search-mismatch -pthread
endif