#71667 closed defect (fixed)

vtk @9.4.1: error: implicit declaration of function 'getentropy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: Dave-Allured (Dave Allured)
Priority: Normal Milestone:
Component: ports Version: 2.10.5
Keywords: haspatch Cc:
Port: vtk

Description

https://build.macports.org/builders/ports-11_x86_64-builder/builds/174902/steps/install-port/logs/stdio

ThirdParty/libxml2/vtklibxml2/dict.c:970:17: error: implicit declaration of function 'getentropy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            if (getentropy(globalRngState, sizeof(globalRngState)) == 0)
                ^
1 error generated.

This appears to be happening when building a bundled copy of libxml2.

Here is the vtk bug report:

https://gitlab.kitware.com/vtk/vtk/-/issues/19530

And the libxml2 bug report:

https://gitlab.gnome.org/GNOME/libxml2/-/issues/820

I'll apply the fix to the libxml2 port. Maybe vtk can then use MacPorts libxml2 to avoid the need to build its own?

Change History (8)

comment:1 in reply to:  description Changed 14 months ago by ryandesign (Ryan Carsten Schmidt)

Port: libxml2 removed

Replying to ryandesign:

I'll apply the fix to the libxml2 port.

The problem doesn't apply to the libxml2 port because that uses the autotools build system whereas the problem is in the CMake build system.

comment:2 Changed 14 months ago by ryandesign (Ryan Carsten Schmidt)

In fact the vtk port already has a patchfile (patch-libxml2-getentropy.diff) that looks related to this problem but it is only applied on Mac OS X 10.6 and earlier. I would guess that patch can be removed once the real fix is applied.

comment:3 Changed 14 months ago by Dave-Allured (Dave Allured)

@barracuda156 was working on this getentropy problem, but did not get it to work for OS 10 and 11. See previous discussion in PR 26834. Perhaps improving the conditional for the OS version would work.

I am working on shifting away from VTK bundled libraries, toward MacPorts versions. Their build system is complicated and has stymied me so far.

comment:4 in reply to:  3 Changed 14 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to Dave-Allured:

Perhaps improving the conditional for the OS version would work.

According to the upstream bugs https://gitlab.gnome.org/GNOME/libxml2/-/commit/2617138d924e19211b530373162d93b8edc54eb8 should fix it. I have not tried it.

I am working on shifting away from VTK bundled libraries, toward MacPorts versions. Their build system is complicated and has stymied me so far.

I did not see a way to use MacPorts libxml2 instead of the bundled copy.

comment:5 Changed 14 months ago by Dave-Allured (Dave Allured)

Documentation of VTK build controls is sparse and inconsistent. I think I found the correct control to use "external" MacPorts libxml2, instead of the bundled copy. Let's see if this PR is any good. I am now waiting for legacy build machines to test this.

@barracuda156 I removed your libxml2 patch for the second time. I think it is no longer relevant because we are now avoiding the down-level, bundled copy of libxml2.

comment:6 in reply to:  5 ; Changed 14 months ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added

Replying to Dave-Allured:

Documentation of VTK build controls is sparse and inconsistent.

Now that I know what option you used, I searched for it and found this commit where FreeBSD also used it:

https://lists.freebsd.org/archives/dev-commits-ports-all/2021-November/006873.html

And from there I found this documentation:

https://gitlab.kitware.com/vtk/vtk/-/blob/master/Documentation/docs/build_instructions/build_settings.md

comment:7 in reply to:  6 Changed 14 months ago by Dave-Allured (Dave Allured)

And from there I found this documentation:

https://gitlab.kitware.com/vtk/vtk/-/blob/master/Documentation/docs/build_instructions/build_settings.md

Unfortunately there is a critical mistake in their listed setting for using external modules. I didn't figure it out until, like you, I web searched for someone else's working solution.

WRONG: VTK_MODULE_USE_EXTERNAL_<name>

CORRECT: VTK_MODULE_USE_EXTERNAL_VTK_<name>

I really should ask them about that some time.

comment:8 Changed 14 months ago by Dave-Allured (Dave Allured)

Resolution: fixed
Status: assignedclosed

In b2d8d6c187a6e91cf95110d20da583958cdc67d6/macports-ports (master):

vtk: use MacPorts libxml2 port

Closes: #71667

Note: See TracTickets for help on using tickets.