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

This file seems to randomly disappear causing build issues. #35

Open
khan-zia opened this issue Jun 18, 2020 · 33 comments
Open

This file seems to randomly disappear causing build issues. #35

khan-zia opened this issue Jun 18, 2020 · 33 comments

Comments

@khan-zia
Copy link

I might be missing something here and it might be an obvious reason, but so far it seems to be randomly loosing this file for Android at this location

".../node_modules/react-native-sodium/android/../libsodium/libsodium-android-i686/lib/libsodium.so".

The file is required inside react-native-sodium\android\CMakeLists.txt at the following copy operation

file(COPY ${PROJECT_SOURCE_DIR}/../libsodium/libsodium-android-${ARCH_DIR}/lib/libsodium.so DESTINATION "${PROJECT_SOURCE_DIR}/lib/${ANDROID_ABI}")

Please guide.

@khan-zia
Copy link
Author

Update

@lyubo I have confirmed that the libsodium folder which gets unzipped from the precompiled gz, just magically disappears? any idea on why is that happening? It disappeared even after I manually extracted precompiled zip in there.

@tasn
Copy link
Contributor

tasn commented Jun 29, 2020

I'm experiencing the same. I'm not sure why it happens.
One "solution" would be to change the build step (when built as a dep) to just extract the tar if doesn't exist. Not sure what the correct solution is though.

@khan-zia
Copy link
Author

Hopefully @lyubo will figure it out.

@lyubo
Copy link
Owner

lyubo commented Jun 29, 2020

Give me some context pls. (package version android SDK version, etc.). Have you tried example application. New version is alinged with the most recent react-native and is working just fine.

@tasn
Copy link
Contributor

tasn commented Jun 29, 2020

I'm not sure it's exactly what's going on, but it seems to fail after installing another package (I'm using the yarn package manager).

To reproduce:

  1. Have a working project that builds correctly.
  2. yarn add some-other-package

It fails.

Not sure if this is what's going on, but maybe a clue.

@khan-zia
Copy link
Author

I am also using latest RN and SDK API 29. I don't have specific scenario either and I also use yarn. Every time it happens, I manually have to go to the folder and I extract the precompiled tar.

@lyubo
Copy link
Owner

lyubo commented Jun 29, 2020

Can you try with [email protected] (i.e the version with gpg)?

@khan-zia
Copy link
Author

Alright. I will try that version and if the issue persists, I will update here. However, I don't know when it will happen again since I am not sure how to reproduce it. I guess if it doesn't happen for quite a while, then we can assume that it works. Meanwhile, I will keep an eye for pin pointing the issue.

@tasn
Copy link
Contributor

tasn commented Jun 29, 2020

@lyubo, it's unrelated to that gpg change because it's about installing this package a dep, not building libsodium from source.

Do you also use yarn? Could you maybe try reproducing like I mentioned above?

@lyubo
Copy link
Owner

lyubo commented Jul 21, 2020

@tasn , last project I've used this library in used npm as package manager, so I can't tell if it is yarn related.

@khan-zia
Copy link
Author

@tasn @lyubo , I have confirmed that this issue just happens right away after updating or adding with yarn. If you open the file browser and keep looking at it and run yarn command, the libsodium folder just disappears... This is very strange.

@tasn
Copy link
Contributor

tasn commented Jul 22, 2020

@tasn , last project I've used this library in used npm as package manager, so I can't tell if it is yarn related.

You can try reproducing it with npm too, the same way I and @khan-zia described.

@tbrent
Copy link

tbrent commented Sep 10, 2020

Having the same issue. No libsodium.so at the expected location in node_modules for any of the architectures. Unzipping the .tgz manually shows the contents as they should be. Using yarn as well.

@tbrent
Copy link

tbrent commented Sep 10, 2020

False alarm. Turns out Sublime was just not showing me .so files. The file is there, and it doesn't look like taking yarn actions does any damage to it. I am still facing an issue, but this is not it.

@tasn
Copy link
Contributor

tasn commented Sep 30, 2020

Just had it again on a new project... :|

@khan-zia
Copy link
Author

This is indeed a confirmed issue. Unfortunately it seems that it will require quite some time to dig through and pin point the problem. However, I think the time it will take will be considerably less if @lyubo could do it since he knows this library the best.

@lyubo
Copy link
Owner

lyubo commented Sep 30, 2020

I've just updated the example application to newest RN and v0.3.9 of this package. I used yarn to build and run it on both iOS and Android emulators (I had used npm for example application until now). Unfortunately I could not reproduce this issue.
Please, try to build with this new version, which was updated to version 1.0.18 of libsodium.

