I have run into a problem when trying to enable out-of-core for StarPU in a C++ project.
The functions from _starpudisk.h header file (for example : starpu_disk_register) are not found by the linker when I include starpu.h as C++ header :
undefined reference to 'starpu_disk_register(starpu_disk_ops*, void*, long)'.
However they are linked correctly when the header is included as C header, for example:
extern "C" {
#include <starpu.h>
}
Steps to reproduce
In order to reproduce the problem I have prepared a small example:
#include <starpu.h>
int main(int argc, char **argv)
{
if (starpu_init(NULL)) {
return 1;
}
int dd = starpu_disk_register((struct starpu_disk_ops*)&starpu_disk_unistd_ops, (void*)"/tmp/", (starpu_ssize_t)(1024 * 1024 * 100));
if (dd == -ENOENT) {
return 77;
}
starpu_shutdown();
}
To reproduce the issue, build the minimal reproducible example file with gcc and g++ compilers:
Notice the linking issue with starpu_disk_register function when StarPU is compiled using g++, but not when using gcc.
Obtained behavior
Linking fails when g++ is used :
/usr/bin/ld: /tmp/ccM3c7jw.o: in function `main':
outofcore_mre.c:(.text+0x62): undefined reference to `starpu_disk_register(starpu_disk_ops*, void*, long)'
collect2: error: ld returned 1 exit status
Compilation and linking are completed successfully when using gcc.
Expected behavior
Out-of-core functions compile and link correctly when StarPU is compiled using g++ compiler, and imported as a C++ header.
Hi,
I have run into a problem when trying to enable out-of-core for StarPU in a C++ project.
The functions from _starpudisk.h header file (for example : starpu_disk_register) are not found by the linker when I include starpu.h as C++ header :
undefined reference to 'starpu_disk_register(starpu_disk_ops*, void*, long)'
.However they are linked correctly when the header is included as C header, for example:
Steps to reproduce
In order to reproduce the problem I have prepared a small example:
To reproduce the issue, build the minimal reproducible example file with gcc and g++ compilers:
gcc disk_mre.c $(pkg-config --libs --cflags starpu-1.4)
g++ disk_mre.c $(pkg-config --libs --cflags starpu-1.4)
Notice the linking issue with starpu_disk_register function when StarPU is compiled using g++, but not when using gcc.
Obtained behavior
Linking fails when g++ is used :
Compilation and linking are completed successfully when using gcc.
Expected behavior
Out-of-core functions compile and link correctly when StarPU is compiled using g++ compiler, and imported as a C++ header.
Configuration
../configure --prefix=$INSTALL_DIR/starpu-fxt --disable-opencl --disable-build-doc --disable-build-examples --disable-build-test --with-fxt=$INSTALL_DIR/fxt --enable-hdf5 --enable-bubble
Configuration result
config.log
Distribution
Git (tags/starpu-1.4.1)
Version of StarPU
StarPU 1.4.1 It is also reproducible on StarPU 1.4.3.
Version of GPU drivers
N/A
Thank you in advance for your help and advice.
Best regards, Przemyslaw DOMINIKOWSKI