Can't compile from C code

37 views
Skip to first unread message

Michael Vinsky

unread,
May 15, 2025, 1:33:58 PMMay 15
to structure-software
I downloaded the code from this link:


but when I try to compile it there are multiple definition errors like "collect2: error: ld returned 1 exit status" and "make: *** [Makefile:24: structure] Error 1". All I did was run "make clean" and "make" so what am I missing?

Thanks!

Vikram Chhatre

unread,
May 15, 2025, 1:36:38 PMMay 15
to structure...@googlegroups.com
What is the output of "uname -a"?

--
You received this message because you are subscribed to the Google Groups "structure-software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to structure-softw...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/structure-software/afd5c6c0-2559-42c7-890c-4bca0c41a1c5n%40googlegroups.com.

Michael Vinsky

unread,
May 15, 2025, 3:11:07 PMMay 15
to structure...@googlegroups.com
Linux mvinsky-VMware-Virtual-Platform 6.11.0-25-generic #25~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 15 17:20:50 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Vikram Chhatre

unread,
May 15, 2025, 3:17:53 PMMay 15
to structure...@googlegroups.com
The only thing I can think of is that you are running a virtual Linux environment and perhaps some of the libraries needed for Make aren't properly linked. Do you have access to a workstation/server with Linux natively installed? If so, I would try there.

Michael Vinsky

unread,
May 15, 2025, 4:00:26 PMMay 15
to structure...@googlegroups.com
I tried it on a linux workstation (6.8.0-59-generic #61~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 15 17:03:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux). Still got the same messages. Here are the last few lines:

/usr/bin/ld: output.o:(.bss+0x194): multiple definition of `EXTRACOLS'; structure.o:(.bss+0x19c): first defined here
/usr/bin/ld: output.o:(.bss+0x198): multiple definition of `PHENOTYPE'; structure.o:(.bss+0x1a0): first defined here
/usr/bin/ld: output.o:(.bss+0x19c): multiple definition of `POPFLAG'; structure.o:(.bss+0x1a4): first defined here

collect2: error: ld returned 1 exit status
make: *** [Makefile:24: structure] Error 1

Its seems the issue is that there are due to multiple definitions of global variables across C source files. I think its because you need to distinguish between definition and declaration of global variables. Its like in params.c seed needs to be defined as "int SEED;" and in params.h it needs to be declared as "extern int SEED;". Does that make sense?



Francisco Pina Martins

unread,
May 16, 2025, 5:43:59 PMMay 16
to structure-software
Dear Michael,

Try editing the Makefile, and in the first line, change:
OPT = -O3

to

OPT = -O3 -fcommon

This seems to be an issue with how recent versions of GCC deal with multiple definitions of the same variable.

Best,

Francisco

Michael Vinsky

unread,
May 26, 2025, 11:06:52 AMMay 26
to structure-software
*Note: Vikram also tested this out and it wouldn't compile for him either but I found this discussion 


and found this person wrote a script to install Structure which did one interesting thing. He included "sed -i 's/OPT = -O3/OPT = -O3 -fcommon/' Makefile". I ran this before using "make" and it looks like it compiled. I will need to test it out but this might be the missing solution.

Reply all
Reply to author
Forward
0 new messages