Skip to content

Conversation

@psumbera
Copy link

No description provided.

Copy link
Member

@michalvasko michalvasko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes need to be discussed more but also change the base branch to devel, we do not accept PRs into master. But we plan to make a new release soon when devel will be merged into master so it should not matter to you.

else()
# global C flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic -std=c11")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but the C standard needs to be specified because various compilers use different default standards. And before deciding the exact solution I would like to know the details of the issue. Is the compiler too old on Solaris that does not support this C revision?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, declarations for vasprintf and strndup are missing:

/scratch/psumbera/libyang/src/ly_common.c:704:11: error: implicit declaration of function 'vasprintf'; did you mean 'vsprintf'? [-Wimplicit-function-declaration]
  704 |     len = vasprintf(&addition, format, fp);
      |           ^~~~~~~~~
      |           vsprintf
/scratch/psumbera/libyang/src/ly_common.c: In function 'ly_parse_int':
/scratch/psumbera/libyang/src/ly_common.c:733:11: error: implicit declaration of function 'strndup'; did you mean 'strncmp'? [-Wimplicit-function-declaration]
  733 |     str = strndup(val_str, val_len);
      |           ^~~~~~~
      |           strncmp
/scratch/psumbera/libyang/src/ly_common.c:733:9: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  733 |     str = strndup(val_str, val_len);
      |         ^
/scratch/psumbera/libyang/src/ly_common.c: In function 'ly_parse_uint':
/scratch/psumbera/libyang/src/ly_common.c:773:9: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  773 |     str = strndup(val_str, val_len);
      |         ^

Note that you can play with Solaris via https://github.com/vmactions/shell-solaris .

Copy link
Member

@michalvasko michalvasko Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like there are some macro definitions missing, you can learn about those in the man pages. The VM seems nice but to have a lasting effect we would need to add it into our automatic actions, which does not seem possible.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for macros. This is also possibiltiy:

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -77,6 +77,9 @@ if(WIN32)
 else()
     # global C flags
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic -std=c11")
+    if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__EXTENSIONS__")
+    endif()
 endif()
 
 include_directories(${PROJECT_BINARY_DIR}/libyang ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/src/plugins_exts)

As for Solaris CI. It's possible: https://github.com/rust-lang/libc/blob/d58c1f4f9ae01648b342d7dead291d08655677c4/.github/workflows/ci.yaml#L278

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine although the macro looks very non-standard. Better adding macros than changing the C standard. As for the CI, I may take a look at it later and add an action for Solaris in our CI.

Comment on lines +2373 to +2377
#ifdef __sun__
if (1) {
#else
if ((file->d_type == DT_UNKNOWN) || (file->d_type == DT_LNK)) {
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain because just looking at this I do not understand.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d_type is not part of struct dirent on Solaris.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, then it should ideally be properly detected in by cmake and then handled here. I can add that and it may be faster, if you want.

psumbera added a commit to psumbera/frr that referenced this pull request Nov 25, 2025
Builds on Solaris 11.4 with libyan (CESNET/libyang#2453):

  ./bootstrap.sh
  MAKE=gmake ./configure --disable-protobuf
  gmake
  gmake check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants