Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/apps/test_cuda_get_symbol_address.cu build failure on Debian 12 with "relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE" #10402

Open
hexclover opened this issue Jan 4, 2025 · 1 comment
Assignees
Labels

Comments

@hexclover
Copy link

Describe the bug

On Debian 12 with GCC 12.2.0, build will fail at test/apps/test_cuda_get_symbol_address.cu, complaining about relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE.

/usr/local/cuda-12.6/bin/nvcc -DHAVE_CONFIG_H -I. -I../..  \
-DCPU_FLAGS="" -I/home/user/ucc-dev/ucx/src -I/home/user/ucc-dev/ucx -I/home/user/ucc-dev/ucx/src -I/usr/local/cuda-12.6/include -MT test_cuda_get_symbol_address.o -MD -MF \
.deps/test_cuda_get_symbol_address.Tpo -c -o test_cuda_get_symbol_address.o \
`test -f 'test_cuda_get_symbol_address.cu' || echo './'`test_cuda_get_symbol_address.cu
mv -f .deps/test_cuda_get_symbol_address.Tpo \
.deps/test_cuda_get_symbol_address.Po
/bin/bash ../../libtool  --tag=CC   --mode=link gcc -O3 -g -Wall -Werror -funwind-tables -Wframe-larger-than=8192 -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-label -Wno-long-long -Wno-endif-labels -Wno-sign-compare -Wno-multichar -Wno-deprecated-declarations -Winvalid-pch -Wno-pointer-sign -Werror-implicit-function-declaration -Wno-format-zero-length -Wnested-externs -Wshadow -Werror=declaration-after-statement -fPIC -L/usr/local/cuda-12.6/lib64 -L/usr/local/cuda-12.6/lib64/stubs  -o test_cuda_get_symbol_address test_cuda_get_symbol_address.o ../../src/ucp/libucp.la ../../src/ucm/libucm.la -lcudart -lrt -lrt 
libtool: link: gcc -O3 -g -Wall -Werror -funwind-tables -Wframe-larger-than=8192 -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-label -Wno-long-long -Wno-endif-labels -Wno-sign-compare -Wno-multichar -Wno-deprecated-declarations -Winvalid-pch -Wno-pointer-sign -Werror-implicit-function-declaration -Wno-format-zero-length -Wnested-externs -Wshadow -Werror=declaration-after-statement -fPIC -o .libs/test_cuda_get_symbol_address test_cuda_get_symbol_address.o  -L/usr/local/cuda-12.6/lib64 -L/usr/local/cuda-12.6/lib64/stubs ../../src/ucp/.libs/libucp.so /home/user/ucc-dev/ucx/src/uct/.libs/libuct.so /home/user/ucc-dev/ucx/src/ucs/.libs/libucs.so -lm /home/user/ucc-dev/ucx/src/ucm/.libs/libucm.so ../../src/ucm/.libs/libucm.so -ldl -lcudart -lrt -Wl,-rpath -Wl,/home/user/ucc-dev/prefix/lib
/usr/bin/ld: test_cuda_get_symbol_address.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE

Steps to Reproduce

./autogen.sh
./configure --prefix=/home/user/ucc-dev/prefix --with-cuda=/usr/local/cuda-12.6
make -j V=1 install

Setup and versions

  • OS: Debian GNU/Linux 12 + Linux Server 6.1.0-17-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.69-1 (2023-12-30) x86_64 GNU/Linux
  • GCC: gcc (Debian 12.2.0-14) 12.2.0
  • CUDA: 12.6, installed with the official .run at /usr/local/cuda-12.6
  • UCX: commit e51cd2a

Additional information (depending on the issue)

It seems in this case nvcc needs a flag --compiler-options -fPIC passed to it:

diff --git a/test/apps/Makefile.am b/test/apps/Makefile.am
index 690dbc4c3..1705076c7 100644
--- a/test/apps/Makefile.am
+++ b/test/apps/Makefile.am
@@ -119,10 +119,10 @@ test_tcmalloc_LDADD    = -ldl $(TCMALLOC_LIB) \
                           $(top_builddir)/src/ucp/libucp.la
 endif
 
-.cu.o : ; $(NVCC) -c -o $@ $<
+.cu.o : ; $(NVCC) --compiler-options -fPIC -c -o $@ $<
 
 test_cuda_get_symbol_address.o: test_cuda_get_symbol_address.cu
-       $(NVCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(NVCC) --compiler-options -fPIC $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
        $(test_cuda_get_symbol_address_CPPFLAGS) -MT $@ -MD -MF \
        $(DEPDIR)/test_cuda_get_symbol_address.Tpo -c -o $@ \
        `test -f '$<' || echo '$(srcdir)/'`$<

With this change I am able to build UCX successfully.

@hexclover hexclover added the Bug label Jan 4, 2025
@hexclover hexclover changed the title test/apps/test_cuda_get_symbol_address.cu build failure on Debian 12 with ``relocation R_X86_64_32S against .rodata' can not be used when making a PIE object; recompile with -fPIE``` test/apps/test_cuda_get_symbol_address.cu build failure on Debian 12 with "relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE" Jan 4, 2025
@rakhmets
Copy link
Collaborator

rakhmets commented Jan 7, 2025

Should be fixed by #10358.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants