You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by GitBox <gi...@apache.org> on 2020/06/11 03:40:02 UTC

[GitHub] [incubator-datasketches-postgresql] csqjxiao opened a new issue #25: Cannot compile & install on Ubuntu 16.04

csqjxiao opened a new issue #25:
URL: https://github.com/apache/incubator-datasketches-postgresql/issues/25


   I have successfully compile and install this project on MacOS with homebrew.
   
   But when I tried to install this postgresql extension on Ubuntu OS, it reports the following error.
   ```
   $ ln -sf ../incubator-datasketches-cpp datasketches-cpp
   $ make 
   $ sudo make install
   cd '/usr/lib/postgresql/12/lib/bitcode' && /usr/lib/llvm-6.0/bin/llvm-lto -thinlto -thinlto-action=thinlink -o datasketches.index.bc datasketches/src/global_hooks.bc datasketches/src/base64.bc datasketches/src/common.bc datasketches/src/kll_float_sketch_pg_functions.bc datasketches/src/kll_float_sketch_c_adapter.bc datasketches/src/cpc_sketch_pg_functions.bc datasketches/src/cpc_sketch_c_adapter.bc datasketches/src/theta_sketch_pg_functions.bc datasketches/src/theta_sketch_c_adapter.bc datasketches/src/frequent_strings_sketch_pg_functions.bc datasketches/src/frequent_strings_sketch_c_adapter.bc datasketches/src/hll_sketch_pg_functions.bc datasketches/src/hll_sketch_c_adapter.bc
   error: can't create module summary index for buffer: Expected a single module
   LLVM ERROR: ThinLink didn't create an index
   ```
   
   I have double checked this problem and found that the error happens whenever we use llvm-thinlink to add xxxsketch_pg_functions.bc and xxxsketch_c_adapter.bc together.
   ```
   /usr/lib/postgresql/12/lib/bitcode$ sudo /usr/lib/llvm-6.0/bin/llvm-lto -thinlto -thinlto-action=thinlink -o datasketches.index.bc datasketches/src/global_hooks.bc datasketches/src/base64.bc datasketches/src/common.bc datasketches/src/hll_sketch_pg_functions.bc datasketches/src/hll_sketch_c_adapter.bc
   error: can't create module summary index for buffer: Expected a single module
   LLVM ERROR: ThinLink didn't create an index
   ```
   My operating system version is Ubuntu 16.04, and PostgreSQL version is the latest 12. I have tried both LLVM-6.0 and LLVM-8.0. But the installation error still exists. Thanks if any help can be given.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[GitHub] [incubator-datasketches-postgresql] AlexanderSaydakov edited a comment on issue #25: Cannot compile & install on Ubuntu 16.04

Posted by GitBox <gi...@apache.org>.
AlexanderSaydakov edited a comment on issue #25:
URL: https://github.com/apache/incubator-datasketches-postgresql/issues/25#issuecomment-642786271


   What is the version of the datasketches library?
   Did you install a custom toolchain? I don't think that LLVM is a part of a standard Ubuntu installation.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[GitHub] [incubator-datasketches-postgresql] AlexanderSaydakov closed issue #25: Cannot compile & install on Ubuntu 16.04

Posted by GitBox <gi...@apache.org>.
AlexanderSaydakov closed issue #25:
URL: https://github.com/apache/incubator-datasketches-postgresql/issues/25


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[GitHub] [incubator-datasketches-postgresql] AlexanderSaydakov commented on issue #25: Cannot compile & install on Ubuntu 16.04

Posted by GitBox <gi...@apache.org>.
AlexanderSaydakov commented on issue #25:
URL: https://github.com/apache/incubator-datasketches-postgresql/issues/25#issuecomment-659601401


   I think this can be closed


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[GitHub] [incubator-datasketches-postgresql] csqjxiao edited a comment on issue #25: Cannot compile & install on Ubuntu 16.04

