Can't build in Ubuntu 18.04 with linuxbrew

[Question posted by a user on YugabyteDB Community Slack ]

Following https://docs.yugabyte.com/latest/contribute/core-database/build-from-src-ubuntu/ to build YB source code on Ubuntu 18.04, but I encountered the error:

cu4c (common)] make[1]: Entering directory '/home/bshi/code/OpenSource/yugabyte-db/thirdparty/build/common/icu4c-67_1/source/data'
[icu4c (common)] make -f pkgdataMakefile
[icu4c (common)] /bin/bash ../mkinstalldirs ./out/tmp ./out/build/icudt67l
[icu4c (common)] make[2]: Entering directory '/home/bshi/code/OpenSource/yugabyte-db/thirdparty/build/common/icu4c-67_1/source/data'
[icu4c (common)] rm -rf icupkg.inc
[icu4c (common)] Unpacking ./in/icudt67l.dat and generating out/tmp/icudata.lst (list of data files)
[icu4c (common)] LD_LIBRARY_PATH=../lib:../stubdata:../tools/ctestfw:$LD_LIBRARY_PATH  ../bin/icupkg -d ./out/build/icudt67l --list -x \* ./in/icudt67l.dat -o out/tmp/icudata.lst
[icu4c (common)] ../bin/icupkg: relocation error: /home/bshi/.linuxbrew-yb-build/linuxbrew-20181203T161736-xxxxxxxxxxxxxxxxxxxxxxxxxxxx/lib/libpthread.so.0: symbol __libc_dl_error_tsd version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference
[icu4c (common)] Makefile:269: recipe for target 'out/tmp/icudata.lst' failed
[icu4c (common)] make[1]: *** [out/tmp/icudata.lst] Error 127
[icu4c (common)] make[1]: *** Waiting for unfinished jobs....
[icu4c (common)] make[2]: Leaving directory '/home/bshi/code/OpenSource/yugabyte-db/thirdparty/build/common/icu4c-67_1/source/data'
[icu4c (common)] make[1]: Leaving directory '/home/bshi/code/OpenSource/yugabyte-db/thirdparty/build/common/icu4c-67_1/source/data'
[icu4c (common)] Makefile:153: recipe for target 'all-recursive' failed
[icu4c (common)] make: *** [all-recursive] Error 2
Execution failed with code: 2
  File "/home/bshi/code/OpenSource/yugabyte-db/thirdparty/yb_build_thirdparty_main.py", line 1086, in <module>
    main()
  File "/home/bshi/code/OpenSource/yugabyte-db/thirdparty/yb_build_thirdparty_main.py", line 1074, in main
    builder.run()
  File "/home/bshi/code/OpenSource/yugabyte-db/thirdparty/yb_build_thirdparty_main.py", line 247, in run
    self.build(BUILD_TYPE_COMMON)
  File "/home/bshi/code/OpenSource/yugabyte-db/thirdparty/yb_build_thirdparty_main.py", line 741, in build
    self.build_dependency(dep)
  File "/home/bshi/code/OpenSource/yugabyte-db/thirdparty/yb_build_thirdparty_main.py", line 822, in build_dependency
    dep.build(self)
  File "/home/bshi/code/OpenSource/yugabyte-db/thirdparty/build_definitions/icu4c.py", line 50, in build
    extra_args=configure_extra_args)
  File "/home/bshi/code/OpenSource/yugabyte-db/thirdparty/yb_build_thirdparty_main.py", line 689, in build_with_configure
    log_output(log_prefix, ['make', '-j{}'.format(jobs)])
  File "/home/bshi/code/OpenSource/yugabyte-db/thirdparty/build_definitions/__init__.py", line 102, in log_output
    fatal("Execution failed with code: {}".format(exit_code))
  File "/home/bshi/code/OpenSource/yugabyte-db/thirdparty/build_definitions/__init__.py", line 74, in fatal
    traceback.print_stack()
CMake Error at CMakeLists.txt:559 (message):
  Thirdparty was built unsuccessfully, terminating.
-- Configuring incomplete, errors occurred!
See also "/home/bshi/code/OpenSource/yugabyte-db/build/release-gcc-dynamic-ninja/CMakeFiles/CMakeOutput.log".
==========================================================================================
YUGABYTE BUILD SUMMARY
==========================================================================================
Build type                       : release
C/C++ compiler                   : gcc
Build directory                  : /home/bshi/code/OpenSource/yugabyte-db/build/release-gcc-dynamic-ninja
Third-party dir                  : /home/bshi/code/OpenSource/yugabyte-db/thirdparty
Exit code                        : 1
------------------------------------------------------------------------------------------

The linuxbrew download is only compaible with Centos. It should not be used on Ubuntu.

Remove ~/.linuxbrew-yb-build and run yb_build.sh --clean-thirdparty.