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

Uncaught Error: libsqlcipher.so.0: cannot open shared object file: No such file or directory. #2732

Closed
pasupathy1611 opened this issue Mar 22, 2018 · 13 comments
Labels

Comments

@pasupathy1611
Copy link

  • Version: 20.7.1
  • Target: Linux, MAC, Windows

Is there any way to include the sqlcipher shared object in the build config.
I’m using https://github.com/mapbox/node-sqlite3 SQLCipher with --build-from-source and also attached the build property.

build.txt

@develar
Copy link
Member

develar commented Mar 22, 2018

node-sqlite3 doesn't provide prebuilt binaries and so, you can build app only on the target platform. Do build for Linux on Linux?

@pasupathy1611
Copy link
Author

Yes I'm building for a linux dist on my local ubuntu machine.

Do the shared libraries get bundled in the asar?

@develar
Copy link
Member

develar commented Mar 23, 2018

No. You should bundle it somehow. What do you use — AppImage or Snap?

@pasupathy1611
Copy link
Author

My target for
linux is AppImage
mac is DMG
windows is NSIS

Is there a recommended solution to include shared libs in a cross platform way?

"build": {
		"productName": "retail",
		"appId": "com.electron.evoluzin-retail",
		"compression": "store",
		"linux": {
			"category": "Office",
			"target": [
				{
					"target": "AppImage",
					"arch": [
						"x64"
					]
				}
			]
		},
		"mac": {
			"icon": "resources/osx/icon.icns",
			"category": "public.app-category.business",
			"target": [
				{
					"target": "dmg",
					"arch": [
						"x64"
					]
				}
			]
		},
		"dmg": {
			"icon": "resources/osx/dmg-icon.icns",
			"background": "resources/osx/dmg-background.png",
			"contents": [
				{
					"x": 110,
					"y": 150
				},
				{
					"x": 240,
					"y": 150,
					"type": "link",
					"path": "/Applications"
				}
			]
		},
		"win": {
			"target": [
				{
					"target": "nsis",
					"arch": [
						"x64"
					]
				}
			],
			"icon": "resources/windows/icon.ico"
		},
		"nsis": {
			"oneClick": true,
			"installerHeaderIcon": "resources/windows/setup-icon.ico"
		},
		"extraResources": [
			{
				"from": "build/assets",
				"to": "assets",
				"filter": [
					"db/*",
					"export/**/*",
					"data/**/*"
				]
			}
		],
		"directories": {
			"app": "build",
			"buildResources": "resources",
			"output": "dist"
		},
		"files": [
			"**/*",
			"!**/node_modules/*/{README.md,README,readme.md,readme,test}",
			"!**/node_modules/.bin",
			"!**/node_modules/fs-jetpack/spec${/*}",
			"!**/*.{o,hprof,orig,pyc,pyo,rbc,db,sql}",
			"!**/._*",
			"!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,__pycache__,thumbs.db,.gitignore,.gitattributes,.editorconfig,.idea,appveyor.yml,.travis.yml,circle.yml}",
			"!assets/{db,export,data}${/*}"
		],
		"nodeGypRebuild": false,
		"npmRebuild": false
	}

@develar
Copy link
Member

develar commented Mar 23, 2018

Got your error. So, it is definitely not your misconfiguration or user error.

Please try to copy shared lib (so file) to usr/lib. To do it, please define extraFiles configuration in the linux (under the field linux).

I hope this hint will help you. Please set debug env DEBUG=electron-builder and in this case stage dir for AppImage will be not deleted. So you can easily ensure after build that so file copied correctly.

@develar
Copy link
Member

develar commented Mar 23, 2018

Do know where to grab so file?

@pasupathy1611
Copy link
Author

pasupathy1611 commented Mar 23, 2018

I have the location for the so files. /usr/local/lib/libsqlcipher.so

Do I place the dll files in usr/lib for windows? Or is there a different location for windows libs?

@develar
Copy link
Member

develar commented Mar 23, 2018

for windows

I guess sqlite3 binary for windows is static. You only need this for Linux (and maybe for macOS). That's why "under the field linux"

@pasupathy1611
Copy link
Author

Using extraFiles configuration under the field linux in package.json for copying the library file it works. thank you.

@pasupathy1611
Copy link
Author

sorry, using extraFiles is not working with the latest version of electron. but have to set the environment variable LD_LIBRARY_PATH is there any other way to get this work?

@develar
Copy link
Member

develar commented May 24, 2018

@pasupathy1611 extraFiles will be supported again in next 20.15.0 version.

@saeta-eth
Copy link

saeta-eth commented May 10, 2019

I have seen many opened and closed issues redirecting to here, but I didn't find a clear example to figure out how to proceed with this. @develar Could you provide a good example?

@rudolfs
Copy link

rudolfs commented May 10, 2020

@slorenzo adding this to package.json is what worked for us:

{
  "build": {
    "linux": {
      "target": [
        "Appimage",
        "snap"
      ],
      "extraFiles": [
        {
          "from": "/usr/lib/x86_64-linux-gnu/libhogweed.so.4",
          "to": "usr/lib/libhogweed.so.4"
        },
        {
          "from": "/usr/lib/x86_64-linux-gnu/libnettle.so.6",
          "to": "usr/lib/libnettle.so.6"
        }
      ]
    }
  }
}

from: is the file location on your build host
to: is the file location within the image

The AppImage layout looks like this when extracted with ./MyApp.AppImage --appimage-extract:

~/squashfs-root » tree
.
├── usr
│   ├── lib
│   │   ├── libhogweed.so.4
│   │   └── libnettle.so.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants