FORUMS
Remove All Ads from XDA

[GUIDE] Building CyanogenMod 9 from Source with openSuSE 12.1

117 posts
Thanks Meter: 35
 
By riggnix, Senior Member on 8th November 2012, 04:08 PM
Post Reply Email Thread
Introduction
If you have tried to build Android on systems other than Ubuntu (or Ubuntu based systems) you may have noticed, that there are pretty much no guides for other systems.
I finally set up my openSuSE to build CM9 successfully, and would like to share the process with you.
I will also try to adopt this guide for CM10 if i find the time.
If you find mistakes feel free to post them here or PM me.


Contents
  1. Requirements
  2. About this guide
  3. Install "Oracle JDK"
  4. Install other needed packages
  5. Install "make 3.81"
  6. Install "Android SDK"
  7. Set up source directories
  8. Set up "repo"
  9. Set up repositories
  10. Update source code
  11. Update device specific source code
  12. Copy proprietary files
  13. Download prebuilts
  14. Build CyanogenMod 9
  15. Done!
  16. Possible build errors on openSuSE
    Credits


1. Requirements
  • openSuSE 12.1 64bit (may work on other versions too)
  • a good internet connection
  • as much RAM as possible (at least 2GB to finish a build, but that will take very, very long.)
  • patience
  • common sense
Note: I did all this in a virtual machine, but i highly recommend installing Linux on your hardware. Building Android takes a long time even on high end hardware.


2. About this guide
  • Lines beginning with '$' are supposed to be entered in shell (without the $ sign).
  • File names are bold.
  • This guide assumes that you set up the sources at ~/android/system/. Feel free to change that.
  • bacon = device name (e.g. i9300 for Samsung Galaxy SIII I9300. See CyanogenMod Homepage for other devices.)


3. Install "Oracle JDK"
  1. Download latest jdk-6uXX-linux-x64-rpm.bin from http://www.oracle.com/technetwork/ja...s-1637591.html
  2. $ <downloadfolder>/jdk-6uXX-linux-x64-rpm.bin -x
  3. Open <downloadfolder> in your file manager
  4. Right click jdk-6uXX-linux-x64-rpm -> open with -> Install Software
  5. YaST Software Manager will open up.
  6. DON'T click accept yet.
  7. Search for openJDK and check uninstall for ALL openJDK packages.
  8. DON'T click accept yet, go to next chapter.


4. Install other needed packages
  1. Search and install following packages with YaST
    • git
    • gnupg
    • flex
    • bison
    • gperf
    • SDL-devel
    • esound-devel
    • wxGTK-devel
    • zip
    • curl
    • ncurses-devel
    • ncurses-devel 32bit
    • zlib-devel
    • zlib-devel 32bit
    • gcc-c++
    • glibc-devel 32bit
    • libstdc++ 32bit
    • mesa libs
  2. Now click accept.


5. Install "make 3.81"
Note: Other versions won't work.
  1. Download source from http://ftp.gnu.org/gnu/make/make-3.81.tar.gz.
  2. Extract downloaded file.
  3. $ cd <extracted folder>
  4. $ ./configure
  5. $ make
  6. $ make install


6. Install "Android SDK"
Note: This is pretty straightforward. I will add this section later.


7. Set up source directories
  1. $ mkdir ~/android
  2. $ mkdir ~/android/system
  3. $ mkdir ~/android/cache


8. Set up "repo"
Note: "repo" is a tool by Google, created to make access to git and gerrit very, very easy.
  1. $ mkdir ~/bin
  2. $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
  3. $ chmod a+x ~/bin/repo
  4. Open ~/.bashrc in a file editor (e.g. kwrite)
  5. Add the following line:
    • PATH=~/bin:$PATH
  6. Save and close.
  7. Close your shell and re-open it.


9. Set up repositories
  1. $ cd ~/android/system
  2. $ repo init -u git://github.com/CyanogenMod/android.git -b ics


10. Update source code
  1. $ cd ~/android/system
  2. $ repo sync -jX
    • X = number of connections. Try X = 1 if there are problems downloading.
    • This will take a while.


11. Update device specific source code
  1. $ cd ~/android/system
  2. $ . build/envsetup.sh && breakfast bacon


12. Copy proprietary files
Note: This only needs to be run once. You will need CyanogenMod 9 running on the device you are building for to complete this.
  1. Connect the phone via USB.
  2. Install USB drivers to get ADB access.
  3. $ cd ~/android/system/device/<manufacturer>/<devicename>
  4. $ ./extract-files.sh


