Linking Linux library to FreeBSD program.

Pedro Giffuni pfg at FreeBSD.org
Fri Nov 22 19:08:29 UTC 2019


> Hello hackers@
>
> In my quest for CUDA on FreeBSD I managed to compile a simple CUDA program
> using native clang. However, it required linking to libcudart.so from Linux
> CUDA distribution.
>
> As you can guess, running this binary results in a segfault - a.out being a
> FreeBSD binary tries to load libcudart.so Linux library, which in turn
> pulls Linux libc.so.
>
> What course of action could be taken in this situation? My plan is to
> generate a native wrapper library for libcudart.so in which every exported
> function would call Linux binary linked to real libcudart.so and route
> function arguments via RPC or some other mechanism. This looks awful for
> sure, but I don't see any other solutions.
Hi;

FWIW, I don't know how much alive it still is, but Debian kFreeBSD[1] 
had a native port of glibc to FreeBSD.

Cheers,

Pedro.

[1] https://www.debian.org/ports/kfreebsd-gnu/



More information about the freebsd-hackers mailing list