Hi! I’m trying to get PyTorch’s libtorch to work. I downloaded its prebuilt binaries from Start Locally | PyTorch and got this weird message:
<command line>: libtorch_cuda.so: ELF load command address/offset not page-aligned
I checked the file with readelf and the 4th load command’s offset is indeed not aligned.
$ readelf -l /home/kenhkan/libtorch/lib/libtorch_cuda.so
Elf file type is DYN (Shared object file)
Entry point 0x1191370
There are 14 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x000000000114e878 0x000000000114e878 R 0x1000
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RW 0x10
LOAD 0x000000000114f000 0x000000000114f000 0x000000000114f000
0x00000000036d5b41 0x00000000036d5b41 R E 0x1000
LOAD 0x0000000004825000 0x0000000004825000 0x0000000004825000
0x000000004a567323 0x000000004a567323 R 0x1000
GNU_EH_FRAME 0x000000004e64a808 0x000000004e64a808 0x000000004e64a808
0x00000000000cb63c 0x00000000000cb63c R 0x4
LOAD 0x000000004ed8ccd0 0x000000004ed8dcd0 0x000000004ed8dcd0
0x000000000dc74800 0x000000000ec468a8 RW 0x1000
... <redacted> ...
So NixOS is correctly reporting the issue, but I’ve used the same binary successfully for a long time on Ubuntu, and I assume that the same binary has been working for many people since it’s a popular library.
I assume that NixOS is just stricter in checking boundary misalignment even if it wouldn’t cause a problem when run. Is there a way to “relax” this check on NixOS?
Or if anyone has had experience with this or has some insights/alternatives, please chime in as well. Thank you!