Posted by GitBox <gi...@apache.org>.
csqjxiao edited a comment on issue #25:
URL: https://github.com/apache/incubator-datasketches-postgresql/issues/25#issuecomment-643283619


   The datasketches library is the nighly build source directly cloned from github.
   
   I have installed llvm and clang from the official [LLVM APT Nightly Build](https://apt.llvm.org/). Basically, I use the following commands to install llvm and clang on my ubuntu 16.04.
   ```
   wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
   sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main"
   sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main"
   sudo apt-get update
   sudo apt-get install -y clang-3.8       ## default clange version of ubuntu
   sudo apt-get install -y llvm-3.8 llvm-3.8-dev llvm-3.8-runtime libllvm3.8
   sudo apt-get install -y clang-6.0 lldb-6.0 lld-6.0       ## needed by postgresql
   sudo apt-get install -y llvm-6.0 llvm-6.0-dev llvm-6.0-runtime llvm-6.0-tools libllvm6.0
   sudo apt-get install -y clang-10 lldb-10 lld-10 libllvm10  ## needed by datasketches-postgresql
   sudo apt-get install -y llvm-10 llvm-10-dev llvm-10-runtime llvm-10-tools
   sudo apt-get upgrade
   ```
   
   I find that llvm-6.0 will have problem to compile and install the code.
   ```
   $ cd '/usr/lib/postgresql/12/lib/bitcode' && sudo /usr/lib/llvm-6.0/bin/llvm-lto -thinlto -thinlto-action=thinlink -o datasketches.index.bc datasketches/src/global_hooks.bc datasketches/src/base64.bc datasketches/src/common.bc datasketches/src/kll_float_sketch_pg_functions.bc datasketches/src/kll_float_sketch_c_adapter.bc datasketches/src/cpc_sketch_pg_functions.bc datasketches/src/cpc_sketch_c_adapter.bc datasketches/src/theta_sketch_pg_functions.bc datasketches/src/theta_sketch_c_adapter.bc datasketches/src/frequent_strings_sketch_pg_functions.bc datasketches/src/frequent_strings_sketch_c_adapter.bc datasketches/src/hll_sketch_pg_functions.bc datasketches/src/hll_sketch_c_adapter.bc
   error: can't create module summary index for buffer: Expected a single module
   LLVM ERROR: ThinLink didn't create an index
   ```
   But LLVM-10 can install without problem.
   ```
   cd '/usr/lib/postgresql/12/lib/bitcode' && sudo /usr/lib/llvm-10/bin/llvm-lto -thinlto -thinlto-action=thinlink -o datasketches.index.bc datasketches/src/global_hooks.bc datasketches/src/base64.bc datasketches/src/common.bc datasketches/src/kll_float_sketch_pg_functions.bc datasketches/src/kll_float_sketch_c_adapter.bc datasketches/src/cpc_sketch_pg_functions.bc datasketches/src/cpc_sketch_c_adapter.bc datasketches/src/theta_sketch_pg_functions.bc datasketches/src/theta_sketch_c_adapter.bc datasketches/src/frequent_strings_sketch_pg_functions.bc datasketches/src/frequent_strings_sketch_c_adapter.bc datasketches/src/hll_sketch_pg_functions.bc datasketches/src/hll_sketch_c_adapter.bc
   ```
   
   Do you happen to know how to set the default LLVM version on Ubuntu to llvm-10? I hope to use the following shell command to do this job. But it didn't work.
   ```
   #!/usr/bin/env sh
   
   # llvm update function
   function register_clang_version {
       local version=$1
       local priority=$2
   
       update-alternatives \
           --install /usr/bin/llvm-config       llvm-config      /usr/bin/llvm-config-${version} ${priority} \
           --slave   /usr/bin/llvm-lto          llvm-lto         /usr/bin/llvm-lto-${version} \
           --slave   /usr/bin/llvm-ar           llvm-ar          /usr/bin/llvm-ar-${version} \
           --slave   /usr/bin/llvm-as           llvm-as          /usr/bin/llvm-as-${version} \
           --slave   /usr/bin/llvm-bcanalyzer   llvm-bcanalyzer  /usr/bin/llvm-bcanalyzer-${version} \
           --slave   /usr/bin/llvm-cov          llvm-cov         /usr/bin/llvm-cov-${version} \
           --slave   /usr/bin/llvm-diff         llvm-diff        /usr/bin/llvm-diff-${version} \
           --slave   /usr/bin/llvm-dis          llvm-dis         /usr/bin/llvm-dis-${version} \
           --slave   /usr/bin/llvm-dwarfdump    llvm-dwarfdump   /usr/bin/llvm-dwarfdump-${version} \
           --slave   /usr/bin/llvm-extract      llvm-extract     /usr/bin/llvm-extract-${version} \
           --slave   /usr/bin/llvm-link         llvm-link        /usr/bin/llvm-link-${version} \
           --slave   /usr/bin/llvm-mc           llvm-mc          /usr/bin/llvm-mc-${version} \
           --slave   /usr/bin/llvm-nm           llvm-nm          /usr/bin/llvm-nm-${version} \
           --slave   /usr/bin/llvm-objdump      llvm-objdump     /usr/bin/llvm-objdump-${version} \
           --slave   /usr/bin/llvm-ranlib       llvm-ranlib      /usr/bin/llvm-ranlib-${version} \
           --slave   /usr/bin/llvm-readobj      llvm-readobj     /usr/bin/llvm-readobj-${version} \
           --slave   /usr/bin/llvm-rtdyld       llvm-rtdyld      /usr/bin/llvm-rtdyld-${version} \
           --slave   /usr/bin/llvm-size         llvm-size        /usr/bin/llvm-size-${version} \
           --slave   /usr/bin/llvm-stress       llvm-stress      /usr/bin/llvm-stress-${version} \
           --slave   /usr/bin/llvm-symbolizer   llvm-symbolizer  /usr/bin/llvm-symbolizer-${version} \
           --slave   /usr/bin/llvm-tblgen       llvm-tblgen      /usr/bin/llvm-tblgen-${version} \
           --slave   /usr/bin/lldb              lldb             /usr/bin/lldb-${version} \
           --slave   /usr/bin/lldb-server       lldb-server      /usr/bin/lldb-server-${version}        
   
   
       update-alternatives \
           --install /usr/bin/clang                 clang                 /usr/bin/clang-${version} ${priority}
           
           
       update-alternatives \
           --install   /usr/bin/clang++               clang++               /usr/bin/clang++-${version} ${priority}        
   }
   
   
   # Remove all existing alternatives
   sudo update-alternatives --remove-all llvm-config
   sudo update-alternatives --remove-all clang
   sudo update-alternatives --remove-all clang++
   
   # exit on first error
   set -e
   
   register_clang_version 3.8 100
   register_clang_version 6.0 600
   register_clang_version 10 1000
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[GitHub] [incubator-datasketches-postgresql] csqjxiao edited a comment on issue #25: Cannot compile & install on Ubuntu 16.04

Posted by GitBox <gi...@apache.org>.
csqjxiao edited a comment on issue #25:
URL: https://github.com/apache/incubator-datasketches-postgresql/issues/25#issuecomment-643283619


   The datasketches library is the nighly build source directly cloned from github.
   
   I have installed llvm and clang from the official [LLVM APT Nightly Build](https://apt.llvm.org/). Basically, I use the following commands to install llvm and clang on my ubuntu 16.04.
   ```
   wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
   sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main"
   sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main"
   sudo apt-get update
   sudo apt-get install -y clang-3.8 lldb-3.8       ## default clange version of ubuntu
   sudo apt-get install -y llvm-3.8 llvm-3.8-dev llvm-3.8-runtime
   sudo apt-get install -y clang-6.0 lldb-6.0 lld-6.0      ## needed by postgresql
   sudo apt-get install -y llvm-6.0 llvm-6.0-dev llvm-6.0-runtime llvm-6.0-tools
   sudo apt-get install -y clang-10 lldb-10 lld-10        ## needed by datasketches-postgresql
   sudo apt-get install -y llvm-10 llvm-10-dev llvm-10-runtime llvm-10-tools
   sudo apt-get upgrade
   ```
   
   I find that llvm-6.0 will have problem to compile and install the code.
   ```
   $ cd '/usr/lib/postgresql/12/lib/bitcode' && sudo /usr/lib/llvm-6.0/bin/llvm-lto -thinlto -thinlto-action=thinlink -o datasketches.index.bc datasketches/src/global_hooks.bc datasketches/src/base64.bc datasketches/src/common.bc datasketches/src/kll_float_sketch_pg_functions.bc datasketches/src/kll_float_sketch_c_adapter.bc datasketches/src/cpc_sketch_pg_functions.bc datasketches/src/cpc_sketch_c_adapter.bc datasketches/src/theta_sketch_pg_functions.bc datasketches/src/theta_sketch_c_adapter.bc datasketches/src/frequent_strings_sketch_pg_functions.bc datasketches/src/frequent_strings_sketch_c_adapter.bc datasketches/src/hll_sketch_pg_functions.bc datasketches/src/hll_sketch_c_adapter.bc
   error: can't create module summary index for buffer: Expected a single module
   LLVM ERROR: ThinLink didn't create an index
   ```
   But LLVM-10 can install without problem.
   ```
   cd '/usr/lib/postgresql/12/lib/bitcode' && sudo /usr/lib/llvm-10/bin/llvm-lto -thinlto -thinlto-action=thinlink -o datasketches.index.bc datasketches/src/global_hooks.bc datasketches/src/base64.bc datasketches/src/common.bc datasketches/src/kll_float_sketch_pg_functions.bc datasketches/src/kll_float_sketch_c_adapter.bc datasketches/src/cpc_sketch_pg_functions.bc datasketches/src/cpc_sketch_c_adapter.bc datasketches/src/theta_sketch_pg_functions.bc datasketches/src/theta_sketch_c_adapter.bc datasketches/src/frequent_strings_sketch_pg_functions.bc datasketches/src/frequent_strings_sketch_c_adapter.bc datasketches/src/hll_sketch_pg_functions.bc datasketches/src/hll_sketch_c_adapter.bc
   ```
   
   Do you happen to know how to set the default LLVM version on Ubuntu to llvm-10? I hope to use the following shell command to do this job. But it didn't work.
   ```
   #!/usr/bin/env sh
   
   # llvm update function
   function register_clang_version {
       local version=$1
       local priority=$2
   
       update-alternatives \
           --install /usr/bin/llvm-config       llvm-config      /usr/bin/llvm-config-${version} ${priority} \
           --slave   /usr/bin/llvm-lto          llvm-lto         /usr/bin/llvm-lto-${version} \
           --slave   /usr/bin/llvm-ar           llvm-ar          /usr/bin/llvm-ar-${version} \
           --slave   /usr/bin/llvm-as           llvm-as          /usr/bin/llvm-as-${version} \
           --slave   /usr/bin/llvm-bcanalyzer   llvm-bcanalyzer  /usr/bin/llvm-bcanalyzer-${version} \
           --slave   /usr/bin/llvm-cov          llvm-cov         /usr/bin/llvm-cov-${version} \
           --slave   /usr/bin/llvm-diff         llvm-diff        /usr/bin/llvm-diff-${version} \
           --slave   /usr/bin/llvm-dis          llvm-dis         /usr/bin/llvm-dis-${version} \
           --slave   /usr/bin/llvm-dwarfdump    llvm-dwarfdump   /usr/bin/llvm-dwarfdump-${version} \
           --slave   /usr/bin/llvm-extract      llvm-extract     /usr/bin/llvm-extract-${version} \
           --slave   /usr/bin/llvm-link         llvm-link        /usr/bin/llvm-link-${version} \
           --slave   /usr/bin/llvm-mc           llvm-mc          /usr/bin/llvm-mc-${version} \
           --slave   /usr/bin/llvm-nm           llvm-nm          /usr/bin/llvm-nm-${version} \
           --slave   /usr/bin/llvm-objdump      llvm-objdump     /usr/bin/llvm-objdump-${version} \
           --slave   /usr/bin/llvm-ranlib       llvm-ranlib      /usr/bin/llvm-ranlib-${version} \
           --slave   /usr/bin/llvm-readobj      llvm-readobj     /usr/bin/llvm-readobj-${version} \
           --slave   /usr/bin/llvm-rtdyld       llvm-rtdyld      /usr/bin/llvm-rtdyld-${version} \
           --slave   /usr/bin/llvm-size         llvm-size        /usr/bin/llvm-size-${version} \
           --slave   /usr/bin/llvm-stress       llvm-stress      /usr/bin/llvm-stress-${version} \
           --slave   /usr/bin/llvm-symbolizer   llvm-symbolizer  /usr/bin/llvm-symbolizer-${version} \
           --slave   /usr/bin/llvm-tblgen       llvm-tblgen      /usr/bin/llvm-tblgen-${version} \
           --slave   /usr/bin/lldb              lldb             /usr/bin/lldb-${version} \
           --slave   /usr/bin/lldb-server       lldb-server      /usr/bin/lldb-server-${version}        
   
   
       update-alternatives \
           --install /usr/bin/clang                 clang                 /usr/bin/clang-${version} ${priority}
           
           
       update-alternatives \
           --install   /usr/bin/clang++               clang++               /usr/bin/clang++-${version} ${priority}        
   }
   
   
   # Remove all existing alternatives
   sudo update-alternatives --remove-all llvm-config
   sudo update-alternatives --remove-all clang
   sudo update-alternatives --remove-all clang++
   
   # exit on first error
   set -e
   
   register_clang_version 3.8 100
   register_clang_version 6.0 600
   register_clang_version 10 1000
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[GitHub] [incubator-datasketches-postgresql] csqjxiao commented on issue #25: Cannot compile & install on Ubuntu 16.04

Posted by GitBox <gi...@apache.org>.
csqjxiao commented on issue #25:
URL: https://github.com/apache/incubator-datasketches-postgresql/issues/25#issuecomment-643329487


   Does this issue relates with the postgresql-12 installation on Ubuntu 16.04? 
   
   By the following apt-cache command, I find that postgresql-12 depends on libllvm6.0.
   
   ```
   $ apt-cache depends postgresql-12
   postgresql-12
    |depends: locales
       locales-all:i386
       locales-all
     depends: locales-all
       locales-all:i386
     depends: postgresql-client-12
       postgresql-client-12:i386
     depends: postgresql-common
     depends: ssl-cert
     depends: tzdata
     depends: debconf
     depends: <debconf-2.0>
       cdebconf
       debconf
     depends: libc6
     depends: libgcc1
     depends: libgssapi-krb5-2
     depends: libicu55
     depends: libldap-2.4-2
     depends: libllvm6.0
     depends: libpam0g
     depends: libpq5
     depends: libselinux1
     depends: libssl1.0.0
     depends: libstdc++6
     depends: libsystemd0
     depends: libuuid1
     depends: libxml2
     depends: libxslt1.1
     depends: zlib1g
     recommends: sysstat
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[GitHub] [incubator-datasketches-postgresql] csqjxiao commented on issue #25: Cannot compile & install on Ubuntu 16.04

Posted by GitBox <gi...@apache.org>.
csqjxiao commented on issue #25:
URL: https://github.com/apache/incubator-datasketches-postgresql/issues/25#issuecomment-643604395


   Thanks. I guess I know what is the root cause. I need to rebuild postgresql-12 from source code and reconfigure its depended LLVM to 10, instead of the default LLVM-6.0.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[GitHub] [incubator-datasketches-postgresql] AlexanderSaydakov commented on issue #25: Cannot compile & install on Ubuntu 16.04

Posted by GitBox <gi...@apache.org>.
AlexanderSaydakov commented on issue #25:
URL: https://github.com/apache/incubator-datasketches-postgresql/issues/25#issuecomment-643409829


   It seems to me that you managed to build the module using the latest LLVM.
   Unfortunately, I don't have answers as to why some versions of LLVM do not work and how to change  the default settings in Ubuntu. My understanding was that pre-installed gcc 9 on Ubuntu should work, but I have not tried that myself.
   Can we consider this issue resolved?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[GitHub] [incubator-datasketches-postgresql] AlexanderSaydakov commented on issue #25: Cannot compile & install on Ubuntu 16.04

Posted by GitBox <gi...@apache.org>.
AlexanderSaydakov commented on issue #25:
URL: https://github.com/apache/incubator-datasketches-postgresql/issues/25#issuecomment-642786271


   What is the version of the library?
   Did you install a custom toolchain? I don't think that LLVM is a part of a standard Ubuntu installation.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[GitHub] [incubator-datasketches-postgresql] csqjxiao commented on issue #25: Cannot compile & install on Ubuntu 16.04

Posted by GitBox <gi...@apache.org>.
csqjxiao commented on issue #25:
URL: https://github.com/apache/incubator-datasketches-postgresql/issues/25#issuecomment-643283619


   The datasketches library is the nighly build source directly cloned from github.
   
   I have installed llvm and clang from the official [LLVM APT Nightly Build](https://apt.llvm.org/). Basically, I use the following commands to install llvm and clang on my ubuntu 16.04.
   ```
   wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
   sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main"
   sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main"
   sudo apt-get update
   sudo apt-get install -y clang-3.8 lldb-3.8       ## default clange version of ubuntu
   sudo apt-get install -y llvm-3.8 llvm-3.8-dev llvm-3.8-runtime
   sudo apt-get install -y clang-6.0 lldb-6.0 lld-6.0      ## needed by postgresql
   sudo apt-get install -y llvm-6.0 llvm-6.0-dev llvm-6.0-runtime llvm-6.0-tools
   sudo apt-get install -y clang-10 lldb-10 lld-10        ## needed by datasketches-postgresql
   sudo apt-get install -y llvm-10 llvm-10-dev llvm-10-runtime llvm-10-tools
   sudo apt-get upgrade
   ```
   
   I find that llvm-6.0 will have problem to compile and install the code. But  
   ```
   $ cd '/usr/lib/postgresql/12/lib/bitcode' && sudo /usr/lib/llvm-6.0/bin/llvm-lto -thinlto -thinlto-action=thinlink -o datasketches.index.bc datasketches/src/global_hooks.bc datasketches/src/base64.bc datasketches/src/common.bc datasketches/src/kll_float_sketch_pg_functions.bc datasketches/src/kll_float_sketch_c_adapter.bc datasketches/src/cpc_sketch_pg_functions.bc datasketches/src/cpc_sketch_c_adapter.bc datasketches/src/theta_sketch_pg_functions.bc datasketches/src/theta_sketch_c_adapter.bc datasketches/src/frequent_strings_sketch_pg_functions.bc datasketches/src/frequent_strings_sketch_c_adapter.bc datasketches/src/hll_sketch_pg_functions.bc datasketches/src/hll_sketch_c_adapter.bc
   error: can't create module summary index for buffer: Expected a single module
   LLVM ERROR: ThinLink didn't create an index
   ```
   But LLVM-10 can install without problem.
   ```
   cd '/usr/lib/postgresql/12/lib/bitcode' && sudo /usr/lib/llvm-10/bin/llvm-lto -thinlto -thinlto-action=thinlink -o datasketches.index.bc datasketches/src/global_hooks.bc datasketches/src/base64.bc datasketches/src/common.bc datasketches/src/kll_float_sketch_pg_functions.bc datasketches/src/kll_float_sketch_c_adapter.bc datasketches/src/cpc_sketch_pg_functions.bc datasketches/src/cpc_sketch_c_adapter.bc datasketches/src/theta_sketch_pg_functions.bc datasketches/src/theta_sketch_c_adapter.bc datasketches/src/frequent_strings_sketch_pg_functions.bc datasketches/src/frequent_strings_sketch_c_adapter.bc datasketches/src/hll_sketch_pg_functions.bc datasketches/src/hll_sketch_c_adapter.bc
   ```
   
   Do you happen to know how to set the default LLVM version on Ubuntu to llvm-10? I hope to use the following shell command to do this job. But it didn't work.
   ```
   #!/usr/bin/env sh
   
   # llvm update function
   function register_clang_version {
       local version=$1
       local priority=$2
   
       update-alternatives \
           --install /usr/bin/llvm-config       llvm-config      /usr/bin/llvm-config-${version} ${priority} \
           --slave   /usr/bin/llvm-lto          llvm-lto         /usr/bin/llvm-lto-${version} \
           --slave   /usr/bin/llvm-ar           llvm-ar          /usr/bin/llvm-ar-${version} \
           --slave   /usr/bin/llvm-as           llvm-as          /usr/bin/llvm-as-${version} \
           --slave   /usr/bin/llvm-bcanalyzer   llvm-bcanalyzer  /usr/bin/llvm-bcanalyzer-${version} \
           --slave   /usr/bin/llvm-cov          llvm-cov         /usr/bin/llvm-cov-${version} \
           --slave   /usr/bin/llvm-diff         llvm-diff        /usr/bin/llvm-diff-${version} \
           --slave   /usr/bin/llvm-dis          llvm-dis         /usr/bin/llvm-dis-${version} \
           --slave   /usr/bin/llvm-dwarfdump    llvm-dwarfdump   /usr/bin/llvm-dwarfdump-${version} \
           --slave   /usr/bin/llvm-extract      llvm-extract     /usr/bin/llvm-extract-${version} \
           --slave   /usr/bin/llvm-link         llvm-link        /usr/bin/llvm-link-${version} \
           --slave   /usr/bin/llvm-mc           llvm-mc          /usr/bin/llvm-mc-${version} \
           --slave   /usr/bin/llvm-nm           llvm-nm          /usr/bin/llvm-nm-${version} \
           --slave   /usr/bin/llvm-objdump      llvm-objdump     /usr/bin/llvm-objdump-${version} \
           --slave   /usr/bin/llvm-ranlib       llvm-ranlib      /usr/bin/llvm-ranlib-${version} \
           --slave   /usr/bin/llvm-readobj      llvm-readobj     /usr/bin/llvm-readobj-${version} \
           --slave   /usr/bin/llvm-rtdyld       llvm-rtdyld      /usr/bin/llvm-rtdyld-${version} \
           --slave   /usr/bin/llvm-size         llvm-size        /usr/bin/llvm-size-${version} \
           --slave   /usr/bin/llvm-stress       llvm-stress      /usr/bin/llvm-stress-${version} \
           --slave   /usr/bin/llvm-symbolizer   llvm-symbolizer  /usr/bin/llvm-symbolizer-${version} \
           --slave   /usr/bin/llvm-tblgen       llvm-tblgen      /usr/bin/llvm-tblgen-${version} \
           --slave   /usr/bin/lldb              lldb             /usr/bin/lldb-${version} \
           --slave   /usr/bin/lldb-server       lldb-server      /usr/bin/lldb-server-${version}        
   
   
       update-alternatives \
           --install /usr/bin/clang                 clang                 /usr/bin/clang-${version} ${priority}
           
           
       update-alternatives \
           --install   /usr/bin/clang++               clang++               /usr/bin/clang++-${version} ${priority}        
   }
   
   
   # Remove all existing alternatives
   sudo update-alternatives --remove-all llvm-config
   sudo update-alternatives --remove-all clang
   sudo update-alternatives --remove-all clang++
   
   # exit on first error
   set -e
   
   register_clang_version 3.8 100
   register_clang_version 6.0 600
   register_clang_version 10 1000
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org