libyang icon indicating copy to clipboard operation
libyang copied to clipboard

build on freebsd 13.1 fails because of missing definition for variable 'daylight'

Open opsec opened this issue 2 years ago • 1 comments

libyang-2.0.194/src/plugins_types/date_and_time.c:125:13: error: use of undeclared identifier 'daylight'
        if (daylight) {
            ^
2 warnings and 1 error generated.

fix:

--- CMakeModules/UseCompat.cmake.orig   2022-05-26 18:50:41.811402000 +0200
+++ CMakeModules/UseCompat.cmake        2022-05-26 18:50:55.845563000 +0200
@@ -49,7 +49,7 @@
 
     include(CheckStructHasMember)
     check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
-    check_symbol_exists(timezone time.h HAVE_TIME_H_TIMEZONE)
+#    check_symbol_exists(timezone time.h HAVE_TIME_H_TIMEZONE)
 
     check_symbol_exists(realpath "stdlib.h" HAVE_REALPATH)
     check_symbol_exists(localtime_r "time.h" HAVE_LOCALTIME_R)

opsec avatar May 26 '22 18:05 opsec

I have replied by email since that is how you asked originally. So, you can try to provide a patch to fix this properly but if you are fine with not having support for the unknown timezone -00:00 I could just adjust the change you posted so that the unavailability of daylight is properly detected.

michalvasko avatar May 27 '22 05:05 michalvasko

I did some portability improvements and got rid of all problematic global vars (daylight, timezone) so it should work correctly now. Tested on virtual FreeBSD 13.1 and it compiled, all the tests passed.

michalvasko avatar Feb 10 '23 11:02 michalvasko