Compile jrtplib and jthread in Linux:

Source: Internet
Author: User

Operating Environment:

Host OS: Windows 7

VMware Workstation: 6.5.1

Guest OS: fedora 9

Develop Board: mini2440

Cross-complier: Arm-Linux-GCC 4.3.2

 

Instructions on jrtp:

Note 1: jrtp has two data receiving methods: the first is to use the thread provided by the jthread library to automatically receive data in the background. The second method is to call the poll method in rtpsession. If you take the first approach to install the jthread library, install the jthread-1.2.1.tar.gz, And the jthread-1.2.1 must first be installed with the jrtp-3.7.1. Because in the configure of the jrtp-3.7.1, it will find whether the system has compiled the jthread library, if there is, then the compiled jrtp library will enable support for jthread. Therefore, if jrtp is compiled first and jthread is compiled, jrtp does not support jthread. If the second method is used, you can directly compile the jrtp library without compiling the jthread library.

 

Jrtp-3.7.1.tar.gzand jthread-1.2.1.tar.gz

Http://research.edm.uhasselt.be /~ Jori/page/index. php? N = cs. jrtplib

 

 

1. compiled for PC:

PS:./configure-help to view some configurable options

Compile jthread-1.2.1

[Root @ localhost PC-jrtp] # tar-zxvf jthread-1.2.1.tar.gz

[Root @ localhost PC-jrtp] # cd jthread-1.2.1

[Root @ localhost jthread-1.2.1] #./configure -- prefix =/opt/mini2440/PC-jrtp

[Root @ localhost jthread-1.2.1] # Make

[Root @ localhost jthread-1.2.1] # make install

Description: -- Prefix = specifies the directory to which the compiled jthread library is installed.

 

The following message is displayed when you execute make install:

-----------------------------------------------------------------

Libraries have been installed in:

/Opt/mini2440/PC-jrtp/lib

 

If you ever happen to want to link against installed Libraries

In a given directory, libdir, you must either use libtool, and

Specify the full pathname of the library, or use the '-llibdir'

Flag during linking and do at least one of the following:

-Add libdir to the 'LD _ LIBRARY_PATH 'environment variable

During execution

-Add libdir to the 'LD _ run_path 'environment variable

During linking

-Use the '-wl, -- rpath-wl, libdir' linker flag

-Have your system administrator add libdir to '/etc/lD. So. conf'

 

See any operating system documentation about shared libraries

More information, such as the LD (1) and LD. So (8) manual pages.

-----------------------------------------------------------------

This section tells us the directory to which the compiled jthread library is installed, and how to compile your own files using this library. You can refer to the static function library and dynamic function library.

 

After the installation is successful, there are two folders: Include and Lib under the specified directory.

Include contains another jthread folder, which contains the header file of the jthread library.

LIB contains the compiled jthread Library: including dynamic library libjthread-1.2.1.so and static library libjthread.

 

(2) Compile the jrtplib-3.7.1

[Root @ localhost PC-jrtp] # tar-zxvf jrtplib-3.7.1.tar.gz

[Root @ localhost PC-jrtp] # cd jrtplib-3.7.1

[Root @ localhost PC-jrtp] #. /configure -- prefix =/opt/mini2440/PC-jrtp/-- With-jthread-supported des =/opt/mini2440/PC-jrtp/include/jthreadldflags =-L/opt/mini2440 /PC-jrtp/lib

Note:

-- Prefix = -- prefix: Specifies the directory to which the compiled jrtplib library is installed.

-- With-jthread-connector des: Specifies the directory in which the header file of the previously installed jthread library is installed. This option is not required if jthread is not required.

Ldflags: the path of the dynamic library to be connected during compilation. This option is not required if jthread library support is not required.

 

The following message appears during configure:

Checking for jthread include files... in "/opt/mini2440/PC-jrtp/include/jthread"

Checking jthread version...> = 1.1.0

Checking if we can link against jthread and pthread... yes

This indicates that the jthread path is correct and jthread support is enabled in the configuration file.

 

Then make and make install

[Root @ localhost jrtplib-3.7.1] # Make

[Root @ localhost jrtplib-3.7.1] # make install

If the source file is not modified, the following errors may occur during the make process:

In fedora 9, make prompts the following error:

Rtppacket. cpp: 311: Error: 'memcpy' was not declared in this scope

Or:

In fedora 13, make prompts the following error:

Rtperrors. cpp: In function 'std: String rtpgterrorstring (INT )':

Rtperrors. cpp: 225: Error: 'snprintf' was not declared in this scope

To make successful, you need to modify the jrtplib-3.7.1 source file rtpdefines. h

Add the following statement:
# Include <stdio. h>
# Include <stdarg. h>
# Include <string. h>

The procedure is as follows:

[Root @ localhost jrtplib-3.7.1] # cd src/

[Root @ localhost SRC] # Vim rtpdefines. h

// Rtpdefines. h

75 # include <stdio. h>

76 # include <stdarg. h>

77 # include <string. h>

78 # If (defined (win32) | defined (_ win32_wce ))

