Skip to content

runtime-extra-platforms build break in Android in pal_uid.c due to getgrgid_r #69419

@carlossanlop

Description

@carlossanlop

I merged this PR today which adds a new native call to the gegrgid_r method. Apparently this broke the Android build.

I discovered this build failure in my draft PR in which I ran /azp run runtime-extra-platforms. Here are the CI results.

The build error is:

/home/carlos/runtime/src/native/libs/System.Native/pal_uid.c(253,13): error G39D4492F: implicit declaration of function 'getgrgid_r' is invalid in C99 [-Werror,-Wimplicit-function-declaration] [/home/carlos/runtime/src/native/libs/build-native.proj]
/home/carlos/runtime/src/native/libs/System.Native/pal_uid.c(253,13): error G39D4492F: implicit declaration of function 'getgrgid_r' is invalid in C99 [-Werror,-Wimplicit-function-declaration] [/home/carlos/runtime/src/native/libs/build-native.proj]
/home/carlos/runtime/src/native/libs/build-native.proj(40,5): error MSB3073: The command ""/home/carlos/runtime/src/native/libs/build-native.sh" x64 Debug outconfig net7.0-Android-Debug-x64 -os Android " exited with code 2.

The method is invoked here:

if (getgrgid_r(gid, &gr, buffer, bufferLength, &result) == 0)

According to its man page, the two required includes are sys/types.h and grp.h, which are already included at the top of that same file.

I was able to repro locally. I'll work on a fix tomorrow morning.

cc @mkhamoyan @steveisok

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions