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

java.lang.UnsatisfiedLinkError: Error looking up function 'utimensat' #95

Closed
eed3si9n opened this issue Dec 11, 2017 · 4 comments
Closed

Comments

@eed3si9n
Copy link
Member

steps

Run tests on macos.

problem

[info] sbt.io.PathMapperSpec *** ABORTED ***
[info]   java.lang.UnsatisfiedLinkError: Error looking up function 'utimensat': dlsym(0x10b6cde70, utimensat): symbol not found
[info]   at com.sun.jna.Function.<init>(Function.java:245)
[info]   at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:566)
[info]   at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:542)
[info]   at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:528)
[info]   at com.sun.jna.Library$Handler.invoke(Library.java:228)
[info]   at com.sun.proxy.$Proxy13.utimensat(Unknown Source)
[info]   at sbt.internal.io.PosixMilliLong.$anonfun$setModifiedTimeNative$1(Milli.scala:117)
[info]   at sbt.internal.io.PosixMilli.checkedIO(Milli.scala:99)
[info]   at sbt.internal.io.PosixMilliLong.setModifiedTimeNative(Milli.scala:117)
[info]   at sbt.internal.io.PosixMilliLong.setModifiedTimeNative(Milli.scala:110)

/cc @cunei

@eed3si9n
Copy link
Member Author

Maybe we should use utimes? http://man7.org/linux/man-pages/man2/utime.2.html

@eed3si9n
Copy link
Member Author

I can't run locally baked sbt without -Dsbt.io.jdktimestamps=true

@cunei
Copy link

cunei commented Dec 11, 2017

There are a number of timestamp-related calls, introduced at various times in the BSD/POSIX history. Among them: utime, utimes, lutimes, futimes, utimens, futimens, utimensat, futimensat, fdutimensat, plus other system-specific ones.

The "utime" variants use a simple time_t, and deal with whole seconds. The "utimes" variants use struct timeval, with seconds and microseconds. The most recent, and preferable, are the "utimens" variants, which have a nanosecond precision. The drawback of "utimes", besides the lower precision", is that it can only set simultaneously modification time and access time. It means that changing only the modification time requires going through an extra stat call in order to extract the current access time, so that the same, plus the updated modification time, can be set again by "utimes". In general, the "utimens" calls are the most up-to-date interface, and are preferable.

It turns out that utimensat is available in High Sierra, but not on Sierra or previous versions. That is a bit shocking since utimensat was standardized in 2008, in IEEE Std 1003.1-2008 (POSIX.1), a good 10 years ago.

I will add further checks so that OSX uses utimensat if available, and falls back to utimes otherwise.

@dwijnand
Copy link
Member

Fixed with #100.

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