OpenWrt compilation environment record (for the latest official website of 2015.01.20 r000068 trunk) and openwrtr000068

Source: Internet
Author: User

OpenWrt compilation environment record (for the latest official website of 2015.01.20 r000068 trunk) and openwrtr000068
Preface

We have already set up the OpenWrt compiling environment under MacOS, but we didn't expect to update it to the latest official Trunk. This is the nightmare. Now we will record the thinking process and response methods.


Background

We recommend that you use MacPorts to build related tools in MacOS in OpenWrt. MacOS comes with gcc. The version information is as follows:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)Target: x86_64-apple-darwin13.4.0Thread model: posix
If the mp-gcc49 is installed, gcc is created in the/opt/local/bin directory with the following version information:

gcc (MacPorts gcc49 4.9.2_1) 4.9.2Copyright (C) 2014 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
When building the compilation environment, two gcc switches may be required (after one error occurs, switch to another ).

First, make sure that the following macports tool library is installed

sudo port install coreutils e2fsprogs ossp-uuid asciidoc binutils bzip2 \  fastjar flex getopt gtk2 intltool jikes hs-zlib openssl p5-extutils-makemaker \  python26 subversion rsync ruby sdcc unzip gettext libxslt bison gawk \  autoconf wget gmake ncurses findutils gnutar mpfr libmpc gcc49
Note: mpfr libmp C is not required. When compiling gcc, the system will automatically compile the two libraries from the source code. However, if you use llvm-gcc for compiling, the following error may occur:

checking for the correct version of the gmp/mpfr/mpc libraries... noconfigure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify

Problem description Question 1:

Undefined symbols for architecture x86_64:  "_iconv", referenced from:      convert_using_iconv(void*, unsigned char const*, unsigned long, _cpp_strbuf*) in libcpp.a(charset.o)     (maybe you meant: __Z14cpp_init_iconvP10cpp_reader, __cpp_destroy_iconv )  "_iconv_close", referenced from:      __cpp_destroy_iconv in libcpp.a(charset.o)      __cpp_convert_input in libcpp.a(charset.o)  "_iconv_open", referenced from:      init_iconv_desc(cpp_reader*, char const*, char const*) in libcpp.a(charset.o)ld: symbol(s) not found for architecture x86_64

When this happens, it means that you are using a mp-gcc49 compiled, there is a description of this error at this address

Http://stackoverflow.com/questions/12619600/libiconv-and-macos

The libiconv of macports is inconsistent with that of mac systems. You need to make the following changes:

1. Switch to the gcc of the mac system

2. Enter staging_dir/host/usr, create and enter the lib directory, and create a symbolic link starting with libiconv in/opt/local/lib /.


Question 2:

Undefined symbols for architecture x86_64:  "_ERR_remove_thread_state", referenced from:      _rsa_sign in rsa-sign.old: symbol(s) not found for architecture x86_64
This problem is the most strange. There is no explanation of this problem on the Internet. After carefully checking the error information, we find that there is

HOSTLDFLAGS = ""

In the Makefile of mkimage, modify

#HOSTLDFLAGS="$(HOST_STATIC_LINKING)"define Host/Compile  -C $(HOST_BUILD_DIR) defconfig  $(MAKE) -C $(HOST_BUILD_DIR) \  HOSTLDFLAGS="-L/opt/local/lib" \  tools-onlyendef

In fact HOSTLDFLAGS are defined in the include/host-build.mk:

ifneq ($(HOST_OS),Darwin)  ifeq ($(CONFIG_BUILD_STATIC_TOOLS),y)    HOST_STATIC_LINKING = -static  endifendi

If it is not Darwin (MacOS), it is set to-static. Otherwise, otherwise, what else !? No value is set. You can modify this field:

ifneq ($(HOST_OS),Darwin)  ifeq ($(CONFIG_BUILD_STATIC_TOOLS),y)    HOST_STATIC_LINKING = -static  endifelse  HOST_STATIC_LINKING = -L/opt/local/libendif

Summary

I have been entangled in the handling of the second problem for a long time. It seems that building the OpenWrt compiling environment under MacOS is indeed a tough move.




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.