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

Building for MacOS should encourage setting an SDK version #120

Open
tresf opened this issue Aug 7, 2021 · 5 comments
Open

Building for MacOS should encourage setting an SDK version #120

tresf opened this issue Aug 7, 2021 · 5 comments
Assignees
Milestone

Comments

@tresf
Copy link
Contributor

tresf commented Aug 7, 2021

HID4Java should be built using an older SDK, such as 10.9.

MacOS x86_64

MacOS aarch64

Configuring the environment must be done in two steps:

  • Specifying the full path to the SDK
    # e.g.
    export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.9.sdk 
  • Specifying the target OS
    # e.g.
    export MACOSX_DEPLOYMENT_TARGET=10.9
  • To confirm, you can check the outputted file using otool -l
    # e.g.
    otool -l src/main/resources/darwin-x86-64/libhidapi.dylib
    # or (filter relevant portion for 10.9 or 11.0 binaries)
    otool -l src/main/resources/darwin-x86-64/libhidapi.dylib |grep -E 'LC_VERSION_MIN_MACOSX|LC_BUILD_VERSION' -A4
tresf added a commit to tresf/hid4java that referenced this issue Aug 11, 2021
@gary-rowe gary-rowe self-assigned this Dec 5, 2022
gary-rowe added a commit that referenced this issue Dec 5, 2022
* #93 Create placeholder for hidapi win32-aarch64

* #93 Add POM version for local JNA issue 93 support

* #93 Add POM version for JNA 5.7.0-SNAPSHOT

* #93 Add local library reference for faster JNA turnaround

* #93 Re-instate missing DLL and reference JNA-5.7.0-SNAPSHOT

* Fix buld-hidapi.sh
Closes #114
Make colors easier to read in the shell script

* Add win32-aarch64 to dockcross

* Fix JNA dependency

* Fix unit test
Wait 30s for testing as logs indicate

* Add darwin-aarch64 to dockcross

* Bump JNA to 5.8.0

* Switch darwin to new jna suffix
Also adds some sanitization to the build-hidapi.sh

* Quality of life improvements :)

* Fix missing dollar sign

* Remove problematic calls to "make clean"
Closes #122

* Add hints for SDKROOT, MACOSX_DEPLOYMENT_TARGET
Closes #120

Co-authored-by: Gary Rowe <[email protected]>
@gary-rowe
Copy link
Owner

Is this still an issue?

@gary-rowe gary-rowe added the awaiting merge This issue has been reviewed and is ready to merge into a release candidate label Mar 29, 2024
@tresf
Copy link
Contributor Author

tresf commented Mar 29, 2024

Is this still an issue?

It was merged here

... However, I believe it's missing on the develop branch.

@gary-rowe gary-rowe added this to the Release 0.8.0 milestone Apr 3, 2024
@gary-rowe gary-rowe removed the awaiting merge This issue has been reviewed and is ready to merge into a release candidate label Apr 14, 2024
@tresf
Copy link
Contributor Author

tresf commented Apr 15, 2024

@gary-rowe which branch is this on? Or did you decide not to add it?

Here's an example of how this was done on another branch, but the code was never merged:

hid4java/build-hidapi.sh

Lines 330 to 334 in e40bdfe

if [ -z "$SDKROOT" ] || [ -z "$MACOSX_DEPLOYMENT_TARGET" ];
then
echo -e "${yellow}WARNING: For production builds, please set \$SDKROOT and \$MACOSX_DEPLOYMENT_TARGET before building${plain}"
echo -e "${yellow} See also https://github.com/gary-rowe/hid4java/issues/120${plain}"
fi

@gary-rowe
Copy link
Owner

gary-rowe commented Apr 16, 2024

Hi @tresf . Looks like it was missed with all the other changes to the build-hidapi.sh script. I've just pushed some changes to develop which should address the minimum targets on macOS. I've tested the new .dylibs on a couple of macOS machines and they seem OK but if you'd like to check them over I'd appreciate it.

@gary-rowe gary-rowe reopened this Apr 16, 2024
@tresf
Copy link
Contributor Author

tresf commented Apr 16, 2024

@gary-rowe thanks for the attention to detail however I think there may be some overkill items, such as restarting zsh with another architecture.

echo -e "${yellow} Re-run with 'arch -arm64 zsh ./build-hidapi.sh darwin-aarch64'${plain}"

... in my experience, this was just fine by passing the arch flag to the build system.

make CFLAGS="-arch x86_64"

I think this approach is cleaner and less confusing.

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

2 participants