0

我正在使用 VMware 虚拟机(linux guest)在 Windows 上构建这个应用程序,它可以在其他 linux 机器上编译。它有一个makefile并完成。然后我运行 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'

我发现我需要-pthread为 gcc (或其他东西)指定标志。这是怎么做到的?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)
4

2 回答 2

2

-lpthread或者-pthread是链接器需要的。

LD_LIBRARY_PATH如果未在,中设置库,您可能还想告诉链接器在哪里可以找到库-L/path/to/lib

于 2012-06-17T19:09:02.173 回答
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
于 2012-06-18T08:52:52.723 回答