Giter Site home page Giter Site logo

linrio.github.io's People

Contributors

linrio avatar

Watchers

 avatar  avatar  avatar

linrio.github.io's Issues

java, compare two Strings

In java, if we want to compare two string, such as A= 'abc' and B = 'abc', we should use:
if(A.equals(B)){} . It return true or false.
Not if(A == B) It return the whether the memory address is the same.

sudo rm /lib64/libc.so.6

I make a mistaken that delete the libc.so.6 by sudo rm /lib64/libc.so.6.
I try to run

sudo LD_PRELOAD=/lib64/libc-2.12.so ln -s /lib64/libc-2.12.so libc.so.6
sudo: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory

And, it can not rebuild the soft link also:

[llf@k20-1 lib]$ sudo ln -sf /lib64/libc-2.14.so /lib64/libc.so.6
sudo: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory

How to address this mistake?

Compile bazel error: Executing genrule //src/main/protobuf:command_server_cc_proto_codegen failed: process-wrapper failed...

I want to install bazel by compiling source from bazel. $cd bazel, then I run $./compile.sh. It occurs error:

*OS:
Linux k20-1 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

*GCC version:

[llf@k20-1 lib64]$ gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc4.8.2/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
目标:x86_64-unknown-linux-gnu
配置为:../configure --prefix=/usr/local/gcc4.8.2/ --enable-threads=posix --disable-checking --enable-languages=c,c++ --disable-multilib
线程模型:posix
gcc 版本 4.8.2 (GCC) 

The compile error:

[llf@k20-1 bazel]$ ./compile.sh 
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO:    ./compile.sh compile /path/to/bazel
馃崈  Building Bazel from scratch.......
馃崈  Building Bazel with Bazel.
.WARNING: /tmp/bazel_EuUM0clx/out/external/bazel_tools/WORKSPACE:1: Workspace name in /tmp/bazel_EuUM0clx/out/external/bazel_tools/WORKSPACE (@io_bazel) does not match the name given in the repository's definition (@bazel_tools); this will cause a build error in future versions.
INFO: Found 1 target...
INFO: From Compiling src/main/cpp/blaze_util.cc:
src/main/cpp/blaze_util.cc: In function 'uint64_t blaze::AcquireLock(const string&, bool, bool, blaze::BlazeLock*)':
src/main/cpp/blaze_util.cc:421:30: warning: ignoring return value of 'int ftruncate(int, __off_t)', declared with attribute warn_unused_result [-Wunused-result]
   (void) ftruncate(lockfd, 0);
                              ^
src/main/cpp/blaze_util.cc:426:47: warning: ignoring return value of 'ssize_t write(int, const void*, size_t)', declared with attribute warn_unused_result [-Wunused-result]
   (void) write(lockfd, msg.data(), msg.size());
                                               ^
INFO: From Compiling src/main/cpp/blaze_util_posix.cc:
src/main/cpp/blaze_util_posix.cc: In function 'void blaze::Daemonize(const string&)':
src/main/cpp/blaze_util_posix.cc:104:28: warning: ignoring return value of 'int dup(int)', declared with attribute warn_unused_result [-Wunused-result]
   (void) dup(STDOUT_FILENO);  // stderr (2>&1)
                            ^
INFO: From JavacBootstrap src/java_tools/buildjar/java/com/google/devtools/build/buildjar/libbootstrap_JarOwner.jar [for host]:
warning: Implicitly compiled files were not subject to annotation processing.
  Use -proc:none to disable annotation processing or -implicit to specify a policy for implicit compilation.
1 warning
ERROR: /home/llf/bazel/src/main/protobuf/BUILD:36:1: Executing genrule //src/main/protobuf:command_server_cc_proto_codegen failed: process-wrapper failed: error executing command 
  (cd /tmp/bazel_EuUM0clx/out/bazel-sandbox/a95caa17-3b0c-4368-8de3-92f81b4fe053-666/execroot/bazel && \
  exec env - \
    LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64::/usr/local/lib \
    PATH=/home/llf/anaconda3/bin:/usr/local/cuda-7.5/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/home/llf/usr/local/python/bin:/home/llf/usr/local/gmp-1/bin:/home/llf/usr/local/bazel/bin:/home/llf/usr/local/python/bin:/usr/local/cuda/bin/:/usr/bin/java:/usr/java/jdk1.8.0_111/bin \
  /tmp/bazel_EuUM0clx/out/execroot/bazel/_bin/process-wrapper -1 5 - - /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; third_party/protobuf/3.0.0/protoc-3.0.0-linux-x86_64.exe\
    --plugin=protoc-gen-grpc=bazel-out/host/bin/third_party/grpc/cpp_plugin\
    --cpp_out=bazel-out/local-opt/genfiles\
    --grpc_out=bazel-out/local-opt/genfiles\
    src/main/protobuf/command_server.proto').
bazel-out/host/bin/third_party/grpc/cpp_plugin: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by bazel-out/host/bin/third_party/grpc/cpp_plugin)
--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.
Target //src:bazel failed to build
INFO: Elapsed time: 45.674s, Critical Path: 40.50s

ERROR: Could not build Bazel

How to address this problem? Refence the error

Install gcc 4.8.2 by recompiling source on off-line server with CentOS 6.4 Operating System