79 # If (! Defined (_ win32_wce) & (defined (_ msc_ver) & _ msc_ver> = 1400)

80 # define rtp_snprintf _ snprintf_s

81 # else

82 # define rtp_snprintf _ snprintf

83 # endif

84 # else

85 # define rtp_snprintf snprintf

86 # endif // Win32 | _ win32_wce

Make again.

 

Make isntall has the following information:

-----------------------------------------------------------------

Libraries have been installed in:

/Opt/mini2440/PC-jrtp/lib

 

If you ever happen to want to link against installed Libraries

In a given directory, libdir, you must either use libtool, and

Specify the full pathname of the library, or use the '-llibdir'

Flag during linking and do at least one of the following:

-Add libdir to the 'LD _ LIBRARY_PATH 'environment variable

During execution

-Add libdir to the 'LD _ run_path 'environment variable

During linking

-Use the '-wl, -- rpath-wl, libdir' linker flag

-Have your system administrator add libdir to '/etc/lD. So. conf'

 

See any operating system documentation about shared libraries

More information, such as the LD (1) and LD. So (8) manual pages.

-----------------------------------------------------------------

This section tells us the directory to which the compiled jrtp library is installed, and how to compile your own files using this library.

 

After the installation is successful, there are two folders: Include and Lib under the specified directory.

Include contains a jrtplib folder containing the header file of the jrtplib library.

LIB contains the compiled jrtp Library: including dynamic library libjrtp-3.7.1.so and static library libjrtp..

 

 

2. compiled for mini2440 (ARM:

The procedure is the same as that used for compiling a PC, but the configure settings are different:

(1) For jthread

./Configure -- prefix =/opt/mini2440/ARM-jrtp-host = arm-Linux cc = arm-Linux-GCC cxx = arm-Linux-G ++

(2) For jrtlib

. /Configure-Prefix =/opt/mini2440/ARM-jrtp-host = arm-Linux-with-jthread-supported des =/opt/mini2440/ARM-jrtp/replicdes cc = arm- linux-gcccxx = arm-Linux ldflags =-L/opt/mini2440/ARM-jrtp/lib

The following message is displayed:

Assuming target is big endian:

The script detected a cross-compiler on your system. This can mean that

There really is a cross-compiler installed, or that for some other reason,

A simple program cocould not be run. You shoshould check the config. Log File

To verify this.

Since we are assuming a cross-compiler, we won't be able to actually test

Any program. More important, we cannot test if the system is big or little

Endian.

For now, big endian is assumed. If this assumption shocould be wrong, you will

Have to comment the appropriate line in 'rtpconfig _ Unix. H'

Description: Configure sets the target platform to the big-end mode by default. To change the value, modify rtpconfig _ Unix. h.

 

We should test whether the development board is a big-end mode or a small-end mode:

For what is the big-end mode, what is the small-end mode, and why you want to test it, please refer to the big-end mode and the Small-end mode on my blog.

 

Test procedure:

1 # include

2 int main (void)

3 {

4 int num = 0x1234;

5 char * P = & num;

6 if (* P = 0x12 ){

7 printf ("Big endian/N ");

8}

9 else {

10 printf ("little endian/N ");

11}

12 Return 0;

13}

After saving the file, compile the executable file with the cross compiler and put it on the Target Platform for execution. To determine the model of the target platform.

The test shows that mini2440 is in the small-end mode by default. Therefore, you need to modify rtpconfig _ Unix. h.

File in:

/Opt/mini2440/ARM-jrtp/jrtplib-3.7.1/src

The modification operation is as follows:

33 # ifndef rtpconfig_unix_h

34

35 # define rtpconfig_unix_h

36

37 // don't have

38

39 // don't have

40

41 // # define rtp_big_endian // comment this if the target is a little endian System

42

43 # define rtp_socklentype_uint

Comments the 41st rows. After the annotation, It is compiled in the small segment mode.

Then you can make and make install.

 

3. The last step is to test:

(1) first copy the library file compiled for PC: libjrtp-3.7.1.so and libjthread. So to/lib of fedora9.

(2) The Library file generated after the cross-Compilation: libjrtp-3.7.1.so and libjthread. So copied to the Development Board/lib.

(3) Run exampl4 under/opt/mini2440/PC-jrtp/jrtp-3.7.1/example.

[Root @ localhost examples] #./example4

Enter local portbase:

9090

 

 

Number of seconds you wish to wait:

500

 

(4) copy the/opt/mini2440/ARM-jrtp/jrtp-3.7.1/example directory to the Development Board and execute exampl1.

[Root @ friendlyarm download] #./example1

Enter local portbase:

9090

 

Enter the destination IP address

192.168.0.2

Enter the destination port

9090

 

Number of packets you wish to be sent:

50

 

(5) If got packet appears on the PC, it means you can receive the data packet sent from the Development Board.

Got packet 32390 from SSRC 609572025

Got packet 32391 from SSRC 609572025

.......

From: http://blog.csdn.net/elevenxjz/article/details/6043369

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.