I followed Installing Ray — Ray 2.3.0 to install and trying the ray-template to compile C++, but not working:
$ bash run.sh
...
/usr/bin/ld.gold: fatal error: ./: pread failed: Is a directory
collect2: error: ld returned 1 exit status
Target //:example failed to build
Ubuntu 22.04.2 LTS
gcc version 11.3.0
Please help.
1 Like
Below PR fixes the issue. Committers, please review the PR, thanks!
ray-project:master
← soumitrak:master
opened 11:46PM - 18 Mar 23 UTC
CPP generate-bazel-project-template is failing during build, due to extra space … in the BUILD.bazel file. This commit fixes that.
Before fix:
```
$ ray cpp --generate-bazel-project-template-to ray-template
Project template generated to /home/soumitra/opensource/ray-template
To build and run this template, run
cd /home/soumitra/opensource/ray-template && bash run.sh
$ cd ray-template/
$ bash run.sh
Starting local Bazel server and connecting to it...
INFO: Analyzed target //:example (36 packages loaded, 3391 targets configured).
INFO: Found 1 target...
ERROR: /home/soumitra/opensource/ray-template/BUILD.bazel:15:10: Linking example.so failed: (Exit 1): gcc failed: error executing command (from target //:example.so) /usr/bin/gcc @bazel-out/k8-fastbuild/bin/example.so-2.params
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
/usr/bin/ld.gold: fatal error: ./: pread failed: Is a directory
collect2: error: ld returned 1 exit status
ERROR: /home/soumitra/opensource/ray-template/BUILD.bazel:1:10: Linking example failed: (Exit 1): gcc failed: error executing command (from target //:example) /usr/bin/gcc @bazel-out/k8-fastbuild/bin/example-2.params
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
/usr/bin/ld.gold: fatal error: ./: pread failed: Is a directory
collect2: error: ld returned 1 exit status
Target //:example failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 9.026s, Critical Path: 4.57s
INFO: 3241 processes: 3239 internal, 2 linux-sandbox.
FAILED: Build did NOT complete successfully
The problem is seen in ./bazel-bin/example-2.params file:
$ cat ./bazel-bin/example-2.params
...
-Wl,-rpath,
./ ==================>>>> This is the issue
...
```
After fix:
```
$ ray cpp --generate-bazel-project-template-to ray-template
Project template generated to /home/soumitra/opensource/ray-template
To build and run this template, run
cd /home/soumitra/opensource/ray-template && bash run.sh
$ cd ray-template/
$ bash run.sh
Starting local Bazel server and connecting to it...
INFO: Analyzed target //:example (36 packages loaded, 3391 targets configured).
INFO: Found 1 target...
Target //:example up-to-date:
bazel-bin/example
INFO: Elapsed time: 3.986s, Critical Path: 0.27s
INFO: 5 processes: 3 internal, 2 linux-sandbox.
INFO: Build completed successfully, 5 total actions
```
1 Like
Thanks @soumitra , we will let the code owner review asap.
1 Like
cade
March 20, 2023, 6:49pm
4
Thanks @soumitra for fixing!