交叉編譯libACE

2021-06-20 15:47:20 字數 4168 閱讀 4425

訪問ace的官網

關於需要使用的sunxi交叉編譯器,見

2. 準備

執行命令,設定ace_root環境變數

cp ./config-linux.h ./config.h

cd ../include/makeinclude/

ln -s ./platform_linux.gnu ./platform_macros.gnu

修改makefile中的編譯器為sunxi的arm-linux-gnueabihf-*,vi開啟 include/makeinclude/platform_g++_common.gnu,原文為:

ifeq ($(insure),1)

cc = insure

cxx = insure

else

ifneq ($(cross_compile),)

cross-compile = 1

# build using the cross-tools

ifneq ($($cross_compile_postfix),)

cc = $gcc

cxx = $g++

ar = $ar

else

cc = $gcc

cxx = $g++

ar = $ar

endif

# cross-linker requires this for linked in shared libs that depend

# themselves on other shared libs (not directly linked in)

ldflags += -wl,-rpath-link,$(ace_root)/lib

ifneq (,$(host_root))

tao_idlflags += -g $(host_root)/bin/ace_gperf

tao_idl = $(host_root)/bin/tao_idl

tao_idl_dep = $(tao_idl)

tao_idl3_to_idl2 = $(host_root)/bin/tao_idl3_to_idl2

tao_idl3_to_idl2_dep = $(tao_idl3_to_idl2)

tao_idl3_to_xmi = $(host_root)/bin/tao_idl3_to_xmi

tao_idl3_to_xmi_dep = $(tao_idl3_to_xmi)

# make sure to use the target compiler, not the cross-compiler

# as preprocessor for the cross-compiled idl tools

tao_idl_preprocessor = gcc

endif

endif

endif

修改為

cross_compile:=arm-linux-gnueabihf-

#ifeq ($(insure),1)

# cc = insure

# cxx = insure

#else

ifneq ($(cross_compile),)

cross-compile = 1

# build using the cross-tools

ifneq ($($cross_compile_postfix),)

cc = $gcc

cxx = $g++

ar = $ar

else

cc = $gcc

cxx = $g++

ar = $ar

endif

# cross-linker requires this for linked in shared libs that depend

# themselves on other shared libs (not directly linked in)

ldflags += -wl,-rpath-link,$(ace_root)/lib

ifneq (,$(host_root))

tao_idlflags += -g $(host_root)/bin/ace_gperf

tao_idl = $(host_root)/bin/tao_idl

tao_idl_dep = $(tao_idl)

tao_idl3_to_idl2 = $(host_root)/bin/tao_idl3_to_idl2

tao_idl3_to_idl2_dep = $(tao_idl3_to_idl2)

tao_idl3_to_xmi = $(host_root)/bin/tao_idl3_to_xmi

tao_idl3_to_xmi_dep = $(tao_idl3_to_xmi)

# make sure to use the target compiler, not the cross-compiler

# as preprocessor for the cross-compiled idl tools

tao_idl_preprocessor = gcc

endif

endif

#endif

3. 編譯

執行make,編譯了一陣後出現錯誤:

.shobj/mem_acceptor.o:(.rodata+0x0): multiple definition of `typeinfo name for ace_singleton'

.shobj/based_pointer_repository.o:(.rodata+0x0): first defined here

.shobj/mem_acceptor.o:(.data.rel.ro+0x0): multiple definition of `typeinfo for ace_singleton'

.shobj/based_pointer_repository.o:(.data.rel.ro+0x0): first defined here

.shobj/mem_connector.o:(.rodata+0x0): multiple definition of `typeinfo name for ace_singleton'

.shobj/based_pointer_repository.o:(.rodata+0x0): first defined here

.shobj/mem_connector.o:(.data.rel.ro+0x0): multiple definition of `typeinfo for ace_singleton'

.shobj/based_pointer_repository.o:(.data.rel.ro+0x0): first defined here

...

推測是ace/config-g++-common.h中的巨集定義

ace_export_singleton_declaration

ace_export_singleton_declare

造成的,修改ace/config.h,在其中增加

#define ace_gcc_has_template_instantiation_visibility_attrs 1
或者,在include/makeinclude/platform_macros.gnu中增加
no_hidden_visibility=1
注意,該語句必須加在include $(ace_root)/include/makeinclude/platform_linux_common.gnu之前,如

# -*- makefile -*-

# $id: platform_linux.gnu 97130 2013-05-13 17:36:26z mesnier_p $

no_hidden_visibility=1

include $(ace_root)/include/makeinclude/platform_linux_common.gnu

執行

make clean

make

ok,順利通過

ubuntu上lib ace庫安裝編譯

描述下本人電腦情況 虛擬機器版本 vmware workstation full v7.1.4 ace版本 ace6.0.0 虛擬機器 linux 版本 ubuntu10.10 desktop 安裝ace,最簡單的方法,是直接apt get安裝 sudo apt get install libace...

ubuntu上lib ace庫安裝編譯

描述下本人電腦情況 虛擬機器版本 vmware workstation full v7.1.4 ace版本 ace6.0.0 虛擬機器 linux 版本 ubuntu10.10 desktop 安裝ace,最簡單的方法,是直接apt get安裝 sudo apt get install libace...

編譯 交叉編譯

交叉編譯含義 是指在乙個平台上生成另乙個平台上的可執行 同乙個體系結構可以執行不同的作業系統,同樣乙個作業系統也可以在不同的體系結構上執行 例 常說的x86 linux平台 指inter x86體系結構及linux for x86作業系統 x86 winnt平台 指inter x86體系結構及win...