You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "infdahai (via GitHub)" <gi...@apache.org> on 2023/05/03 12:08:03 UTC

[GitHub] [incubator-kvrocks] infdahai opened a new issue, #1413: Failed to build kvrocks due to ld error while linking libluajit.a

infdahai opened a new issue, #1413:
URL: https://github.com/apache/incubator-kvrocks/issues/1413

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/incubator-kvrocks/issues) and found no similar issues.
   
   
   ### Version
   
   ```shell
   $ uname -r                                                                                                    
   5.15.90.1-microsoft-standard-WSL2
   
   $ clang -v                                       
   clang version 16.0.0
   Target: x86_64-unknown-linux-gnu
   Thread model: posix
   InstalledDir: /usr/local/bin
   Found candidate GCC installation: /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.1.0
   Selected GCC installation: /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.1.0
   Candidate multilib: .;@m64
   Selected multilib: .;@m64
   
   $ ld -v
   LLD 16.0.0 (compatible with GNU linkers)
   
   ```
   ubuntu 22(wsl)
   kvrocks: the unstable branch
   
   ### Minimal reproduce step
   
   I execute the build command.
   ```shell
   ./x.py build -DENABLE_OPENSSL=ON --ghproxy -j24
   ```
   
   
   ### What did you expect to see?
   
   Build OK
   
   ### What did you see instead?
   
   
   
   <details><summary>Build error</summary>
   <p>
   
   
   ```shell
   -- Configuring done (10.3s)
   -- Generating done (0.2s)
   -- Build files have been written to: ~/proj/finish_proj/incubator-kvrocks/build
   $ /usr/local/bin/cmake --build . -j24 -t kvrocks kvrocks2redis
   make[4]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
   make[4]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
   make[4]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
   make[4]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
   [  0%] Built target fmt
   [  1%] Built target snappy
   [  4%] Built target zlibstatic
   [  6%] Built target glogbase
   [ 10%] Built target event_core_static
   [ 10%] Built target glog
   [ 10%] Built target make_lz4
   [ 10%] Built target event_pthreads_static
   [ 11%] Built target event_openssl_static
   [ 16%] Built target event_static
   [ 22%] Built target tbb
   [ 22%] Built target make_luajit
   [ 22%] Built target make_zstd
   
   ar: `u' modifier ignored since `D' is the default (see `U')
   ar: `u' modifier ignored since `D' is the default (see `U')
   [ 22%] Built target make_jemalloc
   [ 22%] Building CXX object _deps/rocksdb-build/CMakeFiles/rocksdb.dir/db/malloc_stats.cc.o
   [ 22%] Building CXX object _deps/rocksdb-build/CMakeFiles/rocksdb.dir/memory/jemalloc_nodump_allocator.cc.o
   [ 22%] Building CXX object _deps/rocksdb-build/CMakeFiles/rocksdb.dir/memory/memory_allocator.cc.o
   [ 22%] Linking CXX static library librocksdb.a
   [ 86%] Built target rocksdb
   [ 98%] Built target kvrocks_objs
   [ 98%] Linking CXX executable kvrocks
   /usr/bin/ld: _deps/luajit-src/src/libluajit.a(lj_err.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
   /usr/bin/ld: failed to set dynamic section sizes: bad value
   clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
   gmake[3]: *** [CMakeFiles/kvrocks.dir/build.make:251: kvrocks] Error 1
   gmake[2]: *** [CMakeFiles/Makefile2:521: CMakeFiles/kvrocks.dir/all] Error 2
   gmake[1]: *** [CMakeFiles/Makefile2:528: CMakeFiles/kvrocks.dir/rule] Error 2
   gmake: *** [Makefile:254: kvrocks] Error 2
   Traceback (most recent call last):
     File "~/proj/incubator-kvrocks/./x.py", line 393, in <module>
       args.func(**arg_dict)
     File "~/proj/incubator-kvrocks/./x.py", line 134, in build
       run(cmake, *options, verbose=True, cwd=dir)
     File "~/proj/incubator-kvrocks/./x.py", line 66, in run
       raise RuntimeError(err)
   RuntimeError: 
   failed to run: ('/usr/local/bin/cmake', '--build', '.', '-j24', '-t', 'kvrocks', 'kvrocks2redis')
   exit with code: 2
   ```
   the error can also occur at `libjemalloc.a`
   
   </p>
   </details>
   
   ### Anything Else?
   
   I set the `Jemalloc` and `Luajit` options off, and execute building without errors.
   just like the command
   `"command": "cd ${workspaceFolder};./x.py build -DENABLE_OPENSSL=ON -DDISABLE_JEMALLOC=ON -DUSE_LUAJIT=OFF --ghproxy -j24"
   `
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org.apache.org

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


[GitHub] [incubator-kvrocks] PragmaTwice commented on issue #1413: Failed to build kvrocks due to ld error while linking libluajit.a

Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on issue #1413:
URL: https://github.com/apache/incubator-kvrocks/issues/1413#issuecomment-1529370512

   I will try to reproduce the issue.
   
   BTW, it seems the lld has not been used (ld is used instead):
   ```
   usr/bin/ld: _deps/luajit-src/src/libluajit.a(lj_err.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
   /usr/bin/ld: failed to set dynamic section sizes: bad value
   ```


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

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


[GitHub] [incubator-kvrocks] infdahai closed issue #1413: Failed to build kvrocks due to ld error while linking libluajit.a

Posted by "infdahai (via GitHub)" <gi...@apache.org>.
infdahai closed issue #1413: Failed to build kvrocks due to ld error while linking libluajit.a
URL: https://github.com/apache/incubator-kvrocks/issues/1413


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

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


[GitHub] [incubator-kvrocks] PragmaTwice commented on issue #1413: Failed to build kvrocks due to ld error while linking libluajit.a

Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on issue #1413:
URL: https://github.com/apache/incubator-kvrocks/issues/1413#issuecomment-1532966336

   Could you provide a full and clean (first time build) CMake log file? I am not sure which C compiler is used.
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

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


[GitHub] [incubator-kvrocks] infdahai commented on issue #1413: Failed to build kvrocks due to ld error while linking libluajit.a

Posted by "infdahai (via GitHub)" <gi...@apache.org>.
infdahai commented on issue #1413:
URL: https://github.com/apache/incubator-kvrocks/issues/1413#issuecomment-1532954146

   This problem still exists👎  When I execute the command `./x.py build -DCMAKE_BUILD_TYPE=Debug -DENABLE_OPENSSL=ON -DDISABLE_JEMALLOC=ON --ghproxy -j24 `.
   
   ```sh
   ld.lld: error: relocation R_X86_64_32 cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_prng.o)
   >>> referenced by lj_prng.c
   >>>               lj_prng.o:(lj_prng_seed_secure) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_32S cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_gc.o)
   >>> referenced by lj_gc.c
   >>>               lj_gc.o:(gc_sweep) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_32S cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_gc.o)
   >>> referenced by lj_gc.c
   >>>               lj_gc.o:(gc_onestep) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_gc.o)
   >>> referenced by lj_gc.c
   >>>               lj_gc.o:(.rodata+0x0) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_gc.o)
   >>> referenced by lj_gc.c
   >>>               lj_gc.o:(.rodata+0x8) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_gc.o)
   >>> referenced by lj_gc.c
   >>>               lj_gc.o:(.rodata+0x10) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_gc.o)
   >>> referenced by lj_gc.c
   >>>               lj_gc.o:(.rodata+0x18) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_gc.o)
   >>> referenced by lj_gc.c
   >>>               lj_gc.o:(.rodata+0x20) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_gc.o)
   >>> referenced by lj_gc.c
   >>>               lj_gc.o:(.rodata+0x28) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_32 cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_state.o)
   >>> referenced by lj_state.c
   >>>               lj_state.o:(lua_newstate) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_32 cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_state.o)
   >>> referenced by lj_state.c
   >>>               lj_state.o:(lua_close) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_32S cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_err.o)
   >>> referenced by lj_err.c
   >>>               lj_err.o:(err_unwind) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_32S cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_err.o)
   >>> referenced by lj_err.c
   >>>               lj_err.o:(lj_err_register_mcode) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_32S cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_err.o)
   >>> referenced by lj_err.c
   >>>               lj_err.o:(lj_err_run) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_32 cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_err.o)
   >>> referenced by lj_err.c
   >>>               lj_err.o:(lj_err_lex) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_32 cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_meta.o)
   >>> referenced by lj_meta.c
   >>>               lj_meta.o:(lj_meta_init) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_32S cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_strfmt.o)
   >>> referenced by lj_strfmt.c
   >>>               lj_strfmt.o:(lj_strfmt_parse) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_32S cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_strfmt.o)
   >>> referenced by lj_strfmt.c
   >>>               lj_strfmt.o:(lj_strfmt_parse) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_32S cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_strfmt.o)
   >>> referenced by lj_strfmt.c
   >>>               lj_strfmt.o:(lj_strfmt_wptr) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: relocation R_X86_64_32 cannot be used against local symbol; recompile with -fPIC
   >>> defined in _deps/luajit-src/src/libluajit.a(lj_strfmt.o)
   >>> referenced by lj_strfmt.c
   >>>               lj_strfmt.o:(lj_strfmt_putfxint) in archive _deps/luajit-src/src/libluajit.a
   
   ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
   clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
   ```
   
   I execute the command `./x.py build -DCMAKE_BUILD_TYPE=Debug -DENABLE_OPENSSL=ON -DUSE_LUAJIT=OFF --ghproxy -j24 ` when I add `-fPIC -fPIE` to the 190-line. It also makes a similar error.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

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


[GitHub] [incubator-kvrocks] infdahai closed issue #1413: Failed to build kvrocks due to ld error while linking libluajit.a

Posted by "infdahai (via GitHub)" <gi...@apache.org>.
infdahai closed issue #1413: Failed to build kvrocks due to ld error while linking libluajit.a
URL: https://github.com/apache/incubator-kvrocks/issues/1413


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

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


[GitHub] [incubator-kvrocks] infdahai commented on issue #1413: Failed to build kvrocks due to ld error while linking libluajit.a

Posted by "infdahai (via GitHub)" <gi...@apache.org>.
infdahai commented on issue #1413:
URL: https://github.com/apache/incubator-kvrocks/issues/1413#issuecomment-1533017789

   https://github.com/infdahai/incubator-kvrocks/commit/9464020fe9c34291ebc875e40e522672211524fd


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

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


[GitHub] [incubator-kvrocks] infdahai commented on issue #1413: Failed to build kvrocks due to ld error while linking libluajit.a

Posted by "infdahai (via GitHub)" <gi...@apache.org>.
infdahai commented on issue #1413:
URL: https://github.com/apache/incubator-kvrocks/issues/1413#issuecomment-1532642165

   @PragmaTwice I solved this.
   
   https://github.com/apache/incubator-kvrocks/blob/30e9fd788a4acb585566a008f4d5fff65ee06ce3/CMakeLists.txt#L190-L195
   
   I execute the code to line 194 and add the `-fpie` option.
   gcc6 introduces `--enable-default-pie` and some same changelogs are added into `clang` baed on https://reviews.llvm.org/D113372 . It seems that I don't use `-fpie` argument. 
   
   But I don't know the cause.
   
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

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


[GitHub] [incubator-kvrocks] infdahai commented on issue #1413: Failed to build kvrocks due to ld error while linking libluajit.a

Posted by "infdahai (via GitHub)" <gi...@apache.org>.
infdahai commented on issue #1413:
URL: https://github.com/apache/incubator-kvrocks/issues/1413#issuecomment-1529424424

   > I will try to reproduce the issue.
   > 
   > BTW, it seems the lld has not been used ever (ld was used instead):
   > 
   > ```
   > usr/bin/ld: _deps/luajit-src/src/libluajit.a(lj_err.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
   > /usr/bin/ld: failed to set dynamic section sizes: bad value
   > ```
   
   I want to use the `lto` feature  and execute the  `ln -s ld.lld /usr/bin/ld` command.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

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


[GitHub] [incubator-kvrocks] PragmaTwice commented on issue #1413: Failed to build kvrocks due to ld error while linking libluajit.a

Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on issue #1413:
URL: https://github.com/apache/incubator-kvrocks/issues/1413#issuecomment-1532915706

   Good catch! Feel free to submit a PR.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

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


[GitHub] [incubator-kvrocks] infdahai commented on issue #1413: Failed to build kvrocks due to ld error while linking libluajit.a

Posted by "infdahai (via GitHub)" <gi...@apache.org>.
infdahai commented on issue #1413:
URL: https://github.com/apache/incubator-kvrocks/issues/1413#issuecomment-1535717643

   I change the toolchain to `gcc-13` and the compile has no problem now.
   Therefore I close the issue.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

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