ghaerr / microwindows

The Nano-X Window System
Other
648 stars 92 forks source link

Linker Error with GCC 11 #79

Closed UsNizami closed 10 months ago

UsNizami commented 10 months ago

I am using it for first time and I am following the instruction given in src/README I have run cp Configs/config.linux-X11 config and then make but it give me this error . And I have not made any changes to code.

Screenshot from 2023-09-26 15-41-26

gcc version = 11.3.0 GNU Make = 4.3

Please help me fix this issue.

ghaerr commented 10 months ago

Hello @UsNizami,

This error is a result of both nxres and nyres being declared as MWCOORD nxres; MWCOORD nyres; in nanox/srvmain.c as well as drivers/scr_x11.c. The C compiler should allow both but seems not to in version 11.

I would suggest for the time being changing the drivers/scr_x11.c source to extern declarations as follows:

/* externally set override values from nanox/srvmain.c*/
extern MWCOORD nxres;          /* requested server x res*/
extern MWCOORD nyres;          /* requested server y res*/

Try that and lets see what happens. If this or similar errors continue, we will need to use the gcc -fcommon option using EXTRAFLAGS=-fcommon in the config file to allow common declarations. This is discussed in more detail in https://stackoverflow.com/questions/69908418/multiple-definition-of-first-defined-here-on-gcc-10-2-1-but-not-gcc-8-3-0.

Thank you!

UsNizami commented 10 months ago

Thanks for your help @ghaerr .Now after making those changes I am getting this strange error image

shap.h file is prasent as you can see in the screenshot. Still it is saing no "such file". Is there some issue in makefile where its include path is specified?

UsNizami commented 10 months ago

I have fixxed that issue by corecting the path in Shape.c and Xinerama.c files. But now I am getting huge linker error "multiple definition of ..."

Screenshot from 2023-09-27 14-38-55

What is a way to fix this issue ?

ghaerr commented 10 months ago

But now I am getting huge linker error "multiple definition of ..."

It looks like this is the same error as the original problem, which is fixed using -fcommon. It now seems to be failing on compiling TinyWidgets, which is a 3rd party library. This library is rarely needed, so you can likely fix this problem by setting TINYWIDGETS=N in the config file.

The TinyWidgets library is the last library to be compiled and actually isn't required: this means that everything else is completed and can be tested, even without the suggested fix.

UsNizami commented 10 months ago

I worked by downgrading to gcc 10 and TINYWIDGETS=N. Thanks for your help.