Welcome to the Builder Academy

Question GCC 12 to 14 Compile Issues

More
26 Feb 2025 20:43 #10560 by soth
Replied by soth on topic GCC 12 to 14 Compile Issues
I will try to do that later today, getting ready to leave from work :)
I will have to install gcc-12 on the fedora 41 VM since it only shows gcc-14.  I am also going to try and copy the working code over to the new VM as well.  I will report back tonight hopefully.

Thanks again for your help!

kevin

Please Log in or Create an account to join the conversation.

More
26 Feb 2025 21:06 #10561 by soth
Replied by soth on topic GCC 12 to 14 Compile Issues
Ironfist,
It seems that after I installed gcc-12 and changed the Makefile to use "gcc-12" it compiled except a different error now.  I'll paste it here, will not have time to look into it much until later tonight or in the morning though.
Code:
/usr/bin/ld: act.comm.o:  relocation R_X86_64_32S against symbol 'dummy_mob' can not be used when makeing a PIE object; recompile with -fPIE /user/bin/ld: failed to set dynamic section sizes: bad value collect2: error: ld returned 1 exit status make[1]: *** [Makefile:44: ../bin/circle] Error 1 make[1]: *** [Makefile:31: all] Error 2

Please Log in or Create an account to join the conversation.

More
26 Feb 2025 23:09 #10562 by ironfist
Apparently they've been implementing a lot of security measures with redhat:
Position Independent Executable

    RHEL 8 (2019) – PIE enabled by default for all executables compiled with GCC.
    RHEL 9 (2022) – Continues enforcing PIE as default for enhanced security.

Since RHEL 8, all binaries built with GCC must be PIE unless explicitly disabled (-no-pie).

From what I understand you can add (maybe -fPIE ?) -fPIC to the compiler CFLAGS (or MYFLAGS).
Or compile with -no-pie which it doesn't recommend.

dummy_mob is a global variable that can be used in other c files because of the extern in db.h.  It could be made a static variable that would fix the PIE issue except that it needs to be used elsewhere.

Please Log in or Create an account to join the conversation.

More
27 Feb 2025 04:01 #10563 by soth
Replied by soth on topic GCC 12 to 14 Compile Issues
Hi,
I did not come across that yet, but I am glad you mentioned or found it. That does make sense since I moved to a newer version of Fedora. I could compile with the -no-pie and it would not give any errors, but I could not launch the game so I knew just adding <make -no-pie> probably was not the solution after all lol.

I did not try the -fPIE, or maybe I did, but I will try that again in the morning and see what happens.
Thanks for the info on the dummy_mob!

Thanks,
Kevin

Please Log in or Create an account to join the conversation.

More
27 Feb 2025 14:33 #10564 by soth
Replied by soth on topic GCC 12 to 14 Compile Issues
Good morning,
I added the -fPIE to the MYFLAGS in the makefile and did a make clean and make and that seems to have resolved the issue. I did not even think about red hat upgrading, but it makes sense though.

Thanks for the assistance!

Kevin

Please Log in or Create an account to join the conversation.

More
27 Feb 2025 14:58 #10565 by ironfist
Glad it worked :)

Please Log in or Create an account to join the conversation.

Time to create page: 1.028 seconds