13. Download prebuilts
  1. $ ~/android/system/vendor/cm/get-prebuilts


14. Build CyanogenMod 9
  1. $ ~/android/system
  2. $ . build/envsetup.sh && brunch bacon


15. Done!
You now should have a CWM-flashable .zip file ~/android/system/out/target/product/maguro/cm-9-XXXXX-UNOFFICIAL-bacon.zip.


16. Possible build errors on openSuSE
Because Ubuntu is based on Debian and openSuSE is based on Slackware, you will probable get some build errors. In post 2 is a list of errors that can occur and how to fix them.


Credits
The Following 6 Users Say Thank You to riggnix For This Useful Post: [ View ] Gift riggnix Ad-Free
8th November 2012, 04:08 PM |#2  
riggnix's Avatar
OP Senior Member
Flag Graz
Thanks Meter: 35
 
More
Lightbulb
Possible build errors on openSuSE
Note: I used kwrite as text editor. To use another, just change kwrite to whatever editor you want to use.
Note: Open shell and got to ~/android/system


Error 1
make gets killed at some point

Fix: you need more RAM to finish the build.


Error 2
Code:
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:
  • $ kwrite frameworks/base/tools/aapt/Android.mk
  • Add '-fpermissive' to line 31:
    • LOCAL_CFLAGS += -Wno-format-y2k -fpermissive


Error 3
Code:
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:
  • $ kwrite frameworks/base/libs/utils/Android.mk
  • Add '-fpermissive' to line 64:
    • LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive


Error 4
Code:
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 ../..


Error 5
Code:
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:
  • $ kwrite development/tools/emulator/opengl/host/tools/emugen/main.cpp
  • Add '#include <getopt.h>' to list of includes:
    • #include <getopt.h>


Error 6
Code:
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:
  • $ kwrite external/oprofile/libpp/format_output.h
  • Remove 'mutable' from 'mutable counts_t & counts;' on line 94:
    • counts_t & counts;


Error 7
Code:
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:
  • $ kwrite development/tools/emulator/opengl/Android.mk
  • Add '-fpermissive' to line 25:
    • EMUGL_COMMON_CFLAGS := -DWITH_GLES2 -fpermissive


Error 8
Code:
/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:
  • $ kwrite 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


Error 9
Code:
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::eek:bjCInterfaceDecl*>::<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:
  • $ kwrite frameworks/compile/slang/Android.mk
  • Remove '-Werror' from line 22:
    • local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter


Error 10
Code:
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:
  • $ kwrite frameworks/base/libs/rs/Android.mk
  • Add '-fpermissive' to line 183:
    • LOCAL_CFLAGS += -Werror -Wall -Wno-unused-parameter -Wno-unused-variable -fpermissive


Error 11
Code:
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:
  • $ kwrite 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>


Error 12
Code:
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
Fix 1:
  • $ kwrite external/gtest/src/Android.mk
  • Add '-fpermissive' to lines 52 and 70 (both lines contain same info)
    • LOCAL_CFLAGS += -O0 -fpermissive
Fix 2:
  • $ kwrite external/gtest/include/gtest/internal/gtest-param-util.h
  • Add '#include <stddef.h>' to list of includes as shown:
    • #include <vector>
      #include <stddef.h>
      #include <gtest/internal/gtest-port.h>


Error 13
Code:
frameworks/compile/slang/slang_rs_export_foreach.cpp: In static member function ‘static slang::RSExportForEach* slang::RSExportForEach::Create(slang::RSContext*, const clang::FunctionDecl*)’:
frameworks/compile/slang/slang_rs_export_foreach.cpp:249:23: error: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable]
cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_export_foreach.o] Error 1
Fix:
  • $ kwrite kwrite frameworks/compile/slang/Android.mk
  • change
    • local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror
  • to
    • local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter
The Following 8 Users Say Thank You to riggnix For This Useful Post: [ View ] Gift riggnix Ad-Free
8th November 2012, 04:09 PM |#3  
riggnix's Avatar
OP Senior Member
Flag Graz
Thanks Meter: 35
 
More
reserved #2
The Following User Says Thank You to riggnix For This Useful Post: [ View ] Gift riggnix Ad-Free
10th November 2012, 01:55 AM |#4  
903tex's Avatar
Senior Member
Flag Tyler, Texas
Thanks Meter: 350
 
More
Wish somebody would build for the LG optimistic logic

Sent from my LGL35G using xda premium
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes