如何在 Ace Root 中为 MingW-64 构建 ACE no MakeFile
How to build ACE for MingW-64 no MakeFile in Ace Root
我正尝试在 Windows 上为 Mingw GCC 64 位构建 ACE 库。说明 here 声明如下:
将 MinGW 工具(包括 MinGW 开发工具包)安装到公共目录中,比如 c:/mingw
。
将 MSYS 工具安装到公共目录中,比如 c:/msys
。
打开一个 MSYS shell。设置您的 PATH
环境变量,使您的 MinGW 的 bin 目录位于第一个:
% export PATH=/c/mingw/bin:$PATH
添加一个 ACE_ROOT
环境变量指向您的 ACE 包装器源代码树的根:
% export ACE_ROOT=/c/work/mingw/ACE_wrappers
从现在开始,我们将ACE源代码树的根目录称为$ACE_ROOT
。
在 $ACE_ROOT/ace
目录中创建一个名为 config.h 的文件,其中包含:
#include "ace/config-win32.h"
在 $ACE_ROOT/include/makeinclude
目录中创建一个名为 platform_macros.GNU 的文件,其中包含:
include $(ACE_ROOT)/include/makeinclude/platform_mingw32.GNU
在上面的文本中,不要将 $(ACE_ROOT)
替换为实际目录,GNU make 将从您之前定义的环境变量中获取值。
如果您缺少 Winsock 2,请添加行
winsock2 = 0
在上一个之前。
如果要安装ACE(使用"make install")并希望生成所有.pc 文件,请在platform_macros.GNU 中设置安装前缀。
INSTALL_PREFIX=/c/ACE
Headers 将安装到 $INSTALL_PREFIX/include
,文档和构建系统文件将安装到 $INSTALL_PREFIX/share
,库将安装到 $INSTALL_PREFIX/lib
。设置 INSTALL_PREFIX
后,将启用 RPATH
。要禁用 RPATH
(例如,如果 $INSTALL_PREFIX/$INSTALL_LIB
已经是共享库的 system-known 位置),通过将 install_rpath=0
添加到platform_macros.GNU。
问题在这里:
在 MSYS shell 中,切换到 $ACE_ROOT/ace
目录并 运行 make:
% cd $ACE_ROOT/ace
% make
现在我注意到 ACE_ROOT/ace
中没有 MakeFile,它是 C:\mingw64\Other\ACE_wrappers\ace
我从 here 下载了我的 ACE 资料。
关于我可能做错了什么的任何建议?我是不是下载错了什么?
您似乎只下载了源代码分发包,请下载完整包,其中还包括 GNU makefile,请参阅 http://download.dre.vanderbilt.edu/
ACE 带有 GNUmakefile
-s,
的完整版本
在 MSYS 中你给出 make -f GNUmakefile
编辑 1
尽管许多平台和编译器都支持构建 64 位二进制文件,但 ACE 团队并未为 MINGW 提供它。有事可做...
编辑 2
以下脚本应该在 MingW-64
中配置 64 位二进制文件
#! /bin/bash
#
# Configure ACE/TAO for 32/64 bit build with MINGW64
#
# Precondition:
# This script is located in the parent folder of ACE_Wrappers
# File access permissions in ACE_Wrappers allow editing of files (sed):
# Easyest, delivered full ACE/TAO ZIP was extracted using Windows Explorer.
# When extracting with 7z, it will correctly preserve access rights and
# they need to be granted for the user, explicitly
#
# Postcondition:
# ACE is configured for MINGW build
# Script is involutoric
#
# Author: Sam Ginrich
# No warranty of any kind!
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#
# Definition of Setup parameters
# these are entered into configuration files, if not already there, never modified!
#
#
#buildbits= # does nothing
#buildbits=32 # configure 32-bit build
#buildbits=64 # configure 64-bit build
buildbits=64
#winsock2=0 # configure parameter to exclude winsock2 library
#winsock2=1 # configure parameter to include winsock2 library
#winsock2= # does nothing, same effect as winsock2=1
winsock2=
# Issue with header "$ACE_ROOT/ace/OS_NS_stdlib.h"
# In some MINGW installation, the compiler is confused with a defined 'rand_r' macro
# This takes effect when building TAO, not ACE
#
#rand_r_issue= # does nothing, suggested initial value
#rand_r_issue=1 # modifies "$ACE_ROOT/ace/OS_NS_stdlib.h" to #undef-ine macro 'rand_r',
# before impact, suggested when issue occurs
rand_r_issue=
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "ACE/TAO Build Target Values"
echo ""
echo "buildbits=$buildbits"
echo "winsock2=$winsock2"
echo "rand_r_issue=$rand_r_issue"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
echo "STEP: Enter ACE_Wrappers and define locations"
cd ./ACE_Wrappers
# Check, whether we arrives there ...
if [ ! -f "./ACE-INSTALL.html" ]; then
echo "ACE_Wrappers missing or invalid ... STOP"
exit 1
fi
export ACE_ROOT=${PWD}
export TAO_ROOT=${ACE_ROOT}/TAO
# Set C-Config Header for Windows
echo '#include "ace/config-win32.h"' > ace/config.h
# Set Platform MINGW
pl_macro=$ACE_ROOT/include/makeinclude/platform_macros.GNU
pl_mingw='$(ACE_ROOT)/include/makeinclude/platform_mingw32.GNU'
echo "include $pl_mingw" > $pl_macro
if [ "$buildbits" != "" ];
then
echo "------------------------------------------------------------"
echo ""
echo "STEP: Provide support for 64-bit build in 'platform_g++_common.GNU'"
pl_gpp=$ACE_ROOT/include/makeinclude/platform_g++_common.GNU
donetag2=" FLAGS_C_CC += -m64"
marker2="CCFLAGS += -Wnon-virtual-dtor"
buildbitsSwitch="ifeq ($(buildbits),32)\n FLAGS_C_CC += -m32\n LDFLAGS += -m32\nendif\nifeq ($(buildbits),64)\n FLAGS_C_CC += -m64\n LDFLAGS += -m64\nendif"
case `grep -Fx "$donetag2" "$pl_gpp" >/dev/null; echo $?` in
0)
echo "File $pl_gpp already modified "
;;
1)
# anyway store a copy
cp $pl_gpp /tmp
echo "copy of original $pl_gpp stored in \tmp"
echo "insert compiler switches for buildbits rule"
sed -i "s/$marker2/$marker2\n\n$buildbitsSwitch/g" $pl_gpp
;;
*)
echo "Error scanning file $pl_gpp"
;;
esac
echo "------------------------------------------------------------"
echo ""
pl_mingw=$ACE_ROOT/include/makeinclude/platform_mingw32.GNU
echo "STEP: Set parameter for 64-bit build in $pl_mingw"
donetag3="buildbits =.*"
marker3="mingw32 = 1"
buildbitsDef="# 32\/64-bit build\n# parameter 'buildbits' is applied in platform_gnuwin32_common.GNU\nbuildbits = $buildbits"
case `grep -Ex "$donetag3" "$pl_mingw" >/dev/null; echo $?` in
0)
echo "File $pl_mingw already modified "
echo "Verify value! "
grep "buildbits =" $pl_mingw
;;
1)
# anyway store a copy
cp $pl_mingw /tmp
echo "copy of original $pl_mingw stored in \tmp"
echo "insert buildbits=$buildbits"
sed -i "s/$marker3/$marker3\n\n$buildbitsDef/g" $pl_mingw
;;
*)
echo "Error scanning file $pl_mingw"
;;
esac
fi
if [ "$winsock2" != "" ];
then
echo "------------------------------------------------------------"
echo ""
#pl_mingw=$ACE_ROOT/include/makeinclude/platform_mingw32.GNU
echo "STEP: Winsock lack control"
donetag4="winsock2 =.*"
marker4=$marker3
winsockDef="winsock2 = $winsock2"
# $donetag4 is regular expression, -E
case `grep -Ex "$donetag4" "$pl_mingw" >/dev/null; echo $?` in
0)
echo "File $pl_mingw already modified "
echo Verify Value!
grep "winsock2 =" $pl_mingw
;;
1)
# anyway store a copy
cp $pl_mingw /tmp
echo "copy of original $pl_mingw stored in \tmp"
echo insert $winsockDef
sed -i "s/$marker4/$marker4\n\n$winsockDef/g" $pl_mingw
;;
*)
echo "Error scanning file $pl_mingw"
;;
esac
fi
if [ "$rand_r_issue" == "1" ];
then
echo "------------------------------------------------------------"
echo ""
echo "STEP: Handle issue with defined C-macro rand_r"
onsll=$ACE_ROOT/ace/OS_NS_stdlib.h
donetag1="//#rand_undefined"
case `grep -Fx "$donetag1" "$onsll" >/dev/null; echo $?` in
0)
echo "File $onsll already modified"
;;
1)
# anyway store a copy
cp $onsll /tmp
echo "copy of original $pl_gpp stored in \tmp"
echo "insert '#undef rand_r'"
sed -i 's/#if !defined (ACE_LACKS_RAND_R)/\/\/#rand_undefined\n#undef rand_r\n#if !defined (ACE_LACKS_RAND_R)/g' $onsll
;;
*)
echo "Error scanning file $onsll"
;;
esac
fi
echo "============================================================"
echo ""
echo "Content of "$ACE_ROOT/ace/config.h" is"
cat "ace/config.h"
echo ""
echo Content of "$pl_macro" is
cat $pl_macro
echo "-------------------------------------------------------------"
echo ""
echo ""
echo ""
echo "Suggested BUILD STEPS:"
echo ""
echo ""
echo "# 1. Define context"
echo "export ACE_ROOT=${PWD}"
echo "export TAO_ROOT=${ACE_ROOT}/TAO"
echo ""
echo "# 2. Build ACE"
echo 'cd ${ACE_ROOT}/ace'
echo "make -f GNUmakefile"
echo ""
echo "# 3. Verify ACE"
echo 'cd ${ACE_ROOT}/tests'
echo "make -f GNUmakefile"
echo "perl run_test.pl"
echo "#NOTE: Windows Firewall will ask for permission for each upcoming server instance"
echo ""
echo "# 4. Build TAO"
echo 'cd ${TAO_ROOT}'
echo "make -f GNUmakefile"
echo ""
echo "# 5. Basic TAO verification"
echo 'cd ${TAO_ROOT}/tests'
echo "make -f GNUmakefile"
echo 'cd ${TAO_ROOT}/tests/Param_Test'
echo "perl run_test.pl"
我正尝试在 Windows 上为 Mingw GCC 64 位构建 ACE 库。说明 here 声明如下:
将 MinGW 工具(包括 MinGW 开发工具包)安装到公共目录中,比如
c:/mingw
。将 MSYS 工具安装到公共目录中,比如
c:/msys
。打开一个 MSYS shell。设置您的
PATH
环境变量,使您的 MinGW 的 bin 目录位于第一个:% export PATH=/c/mingw/bin:$PATH
添加一个
ACE_ROOT
环境变量指向您的 ACE 包装器源代码树的根:% export ACE_ROOT=/c/work/mingw/ACE_wrappers
从现在开始,我们将ACE源代码树的根目录称为
$ACE_ROOT
。在
$ACE_ROOT/ace
目录中创建一个名为 config.h 的文件,其中包含:#include "ace/config-win32.h"
在
$ACE_ROOT/include/makeinclude
目录中创建一个名为 platform_macros.GNU 的文件,其中包含:include $(ACE_ROOT)/include/makeinclude/platform_mingw32.GNU
在上面的文本中,不要将
$(ACE_ROOT)
替换为实际目录,GNU make 将从您之前定义的环境变量中获取值。 如果您缺少 Winsock 2,请添加行winsock2 = 0
在上一个之前。
如果要安装ACE(使用"make install")并希望生成所有.pc 文件,请在platform_macros.GNU 中设置安装前缀。
INSTALL_PREFIX=/c/ACE
Headers 将安装到
$INSTALL_PREFIX/include
,文档和构建系统文件将安装到$INSTALL_PREFIX/share
,库将安装到$INSTALL_PREFIX/lib
。设置INSTALL_PREFIX
后,将启用RPATH
。要禁用RPATH
(例如,如果$INSTALL_PREFIX/$INSTALL_LIB
已经是共享库的 system-known 位置),通过将install_rpath=0
添加到platform_macros.GNU。
问题在这里:
在 MSYS shell 中,切换到
$ACE_ROOT/ace
目录并 运行 make:% cd $ACE_ROOT/ace % make
现在我注意到 ACE_ROOT/ace
中没有 MakeFile,它是 C:\mingw64\Other\ACE_wrappers\ace
我从 here 下载了我的 ACE 资料。 关于我可能做错了什么的任何建议?我是不是下载错了什么?
您似乎只下载了源代码分发包,请下载完整包,其中还包括 GNU makefile,请参阅 http://download.dre.vanderbilt.edu/
ACE 带有 GNUmakefile
-s,
在 MSYS 中你给出 make -f GNUmakefile
编辑 1
尽管许多平台和编译器都支持构建 64 位二进制文件,但 ACE 团队并未为 MINGW 提供它。有事可做...
编辑 2
以下脚本应该在 MingW-64
#! /bin/bash
#
# Configure ACE/TAO for 32/64 bit build with MINGW64
#
# Precondition:
# This script is located in the parent folder of ACE_Wrappers
# File access permissions in ACE_Wrappers allow editing of files (sed):
# Easyest, delivered full ACE/TAO ZIP was extracted using Windows Explorer.
# When extracting with 7z, it will correctly preserve access rights and
# they need to be granted for the user, explicitly
#
# Postcondition:
# ACE is configured for MINGW build
# Script is involutoric
#
# Author: Sam Ginrich
# No warranty of any kind!
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#
# Definition of Setup parameters
# these are entered into configuration files, if not already there, never modified!
#
#
#buildbits= # does nothing
#buildbits=32 # configure 32-bit build
#buildbits=64 # configure 64-bit build
buildbits=64
#winsock2=0 # configure parameter to exclude winsock2 library
#winsock2=1 # configure parameter to include winsock2 library
#winsock2= # does nothing, same effect as winsock2=1
winsock2=
# Issue with header "$ACE_ROOT/ace/OS_NS_stdlib.h"
# In some MINGW installation, the compiler is confused with a defined 'rand_r' macro
# This takes effect when building TAO, not ACE
#
#rand_r_issue= # does nothing, suggested initial value
#rand_r_issue=1 # modifies "$ACE_ROOT/ace/OS_NS_stdlib.h" to #undef-ine macro 'rand_r',
# before impact, suggested when issue occurs
rand_r_issue=
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "ACE/TAO Build Target Values"
echo ""
echo "buildbits=$buildbits"
echo "winsock2=$winsock2"
echo "rand_r_issue=$rand_r_issue"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
echo "STEP: Enter ACE_Wrappers and define locations"
cd ./ACE_Wrappers
# Check, whether we arrives there ...
if [ ! -f "./ACE-INSTALL.html" ]; then
echo "ACE_Wrappers missing or invalid ... STOP"
exit 1
fi
export ACE_ROOT=${PWD}
export TAO_ROOT=${ACE_ROOT}/TAO
# Set C-Config Header for Windows
echo '#include "ace/config-win32.h"' > ace/config.h
# Set Platform MINGW
pl_macro=$ACE_ROOT/include/makeinclude/platform_macros.GNU
pl_mingw='$(ACE_ROOT)/include/makeinclude/platform_mingw32.GNU'
echo "include $pl_mingw" > $pl_macro
if [ "$buildbits" != "" ];
then
echo "------------------------------------------------------------"
echo ""
echo "STEP: Provide support for 64-bit build in 'platform_g++_common.GNU'"
pl_gpp=$ACE_ROOT/include/makeinclude/platform_g++_common.GNU
donetag2=" FLAGS_C_CC += -m64"
marker2="CCFLAGS += -Wnon-virtual-dtor"
buildbitsSwitch="ifeq ($(buildbits),32)\n FLAGS_C_CC += -m32\n LDFLAGS += -m32\nendif\nifeq ($(buildbits),64)\n FLAGS_C_CC += -m64\n LDFLAGS += -m64\nendif"
case `grep -Fx "$donetag2" "$pl_gpp" >/dev/null; echo $?` in
0)
echo "File $pl_gpp already modified "
;;
1)
# anyway store a copy
cp $pl_gpp /tmp
echo "copy of original $pl_gpp stored in \tmp"
echo "insert compiler switches for buildbits rule"
sed -i "s/$marker2/$marker2\n\n$buildbitsSwitch/g" $pl_gpp
;;
*)
echo "Error scanning file $pl_gpp"
;;
esac
echo "------------------------------------------------------------"
echo ""
pl_mingw=$ACE_ROOT/include/makeinclude/platform_mingw32.GNU
echo "STEP: Set parameter for 64-bit build in $pl_mingw"
donetag3="buildbits =.*"
marker3="mingw32 = 1"
buildbitsDef="# 32\/64-bit build\n# parameter 'buildbits' is applied in platform_gnuwin32_common.GNU\nbuildbits = $buildbits"
case `grep -Ex "$donetag3" "$pl_mingw" >/dev/null; echo $?` in
0)
echo "File $pl_mingw already modified "
echo "Verify value! "
grep "buildbits =" $pl_mingw
;;
1)
# anyway store a copy
cp $pl_mingw /tmp
echo "copy of original $pl_mingw stored in \tmp"
echo "insert buildbits=$buildbits"
sed -i "s/$marker3/$marker3\n\n$buildbitsDef/g" $pl_mingw
;;
*)
echo "Error scanning file $pl_mingw"
;;
esac
fi
if [ "$winsock2" != "" ];
then
echo "------------------------------------------------------------"
echo ""
#pl_mingw=$ACE_ROOT/include/makeinclude/platform_mingw32.GNU
echo "STEP: Winsock lack control"
donetag4="winsock2 =.*"
marker4=$marker3
winsockDef="winsock2 = $winsock2"
# $donetag4 is regular expression, -E
case `grep -Ex "$donetag4" "$pl_mingw" >/dev/null; echo $?` in
0)
echo "File $pl_mingw already modified "
echo Verify Value!
grep "winsock2 =" $pl_mingw
;;
1)
# anyway store a copy
cp $pl_mingw /tmp
echo "copy of original $pl_mingw stored in \tmp"
echo insert $winsockDef
sed -i "s/$marker4/$marker4\n\n$winsockDef/g" $pl_mingw
;;
*)
echo "Error scanning file $pl_mingw"
;;
esac
fi
if [ "$rand_r_issue" == "1" ];
then
echo "------------------------------------------------------------"
echo ""
echo "STEP: Handle issue with defined C-macro rand_r"
onsll=$ACE_ROOT/ace/OS_NS_stdlib.h
donetag1="//#rand_undefined"
case `grep -Fx "$donetag1" "$onsll" >/dev/null; echo $?` in
0)
echo "File $onsll already modified"
;;
1)
# anyway store a copy
cp $onsll /tmp
echo "copy of original $pl_gpp stored in \tmp"
echo "insert '#undef rand_r'"
sed -i 's/#if !defined (ACE_LACKS_RAND_R)/\/\/#rand_undefined\n#undef rand_r\n#if !defined (ACE_LACKS_RAND_R)/g' $onsll
;;
*)
echo "Error scanning file $onsll"
;;
esac
fi
echo "============================================================"
echo ""
echo "Content of "$ACE_ROOT/ace/config.h" is"
cat "ace/config.h"
echo ""
echo Content of "$pl_macro" is
cat $pl_macro
echo "-------------------------------------------------------------"
echo ""
echo ""
echo ""
echo "Suggested BUILD STEPS:"
echo ""
echo ""
echo "# 1. Define context"
echo "export ACE_ROOT=${PWD}"
echo "export TAO_ROOT=${ACE_ROOT}/TAO"
echo ""
echo "# 2. Build ACE"
echo 'cd ${ACE_ROOT}/ace'
echo "make -f GNUmakefile"
echo ""
echo "# 3. Verify ACE"
echo 'cd ${ACE_ROOT}/tests'
echo "make -f GNUmakefile"
echo "perl run_test.pl"
echo "#NOTE: Windows Firewall will ask for permission for each upcoming server instance"
echo ""
echo "# 4. Build TAO"
echo 'cd ${TAO_ROOT}'
echo "make -f GNUmakefile"
echo ""
echo "# 5. Basic TAO verification"
echo 'cd ${TAO_ROOT}/tests'
echo "make -f GNUmakefile"
echo 'cd ${TAO_ROOT}/tests/Param_Test'
echo "perl run_test.pl"