-
Notifications
You must be signed in to change notification settings - Fork 44
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
No native build was found for platform=darwin arch=arm64 runtime=electron abi=114 uv=1 armv=8 libc=glibc node=18.14.0 electron=24.8.7 webpack=true #279
Comments
Are you saying that node can't load lmdb either? (like if you just
This is a weird abi, the abi for Node 18.14.0 is 108 (you can get that from
This should be |
Thanks for your reply. I suspect that maybe the app is trying to access the local file at When I package the app in my Macbook Pro and open the app, I saw a dialog asking for permission to access the I transfer the app to my Macbook Air and see the error above. It's probably because the local path is different, the app cannot load the native module. I then build the app in my Macbook Air and now when I open the app, I saw the same dialog asking for permission to access I tested release to TestFlight, and the app from TestFlight has the same error. |
Yes, it looks at the path to see if there is a build in there, and then tries to read the package.json to determine the package name, to determine the native build package (should be @lmdb-darwin-arm64 in this case).
Is this possibly a permission issue, that it can't access these files? |
I did a bit more debugging, and I believe the issue is at this function: function resolveFile (prebuilds) {
// Find most specific flavor first
console.log('resolveFile', prebuilds)
var parsed = readdirSync(prebuilds).map(parseTags)
var candidates = parsed.filter(matchTags(runtime, abi))
var winner = candidates.sort(compareTags(runtime))[0]
if (winner) return path.join(prebuilds, winner.file)
} In both of my Macbook Pro and Macbook Air, the app is accessing the folder at the absolute path I think if |
Interesting, I wonder why the path would not be valid on your Macbook Air since it is coming from relative path to lmdb: |
I log |
I saw this issue webpack/webpack#14445 which states that by default module.exports = {
module: {
parser: {
javascript: {
importMeta:false
},
},
},
}; However when I added that setting into the webpack.config.js, I have a new error |
@kriszyp I managed to patch My next obstacle is to support both ARM and Intel for Mac. Some libraries like classic-level provides fat binary which support both arm64 and x64, but in |
I think https://github.com/prebuild/prebuildify has some information on how to reference a universal binary, but I don't know how to build one. And that wouldn't help at all for Windows and Linux would it? I have never really been interested in supporting only a single platform, lmdb-js is intended to support all platforms. |
For Windows and Linux, the current approach works fine, however for Mac, Electron app needs to be built in universal format to support both Intel and ARM architecture when release to the Mac App Store. That's why some libraries bundle both arm and x64 in one fat binary (only for Mac, nothing changes for other platforms). One idea I can think of is that I can force download the |
I don't know if it helps at all, but lmdb-js does come with a bin script |
I tried I go to the
I'm not sure if I need to recompile |
The binary doesn't include msgpackr-extract, but msgpackr-extract is just an optional dependency, so it is not needed (just has performance boost for deserialization, but everything should run fine without it). |
Thanks for the clarification. I found a strange issue - when I run
I search on Google and found this error is due to Electron memory cage: https://www.electronjs.org/blog/v8-memory-cage However when I delete the |
I believe the difference may be that the NAPI build does not use the backing store memory allocation, so you may want to use that build. |
Update: I was able to build the universal app for both arm64 and x64 architecture! I've tested in both M1 and Intel computer and they work great! Then I've code-signed and released the app to TestFlight without any warning. However after the app is downloaded from TestFlight, it crashes with below error. I believe it is due to Apple sandbox in Mac. I've opened a support ticket with Apple and hope to get their reply soon, but if you have any idea it would be great. Thank you.
|
@kriszyp although I haven't received any reply from Apple yet, I believe in order for mmap to work in sandboxed or hardened runtime Mac app, it must include the flag I found this answer on Stackoverflow and the linked source code at https://github.com/mono/mono/blob/main/mono/utils/mono-mmap.c has special handling for hardened runtime to include the flag I have searched for |
The documentation for MAP_JIT says it is to allow execute and write permission on memory maps, but LMDB only needs read access to memory maps, so it doesn't seem like that would be an issue. And it doesn't seem like the stack trace points to memory map allocation or access, but I don't really know why that stack trace would have an issue with a malloc or free. |
I added I must admit that I have no idea what I'm doing. I really hope Apple will be able to answer soon. I updated the crash log with line number, not sure if it's useful
|
If you are going to try making some source code changes, here is my suggestion: Try commenting out this line: |
Thank you, will do now and will update this post again when the TestFlight build is ready.
|
The |
I found this answer on Github which mentioned that it's very difficult to release LMDB to the Mac App Store due to sandbox restriction. Probably this means that I can only use LMDB for Windows and Linux and need to fallback to LevelDB on Mac. According to the old Apple documentation:
|
Yes the database is in the internal folder of the app which the app has write permission, and I can see database files below:
|
So this is the prefix used for the posix semaphores, but I wonder if it would help if that was configurable so you could set it to the application group name? |
I tried replace the default prefix from "/MDB" to my own app group prefix in source code and build from source again, but the app still crashes when release to TestFlight. I'm not totally sure if I did it right, but in the end I give up because the Mac App Store Sandbox is really troublesome. |
Hi,
I have been able to integrate
lmdb
into our Electron app and it is running really well. When I package the app, it can run normally on my Macbook Pro M1 and Windows 11 computer, however when the app runs on another Macbook Air M1 (Ventura 13.4.1), I saw the error belowI was not sure what could cause this issue. Including or excluding the
node_modules
folder into the packaged app still shows the error. I go to thenode_modules/lmdb
and runnpm run build
, and error still happens.I'd really appreciate if you have any idea what could cause this issue, many thanks!
The text was updated successfully, but these errors were encountered: