ipilcher / n5550

Thecus N5550 hardware support
GNU General Public License v2.0
8 stars 8 forks source link

Can't compile freecusd on OMV with kernel 5.15 #20

Closed marc0777 closed 2 years ago

marc0777 commented 2 years ago

While trying to get this set up on OpenMediaVault I encountered (another) error:

In file included from pic.c:17:
pic.c: In function ‘fcd_pic_selinux_log’:
freecusd.h:59:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
   59 | #define FCD_WARN(...)  fcd_err_msg(LOG_WARNING, "WARNING: " __FILE__ \
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   60 |      ":" FCD_STRINGIFY(__LINE__) ": " \
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   61 |      __VA_ARGS__)
      |      ~~~~~~~~~~~~
pic.c:59:4: note: in expansion of macro ‘FCD_WARN’
   59 |    FCD_WARN("Unknown libselinux message type: %d\n", type);
      |    ^~~~~~~~
pic.c:60:3: note: here
   60 |   case SELINUX_ERROR:
      |   ^~~~
/usr/bin/ld: /tmp/ccWD3Jvl.o: in function `fcd_err_child_pabort':
err.c:(.text+0x3f7): warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
/usr/bin/ld: err.c:(.text+0x3ee): warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
/usr/bin/ld: /tmp/cc79bQzj.o: in function `fcd_pic_setup_gpio':
pic.c:(.text+0x1b7): undefined reference to `is_selinux_enabled'
/usr/bin/ld: pic.c:(.text+0x1c9): undefined reference to `selinux_set_callback'
/usr/bin/ld: pic.c:(.text+0x1d7): undefined reference to `selinux_restorecon'
/usr/bin/ld: pic.c:(.text+0x203): undefined reference to `selinux_restorecon'
collect2: error: ld returned 1 exit status

Moreover, while building libcip I noticed that in this line instead of so_ver there should be version.

Let me know if you have any suggestion!

ipilcher commented 2 years ago
/usr/bin/ld: /tmp/ccWD3Jvl.o: in function `fcd_err_child_pabort':
err.c:(.text+0x3f7): warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
/usr/bin/ld: err.c:(.text+0x3ee): warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead

These messages are (unfortunately) expected. sys_errlist and sys_nerr are deprecated, but there is no replacement that can be used between fork() and exec() in a multi-threaded program.

/usr/bin/ld: err.c:(.text+0x3ee): warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
/usr/bin/ld: /tmp/cc79bQzj.o: in function `fcd_pic_setup_gpio':
pic.c:(.text+0x1b7): undefined reference to `is_selinux_enabled'
/usr/bin/ld: pic.c:(.text+0x1c9): undefined reference to `selinux_set_callback'
/usr/bin/ld: pic.c:(.text+0x1d7): undefined reference to `selinux_restorecon'
/usr/bin/ld: pic.c:(.text+0x203): undefined reference to `selinux_restorecon'
collect2: error: ld returned 1 exit status

That's an omission in the build command in the SPEC file. You need to add -lselinux to the build command.

In file included from pic.c:17:
pic.c: In function ‘fcd_pic_selinux_log’:
freecusd.h:59:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
   59 | #define FCD_WARN(...)  fcd_err_msg(LOG_WARNING, "WARNING: " __FILE__ \
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   60 |      ":" FCD_STRINGIFY(__LINE__) ": " \
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   61 |      __VA_ARGS__)
      |      ~~~~~~~~~~~~
pic.c:59:4: note: in expansion of macro ‘FCD_WARN’
   59 |    FCD_WARN("Unknown libselinux message type: %d\n", type);
      |    ^~~~~~~~
pic.c:60:3: note: here
   60 |   case SELINUX_ERROR:
      |   ^~~~

This won't cause any problems, as the fallthrough is intentional. I've added some comments to the file that should suppress those warnings. I've also fixed the freecusd build command in the SPEC file.

Hopefully that will get you going. Let me know.

SpaceBallz2k8 commented 2 years ago

I'm interested in getting this running on my N7510 7 bay nas. I have installed ubuntu 20.04.04 server, have my other apps etc installed and I upgraded the ram to 8GB. Everything works really well and much faster than the old ThecusOS. If only I could figure out how to compile these modules on Ubuntu so I can use the LCD.

Can you give me any pointers? I'm no genius, but I can manage simple compiling etc

Here's the output from my uname -a Linux thecusnas 5.4.0-109-generic #123-Ubuntu SMP Fri Apr 8 09:10:54 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

ipilcher commented 2 years ago

I'm interested in getting this running on my N7510 7 bay nas.

Let's track this in issue #21.

ipilcher commented 2 years ago

Is there any reason that this issue can't be closed? (I'm trying to clean up the issues in this repo.)

Thanks!

marc0777 commented 2 years ago

This can defenetely be closed!