Install Ace for Linux

Source: Internet
Author: User

First: Download acepackage, use ace-5.8.tar.gz here, other: http://download.dre.vanderbilt.edu/previous_versions/

Only Ace is installed here, and other packages are not involved.

1. Decompress ace-5.8.tar.gz, tar-xvf ACE-5.8.tar.gz in the directory $ home/ace, and generate the directory ace_wrappers under the current directory. In my Environment: $ home/ace ==/ home/worker/ace

2. Set the ace_root environment variable: (you can set it in/etc/profile (I will set it here), or in. bash_profile under my home directory)

Ace_root =/home/worker/ACE/ace_wrappers
Export ace_root
2. Create two file links for different versions:
In the $ ace_root/ace directory:
Ln-s config-linux.h config. h
Under the $ ace_root/include/makeinclude/directory:
Ln-s platform_linux.gnu platform_macros.gnu
3. Set the environment variable LD_LIBRARY_PATH:
LD_LIBRARY_PATH = $ ace_root/lib: $ LD_LIBRARY_PATH
Export LD_LIBRARY_PATH
(Supplement: note that $ ace_root/lib is not $ ace_root/ace. Many websites write the latter. It seems wrong, at least I didn't compile it)

4. Create the directory build and mkdir build in the directory $ ace_root.

Go to the build directory and run the configuration script ../configure [Options].

Common options include cxxflags =-O3 -- disable-Debug -- disable-ace-examples -- disable-ace-tests -- without-tao.

Supplement: If you want to set the installation path (installed in/usr/local by default), you can add the parameter -- prefix [installation path].

That is: ../configure -- prefix =/usr/local/ace cxxflags =-O3 -- disable-Debug -- disable-ace-examples -- disable-ace-tests -- without-Tao

5. Compile #> make

In this process, some header files may not be found. You need to run the relevant commands to install them. The error I encountered is that the OpenSSL header files do not exist, and all the development packages that require libopenssl Installation

Zypper search * OpenSSL * is used to find all OpenSSL packages and select the required packages for installation. Here libopenssl-devel is required.

Zypper install libopenssl-devel (suselinux is used here, all of which use this command,

Use different commands for other versions, such as centos fedora: Yum search * OpenSSL * Yum install libopenssl-devel)

6. Installation #> make install (Supplement: If installation is performed, the original $ ace_root can be changed to the installed path)

Use epoll in ace5.5:
Ace_wrappers/ACE/config-linux.h, add a line: # define ace_has_event_poll
Add-dace_has_event_poll To The makefile of the application and re-make the application. OK. (Fix: Just add a line in ace_wrappers/ACE/config-linux.h: # define ace_has_event_poll, no need to add-dace_has_event_poll to each application)

Note: many functions in Ace are not compiled by default, such as epoll and fastmemcpy. To use these functions, you must modify config. h file, add the corresponding macro to recompile the ace.

If you want to use the msvc Standard C ++ header, you need to add the definition in ACE/config. h:
# Define ace_has_standard_cpp_library 1
Add the config. h file content as follows:
# Define ace_has_standard_cpp_library 1 // use the standard C ++ Header
# Define ace_no_inline 1 // reduce the size of LIB and exe without using the internal connection Function

7. Test.

# Include <ACE/log_msg.h>
# Include <ACE/OS _main.h>

Using namespace STD;

Int ace_tmain (INT argc, ace_tchar * argv [])
{
Ace_debug (lm_debug, ace_text ("Hello World !")));
Return 0;
}

Compile: G ++-I/usr/local/ACE/include-O0-G3-wall-C-fmessage-length = 0-MMD-MP-MF "helloworld. d "-MT" helloworld. d "-o" demo. O "" demo. CPP"

Link: G ++-I/usr/local/ACE/include-L/usr/local/ACE/lib-role-LRT-lpthread-o "acetest" demo. o

Run:./acetest (Supplement: the LD_LIBRARY_PATH directory at this time must point to the lib directory of ACE, Which is/usr/local/ACE/LIB; otherwise, an error occurs.

Output after successful execution: Hello world!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.