{: .no_toc }
{: .no_toc .text-delta }
It is best to keep the source file tree and the build-output files separate (“out-of-source build”). It keeps your source tree clean, and you can build multiple configurations from the same source tree (e.g., debug build, release build, build with special flags such as no-using-namespace). You could keep the source and build trees in parallel folders.
Important: If you use runConfigureICU together with CXXFLAGS or similar, the custom flags must be before the runConfigureICU invocation. (So that they are visible as environment variables in the runConfigureICU shell script, rather than just options text.) See the sample runConfigureICU invocations below.
See the ICU4C readme's Recommended Build Options.
For example:
~/icu/mine/**src**git checkout <branch> to switch between branches.git checkout -b <newbranchname> to create a new branch and switch to it.make clean before switching to a different branch.~/icu/mine/icu4c/**bld**CXXFLAGS="-DU_USING_ICU_NAMESPACE=0" CPPFLAGS="-DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1" ../../src/icu4c/source/**runConfigureICU** Linux --prefix=/home/*your_user_name*/icu/mine/inst > config.out 2>&1make -j5 check > out.txt 2>&1~/icu/mine/icu4c/**dbg**CXXFLAGS="-DU_USING_ICU_NAMESPACE=0" CPPFLAGS="-DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1" ../../src/icu4c/source/**runConfigureICU** --enable-debug --disable-release Linux --prefix=/home/*your_user_name*/icu/mine/inst > config.out 2>&1CC=gcc CXX=g++ CXXFLAGS="-DU_USING_ICU_NAMESPACE=0" CPPFLAGS="-DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1" ../../src/icu4c/source/runConfigureICU --enable-debug --disable-release Linux~/icu/mine/icu4c/**nm_utf8**../../src/icu4c/source/**configure** CXXFLAGS="-DU_USING_ICU_NAMESPACE=0" CPPFLAGS="-DU_CHARSET_IS_UTF8=1 -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1" --prefix=/home/*your_user_name*/icu/mine/inst > config.out 2>&1../../src/icu4c/source/**configure** CXXFLAGS="-DU_USING_ICU_NAMESPACE=0" CPPFLAGS="-DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -O2 -ffunction-sections -fdata-sections" LDFLAGS="-Wl,--gc-sections" --enable-static --disable-shared --prefix=/home/*your_user_name*/icu/mine/inst > config.out 2>&1~/icu/mine/inst~/icu/**msg48**/srccd ~/icu/mine/icu4c/dbg/test/intltestexport LD_LIBRARY_PATH=../../lib:../../stubdata:../../tools/ctestfwmake -j5 && ./intltest utility/ByteTrieTest utility/UCharTrieTestcd ~/icu/mine/icu4c/dbg/test/cintltstLD_LIBRARY_PATH as for intltestmake -j5 && ./cintltstShane wrote this gdb script in 2017: It pretty-prints UnicodeString in GDB. Instead of seeing the raw internals of UnicodeString, you will see the length, storage type, and content of the UnicodeString in your debugger. There are installation instructions in the top comment on the file (it's a matter of downloading the file and adding a line to ~/.gdbinit).
https://gist.github.com/sffc/7b3826fd67cb78057a9e66f2b350a647
This also works in anything that wraps GDB, like CLion and Visual Studio Code.
For more Linux-specific tips see the Linux Tips subpage.