前列腺钙化
前列腺钙化的我,如何拯救输卵管堵塞的你。

OS: ubuntu-14.04.5-desktop-amd64.iso

jdk:jdk-6u45-linux-x64

android: android-4.0.1_r1

 //中科大源https://lug.ustc.edu.cn/wiki/mirrors/help/aosp

网上看一堆啰嗦又没成功。

 

首先给右键添加个终端

设置Ubuntu 14.04右键终端的方法如下

首先要安装一个包,即可在右键里面添加一个“打开终端”的菜单。

sudo apt-get install nautilus-open-terminal

 

1.首先配置基础编译环境

 

#sudo apt-get install gnupg flex bison gperf build-essential zip  curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos Python-markdown libxml2-utils xsltproc zlib1g-dev:i386 dpkg-dev Git

 黑体的可以不安,因为编译用的是32位的libGL 下面安装32位的

ubuntu-14已经安装了libcheese-gtk23libcheese7所以现在更新源会报错,把之前的卸载了

sudo apt-get autoremove libcheese-gtk23 libcheese7

然后:

sudo apt-get install libgl1-mesa-dri:i386   安装这个后重启黑屏

 

1、/usr/bin/ld.bfd.real: cannot find -lGL

 

查看了一些资料,因为编译的时候还是用到了32BIT的libGL.so libX11.so库文件,编译的时候找的不是X86_64库文件配置,而是找的是I386库文件配置

 

$ sudo apt-get install libgl1-mesa-glx:i386

由于libGL.so系统默认没有进行库路径下的链接,还需要手动链接一下

$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

 

 

 

2.安装jdk SE 6

 

1、下载JDK6安装包,我的为64位系统所以选择jdk-6u45-linux-x64.bin

下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html

2、解压jdk-6u45-linux-x64.bin,解压出对应的jdk-6u45文件夹,命令是:

$ chmod u+x jdk-6u45-linux-x64.bin

$ ./jdk-6u45-linux-x64.bin

 

3、然后移动解压出jdk-6u45文件夹到/usr/lib下,进入在存放jdk文件夹的当前目录,将解压好的jdk-6u45文件夹用最高权限复移动到/usr/lib/jvm目录里,此时即使没有jvm目录也可以执行如下命令,jvm文件夹将得到创建。

 

$ sudo mkdir -p /usr/lib/jvm/(可有可无)

$ sudo mv jdk-6u45 /usr/lib/jvm/

 

安装好之后,接下来需要设置环境变量,进入当前用户名的主文件夹,修改.profile文件。注意,该文件是当前用户的配置文件,如果要对使用计算机的所有用户生效,那么需要设置的文件应该是 /etc/profile。输入命令:

sudo gedit ~/.profile

在文件末尾加上:

export JAVA_HOME=/usr/lib/jvm/jdk-6u45

export JRE_HOME=/usr/lib/jvm/jdk-6u45/jre

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH

export PATH=$JAVA_HOME/bin:$PATH

 

然后是更改生效

$ source ~/.profile

 

使用java -version命令可以看到如下输出:

 

www.linuxidc.com@linux:~$ java -version

java version "jdk-6u45"

Java(TM) SE Runtime Environment (build jdk-6u45-b18)

Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

 

到此,已经将oracle jdk配置完成。

 

3.下载源码

因为GFW的原因,无法google 国内有清华大学源。

https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/

下载 repo 工具:

mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

修改Repo文件

使用gedit ~/bin/repo 文件

REPO_URL = 'https://gerrit.googlesource.com/git-repo'

替换为

REPO_URL = 'https://gerrit-google.tuna.tsinghua.edu.cn/git-repo'

 

建立工作目录:

mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY

然后设置git账号和名字

 git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

我要同步4.0.1的源码
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-4.0.1_r1

开始同步
repo sync

代码下载完成

4.编译
make
会有两个错误,参照下面的内容解决










编译Android源码,按照installing-required-packages-ubuntu-1204提供方法先安装必要的工具。

 

以下是编译android 4.0.3的常见错误,这些错误的解决办法收录自互联网。

Google group有个专门的Android Building组,有兴趣的可以加入。


有转载这里的也有添加的。

################# Fix 1 ##########################

Error:

frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::sp<AaptDir> >’ are not found by unqualified lookup

frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/AaptAssets.o] Error 1

Fix:
vi frameworks/base/tools/aapt/Android.mk

Add '-fpermissive' to line 31:
LOCAL_CFLAGS += -Wno-format-y2k -fpermissive

################## Fix 2 ##########################

Error:
frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::wp<android::AssetManager::SharedZip> >’ are not found by unqualified lookup

frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/AssetManager.o] Error 1

Fix:
vi frameworks/base/libs/utils/Android.mk

Add '-fpermissive' to line 64:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive

################## Fix 3 ##########################

Error:
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:11: note: use ‘this->SetState’ instead
make: *** [out/host/linux-x86/obj/EXECUTABLES/grxmlcompile_intermediates/grxmlcompile.o] Error 1

Fix:
cd external/srec
wget "https://github.com/CyanogenMod/android_external_srec/commit/4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff"
patch -p1 < 4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
rm -f 4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
cd ../..

################## Fix 3.1 ##########################

Error:
host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp
host C: parseStringTest <= external/srec/tools/parseStringTest/parseStringTest.c
<命令行>:0:0: 错误: “_FORTIFY_SOURCE”重定义 [-Werror]
frameworks/base/tools/obbtool/Main.cpp:1:0: 附注: 这是先前定义的位置

make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] 错误 1

Fix:
vi build/core/combo/HOST_linux-x86.mk  line56
Add  -U_FORTIFY_SOURCE
HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

################## Fix 4 ##########################

Error:
development/tools/emulator/opengl/host/tools/emugen/main.cpp:79:9: error: ‘optind’ was not declared in this scope
development/tools/emulator/opengl/host/tools/emugen/main.cpp:92:45: error: ‘optind’ was not declared in this scope
make: *** [out/host/linux-x86/obj/EXECUTABLES/emugen_intermediates/main.o] Error 1

Fix:
vi development/tools/emulator/opengl/host/tools/emugen/main.cpp

Add '#include <getopt.h>' to list of includes:
#include <getopt.h>

################## Fix 5 ##########################

Error:
host C++: liboprofile_pp <= external/oprofile/libpp/arrange_profiles.cpp
In file included from external/oprofile/libpp/arrange_profiles.cpp:24:0:
external/oprofile/libpp/format_output.h:94:22: error: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/arrange_profiles.o] Error 1

Fix:
vi external/oprofile/libpp/format_output.h

Remove 'mutable' from 'mutable counts_t & counts;' on line 94:
counts_t & counts;

################## Fix 6 ##########################

Error:
development/tools/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp:345:65:   required from here

frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<unsigned int, ShaderData*>’ are not found by unqualified lookup

frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libOpenglCodecCommon_intermediates/GLSharedGroup.o] Error 1

Fix:
vi development/tools/emulator/opengl/Android.mk

Add '-fpermissive' to line 25:
EMUGL_COMMON_CFLAGS := -DWITH_GLES2 -fpermissive

################## Fix 7 ##########################

Error:
/usr/bin/ld: note: 'XInitThreads' is defined in DSO /lib/libX11.so.6 so try adding it to the linker command line
/lib/libX11.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/emulator_renderer] Error 1

Fix:
vi development/tools/emulator/opengl/host/renderer/Android.mk

Add new entry 'LOCAL_LDLIBS += -lX11' after line 6 as shown:
LOCAL_SRC_FILES := main.cpp
LOCAL_CFLAGS    += -O0 -g
LOCAL_LDLIBS += -lX11

#ifeq ($(HOST_OS),windows)
#LOCAL_LDLIBS += -lws2_32 

