MeanEYE / Disk-Indicator

Small program for Linux that will turn your Scroll, Caps or Num Lock LED into hard disk indicator.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ignored return value for `write` function causes errors during compilation.

evazzoler opened this issue · comments

I'm trying to compile on Ubuntu 16.04, depite I ran ./configure.sh, i get "Makefile:13: *** Missing dependencies file. To generate one, please run ./configure.sh."
./configure.sh creates a "build" directory in the project root directory (same level of Makefile).
Please provide the exact way to compile the code. Thanks.

Sunflower is written in Python, so code compilation is not required to run the program. We use makefile for building packages for distributions. Is there anything in particular you are trying to make?

I'm trying to use Disk-indicator on a Lenovo T460, where power led, ID #0 is well driven by the commandline. I read on the readme of Disk-Indicator that the usage is "./disk_indicator [-f] [-c config.file]".
Well, I can't find the disk_indicator executable but the Makefile, so I suppose it should be compiled. Right?
So

./configure.sh
make (or make all)

But I get the error you read on the first post of this issue.
I tried different combination but I can't figure out the way.

Oh, am sorry. I totally missed the fact you were talking about Disk-Indicator. Talk about confusing. So configure.sh is there to allow you to compile only things you need. That is, exclude X.org or some other provider if you don't plan on using it.

Since you plan using it on ThinkPad, I assume you want to use ThinkPad power button light or some other LED these laptops have. In such case you would run:

./configure.sh --thinkpad
make

After that you should have disk_indicator command in repository root. Let me know if this doesn't work for you.

Hi!
No, no, I tried since the first time to exclude everything but thinkpad, and the result is always the same.
"Makefile:13: *** Missing dependencies file. To generate one, please run ./configure.sh."
Obviously I installed the dependencies as the readme says. A "build" directory is created and contains:
-rw-r--r-- 1 root root 29 nov 30 19:44 dependencies.h
-rw-r--r-- 1 root root 0 nov 30 19:44 flags
-rw-r--r-- 1 root root 11 nov 30 19:44 objects

Okay. I will double check and get back to you once I get behind my computer. Sorry for the delayed answer.

No news, bad news? ;-)

My sincerest appologies, completely forgot about this issue. Work is kind of killing me these days. I have fixed the issue now and pushed. Please test and let me know so I can close the issue. Once again, sorry for the delay.

Hi! Thank you for the reply, don't worry for the delay, it's not your job!

Now I get complie error. Maybe I miss dependencies, but don't know why...
Here the errors (sorry, they are in italian language):

/opt/Disk-Indicator$ sudo make
c99 -Wall -Wextra -pedantic -Werror -D _DEFAULT_SOURCE -O2 -march=native -c src/thinkpad.c
src/thinkpad.c: In function ‘thinkpad_turn_on’:
src/thinkpad.c:84:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
  write(thinkpad_config->device, thinkpad_config->led, strlen(thinkpad_config->led));
  ^
src/thinkpad.c:85:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
  write(thinkpad_config->device, " on\n", 4);
  ^
src/thinkpad.c: In function ‘thinkpad_turn_off’:
src/thinkpad.c:97:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
  write(thinkpad_config->device, thinkpad_config->led, strlen(thinkpad_config->led));
  ^
src/thinkpad.c:98:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
  write(thinkpad_config->device, " off\n", 5);
  ^
cc1: all warnings being treated as errors
Makefile:18: set di istruzioni per l'obiettivo "thinkpad.o" non riuscito
make: *** [thinkpad.o] Errore 1

I'll double check on these. I am not getting any of them.

Forgot to post. But on my system I can't reproduce this issue. I am guessing it's due to me no using return value of write function. I would advise to open Makefile and remove -pedantic from flags. Let me know if this works.

Unfortunately it don't changed the result...

/opt/Disk-Indicator$ sudo make
c99 -Wall -Wextra -Werror -D _DEFAULT_SOURCE -O2 -march=native -c src/thinkpad.c
src/thinkpad.c: In function ‘thinkpad_turn_on’:
src/thinkpad.c:84:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
  write(thinkpad_config->device, thinkpad_config->led, strlen(thinkpad_config->led));
  ^
src/thinkpad.c:85:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
  write(thinkpad_config->device, " on\n", 4);
  ^
src/thinkpad.c: In function ‘thinkpad_turn_off’:
src/thinkpad.c:97:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
  write(thinkpad_config->device, thinkpad_config->led, strlen(thinkpad_config->led));
  ^
src/thinkpad.c:98:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
  write(thinkpad_config->device, " off\n", 5);
  ^
cc1: all warnings being treated as errors
Makefile:18: set di istruzioni per l'obiettivo "thinkpad.o" non riuscito
make: *** [thinkpad.o] Errore 1

Ah, my bad, -Werror is probably the one causing this issue. I think it will work without it. However I will fix this and push changes.