My server in laboratory is off-line, I can not install any software or depends library by yum install or wget http://.... Fortunately, I have super-user privileges(my username is in the /etc/sudoers), it's help for installing gcc. Let's begin to install gcc-4.8.2.

  1. Make sure your system information, my OS(Operating System) is :
    Linux k20-1 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

  2. On your personal computer you download gcc 4.8.2 installation package _gcc-4.8.2.tar.gz
    _ from GCC. Then transport the package to your server by scp ./gcc-4.8.2.tar.gz /home/user/gcc.

  3. Decompress the package by $tar -zxvf gcc-4.8.2.tar.gz ( or by if $tar -jxvf gcc-4.8.2.tar.bz2 ). Then go to gcc-4.8.2 directory by $cd /home/user/gcc/gcc-4.8.2 to see what depends library we should download by $vi gcc-4.8.1/contrib/download_prerequisites . It shows that gcc-4.8.2 needs gmp-5.1.3, mpfr-3.1.2 and mpc-1.0.1.

  4. From ftp://ftp.gnu.org/gnu/gmp/ download GMP install package gmp-5.1.3 .tar.bz2.
    From mpfr to download MPFR install package mpfr-3.1.2.tar.gz.
    From multiprecision to download MPC install package mpc-1.0.1.tar.gz

  5. Decompress the GMP, MPFR and MPC packages by $tar -zxvf or $tar -jxvf. Then,
    Install GMP:

[llf@k20-1 ~]$ cd gmp-5.1.3
[llf@k20-1 ~]$ sudo ./configure
[llf@k20-1 ~]$ sudo make
[llf@k20-1 ~]$ sudo make check
[llf@k20-1 ~]$ sudo make install

Install MPFR:

[llf@k20-1 ~]$ cd mpfr-3.1.2
[llf@k20-1 ~]$ sudo ./configure  --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib
[llf@k20-1 ~]$ sudo make
[llf@k20-1 ~]$ sudo make check
[llf@k20-1 ~]$ sudo make install

Install MPC:

[llf@k20-1 ~]$ cd mpc-1.0.1
[llf@k20-1 ~]$ sudo ./configure  --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib  --with-mpfr-include=/usr/local/include --with-mpfr-lib=/usr/local/lib
[llf@k20-1 ~]$ sudo make
[llf@k20-1 ~]$ sudo make check
[llf@k20-1 ~]$ sudo make install
  1. Add the include and lib to ~/.bashrc,
$vi ~/.bashrc  then add
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=/usr/local/include:$C_INCLUDE_PATH
to  at the end of file.
  1. Add the lib to share libraries. $sudo vi /etc/ld.so.conf adding the following to it:
/usr/local/lib
  1. Install gcc-4.8.2. Make gcc install directory $sudo mkdir /usr/local/gcc4.8.2. Then cd /home/user/gcc/gcc-4.8.2. Run,
[llf@k20-1 ~]$ mkdir build  
[llf@k20-1 ~]$ cd build  
[llf@k20-1 ~]$ sudo ../configure --prefix=/usr/local/gcc4.8.2 --enable-threads=posix --disable-checking --enable-languages=c,c++ --disable-multilib  --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib  --with-mpfr-include=/usr/local/include --with-mpfr-lib=/usr/local/lib --with-mpc-include=/usr/local/include --with-mpc-lib=/usr/local/lib
[llf@k20-1 ~]$ sudo make
[llf@k20-1 ~]$ sudo make install
  1. The end result of sudo make is:
libtool: link: ranlib .libs/libatomic.a
libtool: link: ( cd ".libs" && rm -f "libatomic.la" && ln -s "../libatomic.la" "libatomic.la" )
true  DO=all multi-do # make
make[4]: Leaving directory `/home/llf/support/gcc/gcc-4.8.2/build/x86_64-unknown-linux-gnu/libatomic'
make[3]: Leaving directory `/home/llf/support/gcc/gcc-4.8.2/build/x86_64-unknown-linux-gnu/libatomic'
make[2]: Leaving directory `/home/llf/support/gcc/gcc-4.8.2/build/x86_64-unknown-linux-gnu/libatomic'
make[1]: Leaving directory `/home/llf/support/gcc/gcc-4.8.2/build'
  1. The end result of sudo make install is:
libtool: finish: PATH="/sbin:/bin:/usr/sbin:/usr/bin:/sbin" ldconfig -n /usr/local/gcc4.8.2/lib/../lib64
ldconfig: /usr/local/gcc4.8.2/lib/../lib64/libstdc++.so.6.0.18-gdb.py is not an ELF file - it has the wrong magic bytes at the start.

----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/gcc4.8.2/lib/../lib64

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[4]: Nothing to be done for `install-data-am'.
make[4]: Leaving directory `/home/llf/support/gcc/gcc-4.8.2/build/x86_64-unknown-linux-gnu/libatomic'
make[3]: Leaving directory `/home/llf/support/gcc/gcc-4.8.2/build/x86_64-unknown-linux-gnu/libatomic'
make[2]: Leaving directory `/home/llf/support/gcc/gcc-4.8.2/build/x86_64-unknown-linux-gnu/libatomic'
make[1]: Leaving directory `/home/llf/support/gcc/gcc-4.8.2/build'

  1. Create soft link.
[llf@k20-1 ~]$ sudo mkdir /usr/gcc4.4.7backup/ 
[llf@k20-1 ~]$ sudo mv /usr/bin/{gcc,g++} /usr/gcc4.4.7backup
[llf@k20-1 ~]$ ln -s /usr/local/gcc4.8.2/bin/gcc  /usr/bin/gcc
[llf@k20-1 ~]$ ln -s /usr/local/gcc4.8.2/bin/g++ /usr/bin/g++
[llf@k20-1 ~]$ gcc -v
It will show your new version of GCC.

It's batter to create a README.md in /usr/gcc4.4.7backup in case other users need to use old gcc version gcc-4.4.7:

[llf@k20-1 ~]$ vi /usr/gcc4.4.7backup/README.md
writing: if you want to use gcc-4.4.7. Please 
[llf@k20-1 ~]$ sudo mv /usr/gcc4.4.7backup/{gcc,g++} /usr/bin

Reference from 1, 2, 2, 4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.