Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Arch 5.12 Not compiling: #9

Open
Khyretos opened this issue May 30, 2021 · 10 comments
Open

Arch 5.12 Not compiling: #9

Khyretos opened this issue May 30, 2021 · 10 comments

Comments

@Khyretos
Copy link

here is the log:

[kireita@SOUCOUYANT lg4k-linux-fedora]$ ./build.sh 
make: Entering directory '/home/kireita/Downloads/lg4k-linux-fedora/driver'
make -C /lib/modules/5.12.8-arch1-1/build M=/home/kireita/Downloads/lg4k-linux-fedora/driver/ clean
make[1]: Entering directory '/usr/lib/modules/5.12.8-arch1-1/build'
make[1]: Leaving directory '/usr/lib/modules/5.12.8-arch1-1/build'
make: Leaving directory '/home/kireita/Downloads/lg4k-linux-fedora/driver'
make: Entering directory '/home/kireita/Downloads/lg4k-linux-fedora/driver'
cp ../AverMediaLib_64.a AverMediaLib_64.o
make -C /lib/modules/5.12.8-arch1-1/build M=/home/kireita/Downloads/lg4k-linux-fedora/driver/ modules
make[1]: Entering directory '/usr/lib/modules/5.12.8-arch1-1/build'
  CC [M]  /home/kireita/Downloads/lg4k-linux-fedora/driver//entry.o
  CC [M]  /home/kireita/Downloads/lg4k-linux-fedora/driver//cxt_mgr.o
  CC [M]  /home/kireita/Downloads/lg4k-linux-fedora/driver//utils/alsa/alsa_model.o
/home/kireita/Downloads/lg4k-linux-fedora/driver//utils/alsa/alsa_model.c: In function ‘alsa_model_init’:
/home/kireita/Downloads/lg4k-linux-fedora/driver//utils/alsa/alsa_model.c:622:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
  622 |                 snd_card_free(card);
      |                 ^~~~~~~~~~~~~~~~~~~
/home/kireita/Downloads/lg4k-linux-fedora/driver//utils/alsa/alsa_model.c:623:13: note: here
  623 |             case ALSA_MODEL_CREATE_SND_CARD_ERROR:
      |             ^~~~
  CC [M]  /home/kireita/Downloads/lg4k-linux-fedora/driver//utils/gpio/gpio_model.o
  CC [M]  /home/kireita/Downloads/lg4k-linux-fedora/driver//utils/i2c/i2c_model.o
/home/kireita/Downloads/lg4k-linux-fedora/driver//utils/i2c/i2c_model.c: In function ‘i2c_model_bus_i2c_xfer’:
/home/kireita/Downloads/lg4k-linux-fedora/driver//utils/i2c/i2c_model.c:107:5: warning: ISO C90 forbids variable length array ‘i2c_model_msg’ [-Wvla]
  107 |     i2c_model_msg_t i2c_model_msg[num];
      |     ^~~~~~~~~~~~~~~
/home/kireita/Downloads/lg4k-linux-fedora/driver//utils/i2c/i2c_model.c: In function ‘i2c_model_transfer’:
/home/kireita/Downloads/lg4k-linux-fedora/driver//utils/i2c/i2c_model.c:150:12: warning: ISO C90 forbids variable length array ‘msgs’ [-Wvla]
  150 |     struct i2c_msg msgs[num];
      |            ^~~~~~~
  CC [M]  /home/kireita/Downloads/lg4k-linux-fedora/driver//utils/mem/mem_model.o
In file included from /home/kireita/Downloads/lg4k-linux-fedora/driver/include/ite6805.h:10,
                 from /home/kireita/Downloads/lg4k-linux-fedora/driver/include/aver_xilinx.h:21,
                 from /home/kireita/Downloads/lg4k-linux-fedora/driver//utils/mem/mem_model.c:22:
/home/kireita/Downloads/lg4k-linux-fedora/driver/utils/thread/include/task_model.h:27:20: error: conflicting types for ‘task_work_func_t’; have ‘void (*)(void *)’
   27 |     typedef void (*task_work_func_t)(void *data);
      |                    ^~~~~~~~~~~~~~~~
In file included from ./include/linux/posix-timers.h:9,
                 from ./include/linux/sched.h:34,
                 from ./include/linux/ratelimit.h:6,
                 from ./include/linux/dev_printk.h:16,
                 from ./include/linux/device.h:15,
                 from /home/kireita/Downloads/lg4k-linux-fedora/driver//utils/mem/mem_model.c:14:
./include/linux/task_work.h:8:16: note: previous declaration of ‘task_work_func_t’ with type ‘task_work_func_t’ {aka ‘void (*)(struct callback_head *)’}
    8 | typedef void (*task_work_func_t)(struct callback_head *);
      |                ^~~~~~~~~~~~~~~~
In file included from /home/kireita/Downloads/lg4k-linux-fedora/driver/include/it6664_extern.h:16,
                 from /home/kireita/Downloads/lg4k-linux-fedora/driver/include/ite6664.h:8,
                 from /home/kireita/Downloads/lg4k-linux-fedora/driver/include/ite6805.h:11,
                 from /home/kireita/Downloads/lg4k-linux-fedora/driver/include/aver_xilinx.h:21,
                 from /home/kireita/Downloads/lg4k-linux-fedora/driver//utils/mem/mem_model.c:22:
/home/kireita/Downloads/lg4k-linux-fedora/driver/include/it6664_IO.h:29:6: warning: "USING_1to8" is not defined, evaluates to 0 [-Wundef]
   29 | #if (USING_1to8==TRUE)
      |      ^~~~~~~~~~
