Page 1 of 1

Unable to compile on new computer

Posted: June 20th, 2017, 12:02 am
by Saka
I just got a new laptop and I reinstalled cygwin, selected bin for gcc-g++ and make, but now I can't seem to compile anything! I tried all the new stuff and even gfind, which has it's own compilation page on the wiki! I keep getting this error every time:

Code: Select all

/tmp/ccxGzwWp.o:gfind.c:(.text+0x4d9): undefined reference to `qIsEmpty'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x4d9): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `qIsEmpty'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x936): undefined reference to `enqueue'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x936): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `enqueue'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x981): undefined reference to `setVisited'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x981): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `setVisited'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x3af5): undefined reference to `isVisited'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x3af5): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `isVisited'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x3b0a): undefined reference to `enqueue'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x3b0a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `enqueue'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x3b5a): undefined reference to `pop'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x3b5a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `pop'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x3b73): undefined reference to `setVisited'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x3b73): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `setVisited'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x3b8c): undefined reference to `setVisited'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x3b8c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `setVisited'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x5c08): undefined reference to `pop'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x5c08): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `pop'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x6029): undefined reference to `dequeue'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x6029): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `dequeue'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x6042): undefined reference to `qIsEmpty'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x6042): additional relocation overflows omitted from the output
/tmp/ccxGzwWp.o:gfind.c:(.text+0x62f7): undefined reference to `enqueue'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x635a): undefined reference to `dequeue'
/tmp/ccxGzwWp.o:gfind.c:(.text+0x6363): undefined reference to `enqueue'
collect2: error: ld returned 1 exit status
And it doesn't generate an executable version. Help please?

Re: Unable to compile on new computer

Posted: June 20th, 2017, 1:32 am
by Sokwe
I think I answered this particular question here. Specifically, if you compile with the -O3 flag these errors should go away. You should be compiling with -O3 anyway, because it makes the program faster.

Re: Unable to compile on new computer

Posted: June 20th, 2017, 2:07 am
by Saka
It still doesn't generate an executeable!
My command to compile is:

Code: Select all

gcc -O3 mfind.c -o mfind

(mfind is your gfind-zfind hybrid)
But when I try

Code: Select all

./mfind
It says there is no such directory. And yes I am in the right folder.
There is 1 error, but I have already turned off my laptop so I'm a bit lazy to post it.

Re: Unable to compile on new computer

Posted: June 20th, 2017, 2:33 am
by Sokwe
Saka wrote:My command to compile is:

Code: Select all

gcc -O3 mfind.c -o mfind
You need to compile with -fopenmp as I said near the bottom of this post.

Re: Unable to compile on new computer

Posted: June 20th, 2017, 5:20 am
by Saka
Whoops I keep forgetting about -fopenmp :oops:

Re: Unable to compile on new computer

Posted: June 21st, 2017, 8:17 pm
by fluffykitty
What if my compiler doesn't support -fopenmp?

Re: Unable to compile on new computer

Posted: June 21st, 2017, 10:05 pm
by Sokwe
fluffykitty wrote:What if my compiler doesn't support -fopenmp?
"-fopenmp" is a compiler flag for the GCC compiler. For other compilers you may need to do something different. Try googling how to compile OpenMP with your preferred compiler. If your compiler doesn't support OpenMP at all, then you can compile my new program (see here) by removing the two lines that say

Code: Select all

omp_set_num_threads(params[P_NUMTHREADS]);
This means that you won't be able to use the multithreading feature.