Home > OS >  Newsletter for 4412 development board compile the compilation and cross compile project
Newsletter for 4412 development board compile the compilation and cross compile project

Time:09-26

The project has on the environment:
(1) ubuntu12.04
(2) the compiler: GCC version 20160904 5.4.1 (Ubuntu ubuntu1 5.4.1-2-12.04)
(3) a cross-compiler: GCC version 4.4.1 (Sourcery g + + Lite q3 2009-67)
(4) system for x86_64

The makefile file contents:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * a makefile start * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
CROSS_COMPILE=arm - none - Linux - gnueabi -
# CROSS_COMPILE=

The TAR=CTL. Bin
OBJS=main. O sys. 1 o o dm. O \
Ver. O var. O const_data. O gpio. O \
Public_config. O \
XML. O private_config. O STR. O file_info. O pipe. O pipe_cmd. O \
Process_mutex. O zlog_interface. O \
Event_core. O dm_epoll. O timer. O \
Socket. O sp_frame_analyse. O commun. O \
Cmd_core. O \
Dm_flow. O \
Monitor. O \
Dev_state. O \
Online. O \
Serial_port. O \
Info_census. O tick. O ab_process. O \
Abnormal. O abnormal_act. O abnormal_simulate. O ab_interface. O \
Conf_coprocess_module. O
CC=$(CROSS_COMPILE GCC)
CFLAGS=- g - O2 - Wstrict - as - Wno - unused - function - I/usr/include/libxml2 - I/usr/include/- STD=gnu11

LDFLAGS=- pthread - lxml2 LRT - lzlog

$(TAR) : $(OBJS)
$(CC) $$(CFLAGS) - o (TAR) $(OBJS) $(LDFLAGS)
Rm - rf *. O
Clean:
Rm - rf *. O $(TAR)

Ifneq (" $V ", "1")
Q=@
Endif
%. O: c
%.@ echo "\ [1; 35 m $033 (CC) $@ \ [0 033 m"
$(Q) $(CC) - pipe $(CFLAGS) - c - o $@ $& lt;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * a makefile end * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
When using "CROSS_COMPILE=" compiler to compile, but using "CROSS_COMPILE=arm - none - Linux - gnueabi -" compile time appeared the following three questions:
Cc1 (1) : error: unrecognized command line option "- STD=gnu11";
(2) the cc1: warning: include the location "/usr/include/libxml2" is unsafe for cross - compilation; Cc1: warning: include the location "/usr/include" is unsafe for cross - compilation,
Have been trying to - STD=gnu11 instead - STD=gnu99 can be compiled, but an error
"Socket. C: 262: error: impossible constraint in 'asm'
Socket. C: 233: error: invalid 'asm' : invalid operand for code 'w'
{standard input} : Assembler messages:
{standard input} : 261: Error: bad instruction ` rorw $8, '
Make: * * */socket. O Error 1 ",

This project has been in the environment: (1) ubuntu16.04 LTS (2) the compiler: GCC version 20160904 5.4.1 (Ubuntu ubuntu1 5.4.1-2-12.04) and (3) a cross-compiler: GCC version 6.3.0 (crosstool - NG crosstiil - NG - 1.23.0)
(4) system for i686
In the GCC and cross compiler can be compiled through,

The makefile file contents:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * a makefile start * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
CROSS_COMPILE=arm - Linux -
# CROSS_COMPILE=

The TAR=CTL. Bin
OBJS=main. O sys. 1 o o dm. O \
Ver. O var. O const_data. O gpio. O \
Public_config. O \
XML. O private_config. O STR. O file_info. O pipe. O pipe_cmd. O \
Process_mutex. O zlog_interface. O \
Event_core. O dm_epoll. O timer. O \
Socket. O sp_frame_analyse. O commun. O \
Cmd_core. O \
Dm_flow. O \
Monitor. O \
Dev_state. O \
Online. O \
Serial_port. O \
Info_census. O tick. O ab_process. O \
Abnormal. O abnormal_act. O abnormal_simulate. O ab_interface. O \
Conf_coprocess_module. O
CC=$(CROSS_COMPILE GCC)
CFLAGS=- g - O2 - Wstrict - as - Wno - unused - function - I/usr/include/libxml2
# CFLAGS +=-fpic fstack - protector - param=SSP - buffer size=4 - Wformat - Wformat ws-security - Wl, z, relro, z, now - probably - as - men - Wl, - no - copy - dt - men - entries - Wl, z, noexecstatck - Wl, z, noexecheap -w
# CFLAGS +=- finput - charset=GB2312 - fexec - charset=utf-8

LDFLAGS=- pthread - lxml2 LRT - lzlog

$(TAR) : $(OBJS)
$(CC) $$(CFLAGS) - o (TAR) $(OBJS) $(LDFLAGS)
Rm - rf *. O
Clean:
Rm - rf *. O $(TAR)

Ifneq (" $V ", "1")
Q=@
Endif
%. O: c
%.@ echo "\ [1; 35 m $033 (CC) $@ \ [0 033 m"
$(Q) $(CC) - pipe $(CFLAGS) - c - o $@ $& lt;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * a makefile end * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  • Related