tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: LOCALBASE searched before macOS framework with CMake on Darwin



If graphics/MesaLib is *not* installed:

    % ~/pkg/sbin/pkg_info | grep MesaLib

I understand that Cmake finds the OpenGL framework provided by macOS:

    % grep "OPENGL_gl_LIBRARY:" work/openttd-14.0/cmake-pkgsrc-build/CMakeCache.txt
OPENGL_gl_LIBRARY:FILEPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/OpenGL.framework

But if graphics/MesaLib is installed (but its buildlink3.mk is not the Makefile):

    % ~/pkg/sbin/pkg_info | grep MesaLib
    MesaLib-21.3.9nb4   Open source OpenGL implementation

Now Cmake finds the OpenGL implementation provided by pkgsrc:

    % grep "OPENGL_gl_LIBRARY:" work/openttd-14.0/cmake-pkgsrc-build/CMakeCache.txt
    OPENGL_gl_LIBRARY:FILEPATH=/Users/triaxx/pkg/lib/libGL.dylib

And the build step fails with the following error message:

    ld: library 'GL' not found
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

What is the right way to avoid CMake finding OpenGL path in LOCALBASE first?

MesaLib should not be installed on macOS at all. Just add something like:

.if ${OPSYS} != "Darwin"
.include "../../graphics/MesaLib/buildlink3.mk"
.endif

Kind regards,
Adam

Actually, games/openttd has:

.if ${OPSYS} != "Darwin"
.include "../../devel/SDL2/buildlink3.mk"
.endif

and SDL deals with OpenGL for other Unix-like.

The problem here is that success or failure of the build process of games/openttd on Darwin depends on the installation of graphics/MesaLib while games/openttd doesn't include graphics/MesaLib/buildlink3.mk.

I think there is a problem with the CMake logic which should not look at LOCALBASE build in BUILDLINK_DIR to find dependency but (i) I am not sure and (ii) I have no idea how it could be fixed.

If graphics/MesaLib should not be installed on macOS, maybe could we add NOT_FOR_PLATFORM= Darwin in graphics/MesaLib/Makefile. But I see Darwin dedicated test for install step in this file...

Home | Main Index | Thread Index | Old Index