clbr / radeontop

GNU General Public License v3.0
789 stars 69 forks source link

Fix issue "Codepage broken in Russian version of radeontop" #73

Open wb027 opened 5 years ago

wb027 commented 5 years ago

https://raw.githubusercontent.com/wb027/radeontop/master/screenshots/radeontop_ru_utf-8_fixed.png Compiled & tested on Linux Mint 19 (ubuntu 18.04 based).

clbr commented 5 years ago

The setlocale call is made in radeontop.c, and the Makefile change would break the build on some systems, so I can't accept this change. What's your distro if the pkg-config call fails?

wb027 commented 5 years ago

Can you pass this correction to the maintainer ubuntu? I do not know how to do it correctly.

wb027 commented 5 years ago

"What's your distro if the pkg-config call fails?" Sorry, I did not understand this question. I'm not a programmer, I'm a simple user.

clbr commented 5 years ago

What happens if you run this:

pkg-config --libs ncursesw 2>/dev/null || pkg-config --libs ncurses 2>/dev/null ||echo "fell"
wb027 commented 5 years ago

-lncursesw -ltinfo

wb027 commented 5 years ago

I'm sorry, I forgot to say: libncursesw5-dev is required to success compile.

clbr commented 5 years ago

Your output means your Makefile change was not needed. Now that you installed the correct dev package, does radeontop work without any changes?

wb027 commented 5 years ago

Yes, it works! Now only in ui.c change needed: + setlocale(LC_ALL, "");

clbr commented 5 years ago

That already happens in radeontop.c. Please try to find out why, calling it twice should not be necessary.

wb027 commented 5 years ago

I do not know how to do that. But make no complains about twice setlocale(). Here is the full output of make: onotole@home:~/projects/radeontop$ make cc -Os -Wall -Wextra -pthread -Iinclude -ffunction-sections -fdata-sections -I/usr/include/libdrm -DENABLE_XCB=1 -D_GNU_SOURCE -D_DEFAULT_SOURCE -DENABLE_NLS=1 -s -c -o detect.o detect.c cc -Os -Wall -Wextra -pthread -Iinclude -ffunction-sections -fdata-sections -I/usr/include/libdrm -DENABLE_XCB=1 -D_GNU_SOURCE -D_DEFAULT_SOURCE -DENABLE_NLS=1 -s -c -o ticks.o ticks.c cc -Os -Wall -Wextra -pthread -Iinclude -ffunction-sections -fdata-sections -I/usr/include/libdrm -DENABLE_XCB=1 -D_GNU_SOURCE -D_DEFAULT_SOURCE -DENABLE_NLS=1 -s -c -o radeontop.o radeontop.c radeontop.c: In function ‘main’: radeontop.c:79:2: warning: ignoring return value of ‘seteuid’, declared with attribute warn_unused_result [-Wunused-result] seteuid(getuid()); ^~~~~~~~~~~~~~~~~ radeontop.c:151:2: warning: ignoring return value of ‘seteuid’, declared with attribute warn_unused_result [-Wunused-result] seteuid(0); ^~~~~~~~~~ radeontop.c:155:2: warning: ignoring return value of ‘setuid’, declared with attribute warn_unused_result [-Wunused-result] setuid(getuid()); ^~~~~~~~~~~~~~~~ cc -Os -Wall -Wextra -pthread -Iinclude -ffunction-sections -fdata-sections -I/usr/include/libdrm -DENABLE_XCB=1 -D_GNU_SOURCE -D_DEFAULT_SOURCE -DENABLE_NLS=1 -s -c -o ui.o ui.c ui.c: In function ‘printcenter’: ui.c:30:2: warning: ignoring return value of ‘vasprintf’, declared with attribute warn_unused_result [-Wunused-result] vasprintf(&ptr, fmt, ap); ^~~~~~~~~~~~~~~~~~~~~~~~ ui.c: In function ‘printright’: ui.c:53:2: warning: ignoring return value of ‘vasprintf’, declared with attribute warn_unused_result [-Wunused-result] vasprintf(&ptr, fmt, ap); ^~~~~~~~~~~~~~~~~~~~~~~~ cc -Os -Wall -Wextra -pthread -Iinclude -ffunction-sections -fdata-sections -I/usr/include/libdrm -DENABLE_XCB=1 -D_GNU_SOURCE -D_DEFAULT_SOURCE -DENABLE_NLS=1 -s -c -o auth.o auth.c cc -Os -Wall -Wextra -pthread -Iinclude -ffunction-sections -fdata-sections -I/usr/include/libdrm -DENABLE_XCB=1 -D_GNU_SOURCE -D_DEFAULT_SOURCE -DENABLE_NLS=1 -s -c -o dump.o dump.c cc -Os -Wall -Wextra -pthread -Iinclude -ffunction-sections -fdata-sections -I/usr/include/libdrm -DENABLE_XCB=1 -D_GNU_SOURCE -D_DEFAULT_SOURCE -DENABLE_NLS=1 -s -c -o family_str.o family_str.c cc -o radeontop detect.o ticks.o radeontop.o ui.o auth.o dump.o family_str.o -Os -Wall -Wextra -pthread -Iinclude -ffunction-sections -fdata-sections -I/usr/include/libdrm -DENABLE_XCB=1 -D_GNU_SOURCE -D_DEFAULT_SOURCE -DENABLE_NLS=1 -s -Wl,-O1 -Wl,-gc-sections -lpciaccess -ldrm -ldl -lncursesw -ltinfo cc -shared -fPIC -o libradeontop_xcb.so auth_xcb.c -Os -Wall -Wextra -pthread -Iinclude -ffunction-sections -fdata-sections -I/usr/include/libdrm -DENABLE_XCB=1 -D_GNU_SOURCE -D_DEFAULT_SOURCE -DENABLE_NLS=1 -s -Wl,-O1 -Wl,-gc-sections -lxcb -lxcb-dri2 sorry, the new lines were missing when pasted :(

wb027 commented 5 years ago

I tried to remove setlocale(LC_ALL, "") from radeontop.c and add to ui.c. It turned out all the same bullshit, but a different kind. I have a working version compiled only if in both files add setlocale (LC_ALL, "").