@tasn
Copy link
Contributor

tasn commented Sep 30, 2020

I tried with latest react-native-sodium and with latest RN. I created the app a few days ago.
It doesn't happen immediately, but it happens after some usage.

@lyubo
Copy link
Owner

lyubo commented Sep 30, 2020

Latest react-native-sodium (0.3.9) had been published about an hour ago.

@tasn
Copy link
Contributor

tasn commented Sep 30, 2020

Ah, I missed that. I just upgraded, will keep an eye out for issues.

@tasn
Copy link
Contributor

tasn commented Oct 1, 2020

I had to revert back to 0.3.8 because it wouldn't build with Xcode 11. I can't remember the exact error now, but it was something about bitcode incompatibility.

@lyubo
Copy link
Owner

lyubo commented Oct 1, 2020

Post the exact error message, please! Xcode version used to compile library for iOS is 11.7.

@lyubo
Copy link
Owner

lyubo commented Oct 1, 2020

@tsan, @khan-zia, @tbrent
Please give some more context - yarn version, npm version, OS version, RN version. Also exact steps to reproduce this issue.

@tasn
Copy link
Contributor

tasn commented Oct 1, 2020

I don't have access to the build system so can't give you an exact error or version, but I think my Xcode is 11.4. There's nothing to investigate, the Xcode you built with is newer than mine (or maybe just incompatible, doesn't matter if newer or not) which was causing this.

As for the other error:
OS: Latest Arch Linux
yarn: 1.22.5
npm: 6.14.7
node: v14.13.0
react-native: 0.63.3

Exact steps: I already mentioned it above how I got to reproduce it, though I'm not sure whether it still happens consistently with those steps.

@lyubo
Copy link
Owner

lyubo commented Oct 1, 2020

My attempt to reproduce:

1. npx react-native init test_rns && cd test_rns
2. yarn add react-native-sodium
3. ls -R1 node_modules/react-native-sodium/libsodium | wc -l  (404)
4. yarn add react-navigation (randomly chosen)
5. ls -R1 node_modules/react-native-sodium/libsodium | wc -l  (404, No files are missing)

OS: MacOS 10.15.6
yarn: 1.22.0
npm: 6.13.7
node: 12.13.1
react-native: 0.63.3

@tasn
Copy link
Contributor

tasn commented Oct 1, 2020

I haven't gotten it on RN for iOS yet, so make sure you build for Android. Also, as I said, it doesn't happen immediately. Try maybe removing the react-navigation from package.json by hand and then running yarn. It's an operation I do often (which switching branches) maybe that will cause it.

@tasn
Copy link
Contributor

tasn commented Oct 15, 2020

@lyubo: another idea on how to do it:
In a new project, install react-native-sodium and etebase (the dep I'm using). Use an old version of etebase. Doesn't matter which, just not latest. Make a git commit of this state (package.json and yarn.lock). Now install the latest etebase. I think it should still work now. Now, git stash to change back the changes you made to package.json and yarn.lock when you installed the latest etebase, and then run yarn (just like that, no parameters) so it syncs the deps again. I think that should do it.

@lyubo
Copy link
Owner

lyubo commented Oct 23, 2020

@tasn: I still haven't try your suggestion, but running yarn (not yarn install) would possibly skip 'postinstall' hook, which is used to unzip precompiled.tgz file

@tasn
Copy link
Contributor

tasn commented Oct 24, 2020

@lyubo, yarn is an alias of yarn install, so I don't think it's that.

Actually, now that I re-read my description, it looks like yarn isn't calling the postinstall when the package is reinstalled but the version hasn't changed. I looked around and there seem to be a maybe related bug: yarnpkg/yarn#5476
I wonder if there's maybe something more robust that can be done here, for example, make it as part of the ios/android build scripts to check if exists and if not, untar there.

@lyubo
Copy link
Owner

lyubo commented Oct 26, 2020

The problem with hooking with build scripts is that if someone wants to build the library from source, and later these compiled files get deleted, users may end up with building with pre-compiled files, which apparently was not their intent.

@lyubo lyubo closed this as completed Oct 26, 2020
@tasn
Copy link
Contributor

tasn commented Oct 26, 2020

Did you close it by mistake? As the issue is still here.
Also, I disagree about your conclusion, we can just extract if and only if the directory is missing, so if people build their own, they won't be affected.

@lyubo
Copy link
Owner

lyubo commented Oct 26, 2020

yes, sorry

@tgreco
Copy link

tgreco commented Jul 2, 2022

Running into this issue.

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

5 participants