0
我正在尝试重新构建一个简单的GCC插件(它在GNU Linux上构建的很好)。在Mac OS X上构建GCC插件10.9.4
我打算编译使用GNU GCC v4.6.3我已经在Mac OS X上安装
Makefile的内容给出如下插件:
GCC=/Users/xxx/compilers/gcc-4.6.3/install/bin/gcc
PLUGIN_SOURCE_FILES= plugin.c
PLUGIN_OBJECT_FILES= $(patsubst %.c,%.o,$(PLUGIN_SOURCE_FILES))
GCCPLUGINS_DIR= $(shell $(GCC) -print-file-name=plugin)
CFLAGS+= -I$(GCCPLUGINS_DIR)/include -I/Users/xxx/compilers/gcc-4.6.3/install/include - I/Users/xxx/compilers/gcc-4.6.3/gcc/ -fPIC -O0 -g3
plugin.so: $(PLUGIN_OBJECT_FILES)
$(GCC) -shared $^ -o [email protected]
plugin.o:plugin.c
$(GCC) $(CFLAGS) -I$(GCCPLUGINS_DIR) -c $^ -o [email protected]
clean:
rm *.o *.so
我正在以下错误:
:Undefined symbols for architecture x86_64:
"_register_callback", referenced from:
_plugin_init in plugin_base.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [plugin_base.so] Error 1
GCC编译器使用以下配置内置
../gcc-4.6.3/configure --prefix=/Users/xxx/compilers/gcc-4.6.3/install/ --program-suffix=-4.6.3.x --enable-languages=c,c++ --disable-multilib --enable-cloog-backend=isl --with-gmp=/Users/xxx/compilers/gcc-4.6.3/install/ --with-mpfr=/Users/xxx/compilers/gcc-4.6.3/install/ --with-mpc=/Users/xxx/compilers/gcc-4.6.3/install/ --with-ppl=/Users/xxx/compilers/gcc-4.6.3/install/ --with-cloog=/Users/xxx/compilers/gcc-4.6.3/install/