Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppleFramework modules should be case-sensitive to support case-sensitive partitions #12480

Open
aminehaddad opened this issue Nov 6, 2023 · 1 comment

Comments

@aminehaddad
Copy link

aminehaddad commented Nov 6, 2023

Describe the bug
When using AppleFrameworks, the modules should be set to case-sensitive to support both case-sensitive and case-insensitive partitions. Confirmation is requested by p11-kit before they fix an issue.

The case-sensitive warning should be put in the AppleFrameworks (instead of bottom of the page). Also, the following example should be fixed:

dep = dependency('appleframeworks', modules : 'foundation')

to

dep = dependency('appleframeworks', modules : 'Foundation')

Note: this is for all Darwin/iOS modules, including the ones located in /System/Library/Frameworks.

To Reproduce
On a partition that is case-sensitive (e.g. APFS case-sensitive), you can reproduce with files check_appleframeworks.c and meson.build:

#include <stdio.h>

int main() {
    printf("Apple Frameworks Test\n");
    return 0;
}
project('check_appleframeworks', 'c')
src = 'check_appleframeworks.c'
appleframeworks = dependency('appleframeworks', modules: 'foundation')

if appleframeworks.found()
  message('appleframeworks with "foundation" module found')
else
  message('appleframeworks with "foundation" module not found')
endif

executable('check_appleframeworks', src, dependencies: appleframeworks)

Output:

username appleframeworks_test % meson build
The Meson build system
Version: 1.2.3
Source dir: /Users/username/Development/appleframeworks_test
Build dir: /Users/username/Development/appleframeworks_test/build
Build type: native build
Project name: check_appleframeworks
Project version: undefined
C compiler for the host machine: cc (clang 12.0.0 "Apple clang version 12.0.0 (clang-1200.0.32.29)")
C linker for the host machine: cc ld64 609.8
Host machine cpu family: x86_64
Host machine cpu: x86_64
Run-time dependency appleframeworks found: NO (tried framework)

meson.build:7:18: ERROR: Dependency "appleframeworks" not found, tried framework

Expected behavior
Warn the user to use case-sensitive name of the AppleFrameworks modules. Here's the output of a fix where module 'foundation' is set to 'Foundation':

project('check_appleframeworks', 'c')
src = 'check_appleframeworks.c'
appleframeworks = dependency('appleframeworks', modules: 'Foundation')

if appleframeworks.found()
  message('appleframeworks with "foundation" module found')
else
  message('appleframeworks with "foundation" module not found')
endif

executable('check_appleframeworks', src, dependencies: appleframeworks)
......
C compiler for the host machine: cc (clang 12.0.0 "Apple clang version 12.0.0 (clang-1200.0.32.29)")
C linker for the host machine: cc ld64 609.8
Host machine cpu family: x86_64
Host machine cpu: x86_64
Run-time dependency appleframeworks found: YES (Foundation)
Message: appleframeworks with "foundation" module found
Build targets in project: 1

Found ninja-1.11.1 at /usr/local/bin/ninja
......

system parameters

  • Test for MacOS case-sensitive and case-insensitive partitions
  • meson 1.2.3
  • ninja 1.11.1
@aminehaddad
Copy link
Author

I used your _get_framework_path() function to test it, and it seems to work fine. I'm no longer sure where this issue is coming from.

framework-finder.py:

#!/usr/bin/env python3

from pathlib import Path
from typing import Optional
import sys

class FrameworkFinder:
    def _get_framework_path(self, path: str, name: str) -> Optional[Path]:
        p = Path(path)
        lname = name.lower()
        for d in p.glob('*.framework/'):
            if lname == d.name.rsplit('.', 1)[0].lower():
                return d
        return None

if __name__ == '__main__':
    finder = FrameworkFinder()
    if len(sys.argv) > 1:
        name = sys.argv[1]
    else:
        name = 'Foundation'

    path = '/System/Library/Frameworks'
    result = finder._get_framework_path(path, name)

    if result:
        print(f"Framework path found: {result}")
    else:
        print(f"Framework path not found for '{name}' in '{path}'")
username framework-finder % ./framework-finder.py Foundation
Framework path found: /System/Library/Frameworks/Foundation.framework

username framework-finder % ./framework-finder.py foundation                                                                                                                    
Framework path found: /System/Library/Frameworks/Foundation.framework

username framework-finder % ./framework-finder.py foundatiofdn                                                                                                                 
Framework path not found for 'foundatiofdn' in '/System/Library/Frameworks'

I'll try to check p11-kit issue some more.

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

No branches or pull requests

1 participant