1

I'm trying my hand at using the relocatable-device-code flag. I have a large project that would be easier to maintain with small blocks of code.

I was able to get the project to compile. When trying to run it, I get a hard crash. When using the debugger:

(gdb) where #0 0x0000000000000001 in ?? () #1 0x00007fffffffe39c in ?? () #2 0x0000000000000000 in ?? () 

I've never seen a stack trace like that! I then reduced the amount of code until I came down to a singularity: main.cu file contains only

#include <iostream> int main(void) { std::cout << "hello, world" << std::endl; return 0; } 

Which still fails. I'm using the following flags to compile my main.cu file.

nvcc -shared -rdc=true -arch=sm_20 -Xcompiler -fPIC -g -G 

Do these make sense? Why the segmentation fault for such a simple progam?

1 Answer 1

1

Remove the -shared switch. That option is not applicable when you are trying to generate an executable.

From the documentation:

Generate a shared library during linking. Note: when other linker options are required for controlling dll generation, use option -Xlinker.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.