################## Fix 8 ##########################

Error:
external/llvm/include/llvm/ADT/PointerUnion.h:56:10: error: enumeral mismatch in conditional expression: ‘llvm::PointerLikeTypeTraits<llvm::PointerUnion<clang::Stmt*, const clang::Type*> >::<anonymous enum>’ vs ‘llvm::PointerLikeTypeTraits<clang::ObjCInterfaceDecl*>::<anonymous enum>’ [-Werror]
cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs.o] Error 1

Fix:
vi frameworks/compile/slang/Android.mk

Remove '-Werror' from line 22:
local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter 

################## Fix 9 ##########################

Error:
frameworks/base/libs/rs/rsFont.cpp:224:76:   required from here

frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<unsigned int, android::renderscript::Font::CachedGlyphInfo*>’ are not found by unqualified lookup

frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libRS_intermediates/rsFont.o] Error 1

Fix:
vi frameworks/base/libs/rs/Android.mk

Add '-fpermissive' to line 183
LOCAL_CFLAGS += -Werror -Wall -Wno-unused-parameter -Wno-unused-variable -fpermissive

################## Fix 10 #########################

Error:
external/mesa3d/src/glsl/linker.cpp:1394:49: error: expected primary-expression before ‘,’ token
......
external/mesa3d/src/glsl/linker.cpp:1734:59: error: ‘offsetof’ was not declared in this scope
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o] Error 1

Fix:
vi external/mesa3d/src/glsl/linker.cpp

Add '#include <stddef.h>' to list of includes as shown: 
#include <climits>
#include <stddef.h>
#include <pixelflinger2/pixelflinger2_interface.h>

################## Fix 11 #########################

Error:
external/gtest/src/../include/gtest/gtest-param-test.h:287:58: note: ‘template<class Container> testing::internal::ParamGenerator<typename Container::value_type> testing::ValuesIn(const Container&)’ declared here, later in the translation unit
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libgtest_host_intermediates/gtest-all.o] Error 1

Two fixes required:
1)
vi external/gtest/src/Android.mk

Add '-fpermissive' to lines 52 and 70 (both lines contain same info)
LOCAL_CFLAGS += -O0 -fpermissive

2)
vi external/gtest/include/gtest/internal/gtest-param-util.h

Add '#include <stddef.h>' to list of includes as shown:
#include <vector>
#include <cstddef>
#include <gtest/internal/gtest-port.h>
 
################## Fix 12 #########################
Error:

host Executable: test-librsloader (out/host/Linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader)
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Signals.o):在函数‘PrintStackTrace’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Unix/Signals.inc:219:对‘dladdr’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Unix/Signals.inc:231:对‘dladdr’未定义的引用
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Threading.o):在函数‘llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Threading.cpp:96:对‘pthread_create’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Threading.cpp:100:对‘pthread_join’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Threading.cpp:91:对‘pthread_attr_setstacksize’未定义的引用
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Mutex.o):在函数‘llvm::sys::MutexImpl::MutexImpl(bool)’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:69:对‘pthread_mutexattr_init’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:75:对‘pthread_mutexattr_settype’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:80:对‘pthread_mutexattr_setpshared’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:89:对‘pthread_mutexattr_destroy’未定义的引用
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Mutex.o):在函数‘llvm::sys::MutexImpl::tryacquire()’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:143:对‘pthread_mutex_trylock’未定义的引用
collect2: 错误: ld 返回 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] 错误 1

Fix:

$vi external/llvm/llvm-host-build.mk +
文件开头添加   LOCAL_LDLIBS := -lpthread -ldl

 

 

make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libdvm_intermediates/native/dalvik_system_Zygote.o] 错误 1

需要在源码前面添加头部文件#include <sys/resource.h>

 

make[3]: *** [out/target/common/docs/doc-comment-check-timestamp] Error 45

 

只需打如下命令 即可:$ make clobber       $ make

 

 

