Unable to compile on new computer

For scripts to aid with computation or simulation in cellular automata.
Post Reply
User avatar
Saka
Posts: 3627
Joined: June 19th, 2015, 8:50 pm
Location: Indonesia
Contact:

Unable to compile on new computer

Post by Saka » June 20th, 2017, 12:02 am

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?

Sokwe
Moderator
Posts: 2683
Joined: July 9th, 2009, 2:44 pm

Re: Unable to compile on new computer

Post by Sokwe » June 20th, 2017, 1:32 am

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.
-Matthias Merzenich

User avatar
Saka
Posts: 3627
Joined: June 19th, 2015, 8:50 pm
Location: Indonesia
Contact:

Re: Unable to compile on new computer

Post by Saka » June 20th, 2017, 2:07 am

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.

Sokwe
Moderator
Posts: 2683
Joined: July 9th, 2009, 2:44 pm

Re: Unable to compile on new computer

Post by Sokwe » June 20th, 2017, 2:33 am

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.
-Matthias Merzenich

User avatar
Saka
Posts: 3627
Joined: June 19th, 2015, 8:50 pm
Location: Indonesia
Contact:

Re: Unable to compile on new computer

Post by Saka » June 20th, 2017, 5:20 am

Whoops I keep forgetting about -fopenmp :oops:

fluffykitty
Posts: 1175
Joined: June 14th, 2014, 5:03 pm
Contact:

Re: Unable to compile on new computer

Post by fluffykitty » June 21st, 2017, 8:17 pm

What if my compiler doesn't support -fopenmp?

Sokwe
Moderator
Posts: 2683
Joined: July 9th, 2009, 2:44 pm

Re: Unable to compile on new computer

Post by Sokwe » June 21st, 2017, 10:05 pm

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.
-Matthias Merzenich

Post Reply