make[2]: *** [scripts/Makefile.build:271: /home/kireita/Downloads/lg4k-linux-fedora/driver//utils/mem/mem_model.o] Error 1
make[1]: *** [Makefile:1851: /home/kireita/Downloads/lg4k-linux-fedora/driver/] Error 2
make[1]: Leaving directory '/usr/lib/modules/5.12.8-arch1-1/build'
make: *** [Makefile:60: build] Error 2
make: Leaving directory '/home/kireita/Downloads/lg4k-linux-fedora/driver'
cp: cannot stat 'driver/cx511h.ko': No such file or directory

@neurodiverseEsoteric
Copy link

Same Issue on kernel 5.14 on Manjaro

@Renari
Copy link

Renari commented Jul 31, 2022

This log isn't very useful since the compiler output is being hidden.

@kkiyama117
Copy link

I got a similar message on 5.19.1-3-MANJARO.
I think one of the reasons is that get_fs function is deprecated since Linux 5.10, (and I found error: implicit declaration of function ‘get_fs’; did you mean ‘sget_fc’? [-Werror=implicit-function-declaration] actually). We need to change get_fs and set_fs to kernel_read as Xilinx/dma_ip_drivers#142 did.
After I replace them, I got storage size of timespec isn't known error. I found a case with the same error message, but I don't know if this solution is the right one.
https://stackoverflow.com/questions/42597685/storage-size-of-timespec-isnt-known
https://stackoverflow.com/questions/3875197/gcc-with-std-c99-complains-about-not-knowing-struct-timespec

@kkiyama117
Copy link

kkiyama117 commented Aug 27, 2022

And I got

implicit declaration of function ‘ktime_get_ts’; did you mean ‘ktime_get_ns’? [�]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration�-Werror=implicit-function-declaration�]8;;�]

error.
Replacing it with ktime_get(or ktime_get_64) will solve the problem.
https://www.virtualbox.org/ticket/19312
https://www.kernel.org/doc/html/latest/core-api/timekeeping.html#deprecated-time-interfaces

We should replace timespec to timespec64 also (https://lore.kernel.org/lkml/20191213205417.3871055-5-arnd@arndb.de/).

@kkiyama117
Copy link

kkiyama117 commented Aug 28, 2022

Finally I got error same as #11, I'll leave the code that fixes the above problem so you can check it out. Please fix or give me some hints about #11 if you could.

https://github.com/kkiyama117/lg4k-linux/tree/arch

@kkiyama117
Copy link

LOL, but I missed this one #4 . Almost all solutions I wrote above is already founded. However, it is good to confirm that this method probably works on Arch or Manjaro.

@kkiyama117
Copy link

After I remove vfs_stat to avoid this error, ./build.sh return 0.

@dextroza
Copy link

I got a similar message on 5.19.1-3-MANJARO. I think one of the reasons is that get_fs function is deprecated since Linux 5.10, (and I found error: implicit declaration of function ‘get_fs’; did you mean ‘sget_fc’? [-Werror=implicit-function-declaration] actually). We need to change get_fs and set_fs to kernel_read as Xilinx/dma_ip_drivers#142 did. After I replace them, I got storage size of timespec isn't known error. I found a case with the same error message, but I don't know if this solution is the right one. https://stackoverflow.com/questions/42597685/storage-size-of-timespec-isnt-known https://stackoverflow.com/questions/3875197/gcc-with-std-c99-complains-about-not-knowing-struct-timespec

Hi,

I tried to replace get_fs() and set_fs() with kernel_read() and kernel_write(), but I got these 3 errors:

/home/dvukadin/work/lg4k-linux/driver/utils/misc/sys.c: In function ‘sys_fread’:
/home/dvukadin/work/lg4k-linux/driver/utils/misc/sys.c:379:9: error: too few arguments to function ‘kernel_read’
  379 |     fs =kernel_read();

/home/dvukadin/work/lg4k-linux/driver/utils/misc/sys.c:380:18: error: ‘KERNEL_DS’ undeclared (first use in this function); did you mean ‘KERNFS_NS’?
  380 |     kernel_write(KERNEL_DS);


/home/dvukadin/work/lg4k-linux/driver/utils/misc/sys.c:380:5: error: too few arguments to function ‘kernel_write’
  380 |     kernel_write(KERNEL_DS);

Could you help me with this, please? Thanks a lot.

@Renari
Copy link

Renari commented Dec 15, 2023

ssize_t __kernel_read(struct file *file, void *buf, size_t count, loff_t *pos);

This is not a drop in replacement the method signatures are not similar.

It looks like you would call kernel_read here:

vfs_read(fp, buf, count, &pos);

But I'm not sure what the implications of changing this line are, it's clear that other parts of the code would need to be udpated.

@kkiyama117
Copy link

kkiyama117 commented Dec 18, 2023

@dextroza @Renari
I don't remember clearly why I used kernel_read because this was my first device driver update, and I haven't touched it for a while, but I saw the same error message on Reddit and someone told me to change 'get_fs' to that somewhere. But after making the change and running it for a while, it eventually stopped working after 5 or 10 min. There might be a more appropriate way. I don't usually touch anything close to the kernel, but anyone familiar with it should be able to find the proper method and its arguments by looking for the merge commit in question in the 5.10 onwards update history.
Besides, Linux 6.7 is the latest one, so additional things may be fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants