/usr/bin/ld.gold: error: cannot find -lstdc++
kevinyuan opened this issue · 12 comments
src/main/tools/process-tools.cc:118: sigaction(32, &sa, nullptr) failed
src/main/tools/process-tools.cc:118: sigaction(33, &sa, nullptr) failed
/usr/bin/ld.gold: error: cannot find -lstdc++
collect2: error: ld returned 1 exit status
src/main/tools/linux-sandbox-pid1.cc:437: waitpid returned 2
src/main/tools/linux-sandbox-pid1.cc:457: child exited with code 1
src/main/tools/linux-sandbox.cc:204: child exited normally with exitcode 1
Target //main:lgshell failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 6.333s, Critical Path: 4.26s
INFO: 1 process: 1 remote cache hit.
FAILED: Build did NOT complete successfully
Do you have c++ installed in your machine?
It needs gcc 8 or newer
Yes it's already installed.
~/dev/livehd > gcc --version
gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4)
Hi Renau,
I also see this message before the error :
src/main/tools/process-tools.cc:118: sigaction(32, &sa, nullptr) failed
src/main/tools/process-tools.cc:118: sigaction(33, &sa, nullptr) failed
/usr/bin/ld.gold: error: cannot find -lstdc++
collect2: error: ld returned 1 exit status
src/main/tools/linux-sandbox-pid1.cc:437: waitpid returned 2
src/main/tools/linux-sandbox-pid1.cc:457: child exited with code 1
src/main/tools/linux-sandbox.cc:204: child exited normally with exitcode 1
Target //main:lgshell failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 6.333s, Critical Path: 4.26s
INFO: 1 process: 1 remote cache hit.
FAILED: Build did NOT complete successfully
Hi Renau,
Any update on this issue ?
Hi Renau,
I also see this message before the error :
src/main/tools/process-tools.cc:118: sigaction(32, &sa, nullptr) failed src/main/tools/process-tools.cc:118: sigaction(33, &sa, nullptr) failed
/usr/bin/ld.gold: error: cannot find -lstdc++
collect2: error: ld returned 1 exit status
src/main/tools/linux-sandbox-pid1.cc:437: waitpid returned 2
src/main/tools/linux-sandbox-pid1.cc:457: child exited with code 1
src/main/tools/linux-sandbox.cc:204: child exited normally with exitcode 1
Target //main:lgshell failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 6.333s, Critical Path: 4.26s
INFO: 1 process: 1 remote cache hit.
FAILED: Build did NOT complete successfully
Ih Renau,
I am running CentOS 8 and gcc (GCC) 8.3.1 was already installed.
~/dev/livehd > gcc --version
gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4)
Hi Renau,
I do have g++ installed and it works correctly.
~/dev/livehd > g++ --version
g++ (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~/dev/livehd > cat hello.cc
#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
}
~/dev/livehd > g++ hello.cc
~/dev/livehd > ./a.out
Hello World!
The error comes from compiling of the yosys submodule, so I tried to compile only this submodule.
~/dev/livehd > bazel build //inou/yosys:liblgraph_yosys --verbose_failures
INFO: Invocation ID: 981e980a-b9f8-4d3d-9d2d-40f82c2953da
INFO: Analyzed target //inou/yosys:liblgraph_yosys (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
WARNING: Reading from Remote Cache:
connection timed out: mada2.cse.ucsc.edu/128.114.63.74:8082
ERROR: /home/kevinyuan/dev/livehd/inou/yosys/BUILD:32:1: Action inou/yosys/liblgraph_yosys.so failed (Exit 1) linkso_tool failed: error executing command
(cd /home/kevinyuan/.cache/bazel/_bazel_kevinyuan/1b2848e84f5d08404432e10f6e83f66e/sandbox/linux-sandbox/398/execroot/livehd && \
exec env - \
bazel-out/host/bin/tools/linkso_tool bazel-out/k8-fastbuild/bin/inou/yosys/liblgraph_yosys.so /usr/bin/gcc /usr/bin/ar bazel-out/k8-fastbuild/bin/inou/yosys/liblgyosys-lib.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/hash/libhash.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/hash/libcity.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/types/libbad_variant_access.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/container/libraw_hash_set.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/types/libbad_optional_access.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/container/libhashtablez_sampler.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/base/libexponential_biased.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/synchronization/libsynchronization.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/synchronization/libgraphcycles_internal.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/debugging/libstacktrace.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/debugging/libsymbolize.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/debugging/libdebugging_internal.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/debugging/libdemangle_internal.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/base/libmalloc_internal.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/time/libtime.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/time/internal/cctz/libtime_zone.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/time/internal/cctz/libcivil_time.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/strings/libstrings.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/strings/libinternal.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/base/libbase.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/base/libdynamic_annotations.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/base/libspinlock_wait.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/numeric/libint128.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/base/libthrow_delegate.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/base/libraw_logging_internal.a bazel-out/k8-fastbuild/bin/external/com_google_absl/absl/base/liblog_severity.a bazel-out/k8-fastbuild/bin/core/libcore.a bazel-out/k8-fastbuild/bin/eprp/libeprp.a bazel-out/k8-fastbuild/bin/elab/libelab.a bazel-out/k8-fastbuild/bin/lemu/liblemu.a bazel-out/k8-fastbuild/bin/external/boost/libchrono.a bazel-out/k8-fastbuild/bin/external/boost/libsystem.a bazel-out/k8-fastbuild/bin/external/boost/libcontainer.a bazel-out/k8-fastbuild/bin/external/boost/libatomic.a bazel-out/k8-fastbuild/bin/external/boost/libregex.a bazel-out/k8-fastbuild/bin/external/boost/libexception.a bazel-out/k8-fastbuild/bin/external/iassert/libiassert.a -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -lrt -lgcov -lpthread)
Execution platform: @local_config_platform//:host
Use --sandbox_debug to see verbose messages from the sandbox
/usr/bin/ld.gold: error: cannot find -lstdc++
collect2: error: ld returned 1 exit status
Target //inou/yosys:liblgraph_yosys failed to build
INFO: Elapsed time: 5.695s, Critical Path: 5.36s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
There's a warning before the error occurs:
WARNING: Reading from Remote Cache:
connection timed out: mada2.cse.ucsc.edu/128.114.63.74:8082
Is it the cause of the error?
I also tried to ping mada2.cse.ucsc.edu/128.114.63.74 but timeout.
Is it because there's some dead URL in the bazel configure file which leads to the linker error ?
Thanks.
It looks like the error is due to the statick link option.
I modified the tools/linkso.bzl and the compilation passed that error point.
~/dev/livehd > git diff tools/linkso.bzl |
diff --git a/tools/linkso.bzl b/tools/linkso.bzl |
index ca959479..bc7fb32b 100644 |
--- a/tools/linkso.bzl |
+++ b/tools/linkso.bzl |
@@ -64,7 +64,8 @@ def _impl(ctx): |
#print(compiler_executable) |
#print(ar_executable) |
|
- args = [output.path] + [compiler_executable] + [ar_executable] + [f.path for f in src_libs2] + ["-Wl,-Bstatic"] + ["-lstdc++"] + ["-Wl,-Bdynamic"] + ["-lrt", "-lgcov", "-lpthread"] |
+ #args = [output.path] + [compiler_executable] + [ar_executable] + [f.path for f in src_libs2] + ["-Wl,-Bstatic"] + ["-lstdc++"] + ["-Wl,-Bdynamic"] + ["-lrt", "-lgcov", "-lpthread"] |
+ args = [output.path] + [compiler_executable] + [ar_executable] + [f.path for f in src_libs2] + ["-Wl,-Bdynamic"] + ["-lrt", "-lgcov", "-lpthread"] |
|
ctx.actions.run( |
inputs=src_libs2,
Thanks Renau,
Please close this ticket.