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

Invalid check for availability of futimens function for macOS platform #5856

Open
lolgear opened this issue May 5, 2021 · 6 comments
Open

Comments

@lolgear
Copy link
Contributor

lolgear commented May 5, 2021

Reproduction steps

Open src/unix/posix.h

Expected behavior

Everything works fine.

Actual behavior

Xcode warning: futimens is only available for macOS 10.13 or newer.
I build it for a project with minimum deployment target 10.10.

Version of libgit2 (release number or SHA1)

Latest master.

Operating system(s) tested

macOS 10.16
Xcode 12.5

@ethomson
Copy link
Member

ethomson commented May 5, 2021

What version of cmake? It claims to honor the deployment target version for futimens

@lolgear
Copy link
Contributor Author

lolgear commented May 5, 2021

I use Cmake 3.20.2 (Installed from Homebrew)
I run

#!/bin/sh

export MACOSX_DEPLOYMENT_TARGET=10.10

rm -rf "xcode"
mkdir "xcode"
cd "xcode"
cmake -G "Xcode" ..
open "libgit2.xcodeproj"

Open Xcode 12.5 and build git2 target.
Xcode complains about futimens.
Maybe project settings are wrong in Xcode.

@lolgear
Copy link
Contributor Author

lolgear commented May 11, 2021

Could you confirm that my test by Xcode project is relevant?

@lolgear lolgear changed the title Invalid check for availability of futimens function for macOS platform. Invalid check for availability of futimens function for macOS platform May 16, 2021
@tiennou
Copy link
Contributor

tiennou commented May 17, 2021

I can confirm that something is fishy, here's the output from a run of libgit2/objective-git, that builds with SDKROOT\=/Applications/Xcode-12.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk and MACOSX_DEPLOYMENT_TARGET\=10.10.

@lolgear
Copy link
Contributor Author

lolgear commented May 27, 2021

I posted a question about this issue at CMake forums.

And at one moment I figured out that I do something wrong.
I compared generated .c file and a file that is proposed in a CMake futimens issue.

They are different. Generated file doesn't include headers to search for.
It defines a function futimens.

I suggested to use check_symbol_exists with a provided header sys/stat.h.

enable_warnings(error)
check_symbol_exists(futimens sys/stat.h HAVE_FUTIMENS)
# check_function_exists(futimens HAVE_FUTIMENS)
IF (HAVE_FUTIMENS)
	SET(GIT_USE_FUTIMENS 1)
ENDIF()
#message(FATAL_ERROR)

@lolgear
Copy link
Contributor Author

lolgear commented Jun 25, 2022

@ethomson
They changed something in recent release ( cmake 2.23.1 - 2.23.2 ) and our setup doesn't work.
MACOSX_DEPLOYMENT_TARGET doesn't affect futimens availability anymore.

/// Always find futimens regardless deployment target variable value.
MACOSX_DEPLOYMENT_TARGET=10.10 cmake -S "$SCRIPT_DIRECTORY" -B "$SCRIPT_DIRECTORY/xcode" -G "Xcode"

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

3 participants