host StaticLib: libGLcommon (out/host/linux-x86/obj/STATIC_LIBRARIES/libGLcommon
 _intermediates/libGLcommon.a)
 host SharedLib: libGLES_CM_translator (out/host/linux-x86/obj/lib/libGLES_CM_tra
 nslator.so)
 /usr/bin/ld: cannot find -lGL
 collect2: ld returned 1 exit status
 make: *** [out/host/linux-x86/obj/lib/libGLES_CM_translator.so] Error 1


解决方法: sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2 /usr/lib/libGL.so 

在网上搜到上面的解决方法,可是按照上述方法做了,问题依旧。经过多方实验,才发现问题所在。通过apt-get install的库不是libGL.so.1.2了。而是libGL.so.1.2.0.
 
所以大家在创建链接的时候最好去/usr/lib/i386-linux-gnu/mesa/这个目录下看看libGL的库版本,不要完全按照网上的照抄。现在网上的都是“sudo 
 
ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2 /usr/lib/libGL.so ”而我的是sudo 
 
sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0  /usr/lib/libGL.so 。可能库最近升级了。路径也可能有差别

 

 

external/llvm/lib/ExecutionEngine/JIT/Intercept.cpp: 在构造函数‘{anonymous}::StatSymbols::StatSymbols()’中: external/llvm/lib/ExecutionEngine/JIT/Intercept.cpp:69:67: 错误: ‘lseek64’在此作用域中尚未声明 make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMJIT_intermediates/Intercept.o] 错误 1

 

external/llvm/lib/ExecutionEngine/JIT/Intercept.cpp中添加头文件

 

 

#define _LARGEFILE64_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>

 

 

1. 出错以下出错信息:

  1. Import includes file: out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/import_includes  
  2. target Generated: libwebcore <= external/webkit/Source/WebCore/css/tokenizer.flex  
  3. <span style="rgb(255, 255, 51);">Can't locate Switch.pm in @INC (you may need to install the Switch module)</span> (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Source/WebCore/make-hash-tools.pl line 23.  
  4. BEGIN failed--compilation aborted at external/webkit/Source/WebCore/make-hash-tools.pl line 23.  
  5. Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Source/WebCore/make-hash-tools.pl line 23.  
  6. BEGIN failed--compilation aborted at external/webkit/Source/WebCore/make-hash-tools.pl line 23.  
  7. make: *** [out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/html/DocTypeStrings.cpp] Error 2  
  8. make: *** Waiting for unfinished jobs....  
  9. make: *** [out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/platform/ColorData.cpp] Error 2  
  10. target Generated: libwebcore <= external/webkit/Source/WebCore/html/parser/HTMLEntityNames.in  


解决方法是安装perl的switch库:

    1. sudo apt-get install libswitch-perl 

 

 

20150103补充:编译sdk时遇到不少的问题

build/core/main.mk:670: *** Module 'AlarmProvider' in PRODUCT_PACKAGES has nothing to install!。

Indeed there is no a module with name AlarmProvider in the source tree now.
To fix it, remove AlarmProvider from the product definition in the following files:
./build/target/product/large_emu_hw.mk:25:    AlarmProvider
./build/target/product/generic_no_telephony.mk:24:    AlarmProvider

只去掉generic_no_telephony.mk就可以过,但是不过的东西太多了。
我想是main.mk中的判断方法有误,因为同样一个文件,编译镜像就可以过,编译sdk就过不了。

参考:
1.http://blog.csdn.NET/mr_raptor/article/details/7394091
2.https://groups.google.com/forum/#!topic/android-building/kbhPdb6osms
暂时还没有解决。

 
root下make需要设置jdk
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 300  
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 300  
sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk1.6.0_45/bin/javah 300
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 300
 


查看可切换的分支
cd .repo/manifests
git branch -a | cut -d / -f 3

 

posted on 2017-06-26 10:00  龙城狂拽酷炫霸  阅读(813)  评论(0编辑  收藏  举报