Unable to compile on new computer

For scripts to aid with computation or simulation in cellular automata.
Post Reply
User avatar
Saka
Posts: 3413
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X
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?

Code: Select all

o3b2ob2obo3b2o2b2o$bo3b2obob3o3bo2bo$2bo2b3o5b3ob4o$3o3bo2bo2b3o3b3o$
4bo4bobo4bo$2o2b2o2b4obo2bo3bo$2ob4o3bo2bo2bo2bo$b2o3bobob2o$3bobobo5b
obobobo$3bobobob2o3bo2bobo!
(Check gen 3)
Add your computer to the Table of Lifeenthusiast Computers!

Sokwe
Moderator
Posts: 1637
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: 3413
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X
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.

Code: Select all

o3b2ob2obo3b2o2b2o$bo3b2obob3o3bo2bo$2bo2b3o5b3ob4o$3o3bo2bo2b3o3b3o$
4bo4bobo4bo$2o2b2o2b4obo2bo3bo$2ob4o3bo2bo2bo2bo$b2o3bobob2o$3bobobo5b
obobobo$3bobobob2o3bo2bobo!
(Check gen 3)
Add your computer to the Table of Lifeenthusiast Computers!

Sokwe
Moderator
Posts: 1637
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: 3413
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X
Contact:

Re: Unable to compile on new computer

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

Whoops I keep forgetting about -fopenmp :oops:

Code: Select all

o3b2ob2obo3b2o2b2o$bo3b2obob3o3bo2bo$2bo2b3o5b3ob4o$3o3bo2bo2b3o3b3o$
4bo4bobo4bo$2o2b2o2b4obo2bo3bo$2ob4o3bo2bo2bo2bo$b2o3bobob2o$3bobobo5b
obobobo$3bobobob2o3bo2bobo!
(Check gen 3)
Add your computer to the Table of Lifeenthusiast Computers!

fluffykitty
Posts: 653
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?
I like making rules

Sokwe
Moderator
Posts: 1637
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