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

segfault on macos catalina #513

Open
larrypl opened this issue Jun 30, 2019 · 13 comments
Open

segfault on macos catalina #513

larrypl opened this issue Jun 30, 2019 · 13 comments

Comments

@larrypl
Copy link

larrypl commented Jun 30, 2019

Consistently.

@ableegoldman
Copy link

Same.

Always

@jsirianni
Copy link

[1]    74948 segmentation fault  lpass show 2807938221729877020

@svenmh
Copy link

svenmh commented Oct 21, 2019

I seem to have gotten this to work on Catalina but using libssl and libcurl from miniconda3 rather then Apples. With the command: CURL_INCLUDE_DIR=$MINICONDA3/include OPENSSL_ROOT_DIR=$MINICONDA3 PREFIX=$HOME/Local make install

Now otool looks like:

% otool -L $(which lpass)

/Users/sven/Local/bin/lpass:
	/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
	@rpath/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	@rpath/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	@rpath/libcurl.4.dylib (compatibility version 10.0.0, current version 10.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)

Just make sure LD_LIBRARY_PATH is set.

@jsirianni
Copy link

I was able to build from commit hash 8767b5e53192ad4e72d1352db4aa9218e928cbe1 master branch just now, without issue.

MacOS 10.13.6

Installing from Brew gives the segfault issues.

@svenmh
Copy link

svenmh commented Oct 21, 2019

I only got my Cataline mac, but what does otool -L $(which lpass) display?

@jsirianni
Copy link

	/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
	/usr/local/opt/openssl/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/local/opt/curl/lib/libcurl.4.dylib (compatibility version 11.0.0, current version 11.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)```

@svenmh
Copy link

svenmh commented Oct 21, 2019

Sorry, you are already using the same different libraries that I'm using, so I don't know.

@paulcwarren
Copy link

I appear to have this same issue.

lpass login <username>
Segmentation fault: 11

I brew installed from source brew install --build-from-source lastpass-cli and now linked against these libraries:

$ otool -L `which lpass`
/usr/local/bin/lpass:
	/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
	/usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	/usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	/usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)

@rbur004
Copy link

rbur004 commented Jan 8, 2020

Same issue for me, both on Catalina and on Mojave.
Mac ports, brew and compiled myself, all die. Not always with sig 11 though. Might be something uninitialized.

I had some runs giving malloc error, pointer being freed was not allocated, then Abort trap 6.
Exactly the same binary also gave Sig 11.
Also got XML decoding errors a couple of times. Again, exactly the same binary.

As mentioned by svenmh, not using Apples ssl and curl seems to be the cure. Compiled with my own libssl 1.1.1d and libcurl 7.68.0, seems to work (probably needed own libcurl, as would need to use the headers for my libssl, rather than Apples)

Built libssl 1.1.1d with (to keep it separate from other versions)
./configure darwin64-x86_64-cc --prefix=/usr/local/ssl; make; sudo make install

Built libcurl (compiling curl 7.68.0 source, again to keep it separate from other versions)
./configure --prefix=/usr/local/curl --with-ssl=/usr/local/ssl; make; sudo make install

Built lastpass-cli with (possibly overkill on the defines)
make -e OPENSSL_INCLUDE_DIR=/usr/local/ssl/include -e OPENSSL_LIBRARIES=/usr/local/ssl/lib -e OPENSSL_ROOT_DIR=/usr/local/ssl -e CURL_INCLUDE_DIR=/usr/local/curl/include -e CURL_LIBRARIES=/usr/local/curl/lib

On a clean Mac OS system, I also had to install cmake and pkg-config into my /usr/local

Also found that on a Mac with Ports installed, make uses /opt/local/bin/pkg-config, and overrode the ssl and curl lib defines on the make command line, with the ones from Ports in /opt.

@icirellik
Copy link

This may or may not be helpful. These are the exact steps I followed to rebuild lastpass-cli from source. Afterwards, lpass login and lpass show worked normally.

# Uninstall lastpass-cli and run the following commands in a temporary folder to easy cleanup.

brew install autoconf
brew install automake

# compile openssl
git clone git@github.com:openssl/openssl.git  
cd openssl
./configure darwin64-x86_64-cc --prefix=/usr/local/ssl
make
sudo make install

# compile curl
git clone git@github.com:curl/curl.git
cd curl
git reset --hard curl-7_68_0
./buildconf
./configure --prefix=/usr/local/curl --with-ssl=/usr/local/ssl
make
sudo make install

# compile lastpass-cli
git clone git@github.com:lastpass/lastpass-cli.git
cd lastpass-cli
make -e OPENSSL_ROOT_DIR=/usr/local/ssl \
  -e OPENSSL_INCLUDE_DIR=/usr/local/ssl/include/ \
  -e OPENSSL_LIBRARIES=/usr/local/ssl/lib \
  -e OPENSSL_ROOT_DIR=/usr/local/ssl \
  -e CURL_INCLUDE_DIR=/usr/local/curl/include \
  -e CURL_LIBRARIES=/usr/local/
sudo make install

I had some issues getting lastpass-cli to use the new ssl library and modified the Makefile because it seemed easier to me than learning how to use make:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e30d9fd..0e0b148 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,7 +33,7 @@ ELSE()
 if((APPLE) AND (NOT DEFINED OPENSSL_ROOT_DIR))
-  set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl")
+  set(OPENSSL_ROOT_DIR "/usr/local/ssl")
 endif()

@emulanob
Copy link

emulanob commented Jan 22, 2020

EDIT: Fixed. I updated the PREFIX var in the MakeFile to /usr/local.

The installation worked, but I still get the segmentation fault error. 😢

This may or may not be helpful. These are the exact steps I followed to rebuild lastpass-cli from source. Afterwards, lpass login and lpass show worked normally.

# Uninstall lastpass-cli and run the following commands in a temporary folder to easy cleanup.

brew install autoconf
brew install automake

# compile openssl
git clone git@github.com:openssl/openssl.git  
cd openssl
./configure darwin64-x86_64-cc --prefix=/usr/local/ssl
make
sudo make install

# compile curl
git clone git@github.com:curl/curl.git
cd curl
git reset --hard curl-7_68_0
./buildconf
./configure --prefix=/usr/local/curl --with-ssl=/usr/local/ssl
make
sudo make install

# compile lastpass-cli
git clone git@github.com:lastpass/lastpass-cli.git
cd lastpass-cli
make -e OPENSSL_ROOT_DIR=/usr/local/ssl \
  -e OPENSSL_INCLUDE_DIR=/usr/local/ssl/include/ \
  -e OPENSSL_LIBRARIES=/usr/local/ssl/lib \
  -e OPENSSL_ROOT_DIR=/usr/local/ssl \
  -e CURL_INCLUDE_DIR=/usr/local/curl/include \
  -e CURL_LIBRARIES=/usr/local/
sudo make install

I had some issues getting lastpass-cli to use the new ssl library and modified the Makefile because it seemed easier to me than learning how to use make:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e30d9fd..0e0b148 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,7 +33,7 @@ ELSE()
 if((APPLE) AND (NOT DEFINED OPENSSL_ROOT_DIR))
-  set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl")
+  set(OPENSSL_ROOT_DIR "/usr/local/ssl")
 endif()

@icirellik Thanks for the workaround. I tried it and the last command (sudo make install) gives me an error I could not fix. Any ideas?

-- Checking for one of the modules 'bash-completion'
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/kdubonalume/projects/lastpass-cli/build
/Library/Developer/CommandLineTools/usr/bin/make -C build install
[100%] Built target lpass
Install the project...
-- Install configuration: ""
-- Installing: /usr/bin/lpass
CMake Error at cmake_install.cmake:36 (file):
  file INSTALL cannot copy file
  "/Users/kdubonalume/projects/lastpass-cli/build/lpass" to "/usr/bin/lpass":
  Operation not permitted.


make[1]: *** [install] Error 1
make: *** [install] Error 2

@wicksy
Copy link

wicksy commented Feb 15, 2020

Also get this with the latest lastpass-cli (1.3.3) and MacOS High Sierra (10.13.6) after updating a bunch of brew formulae (which include openssl).

➜  ~ /usr/local/bin/lpass login foo
[1]    36651 segmentation fault  /usr/local/bin/lpass login foo
➜  ~ /usr/local/bin/lpass --version
LastPass CLI v1.3.3.GIT
➜  ~ otool -L /usr/local/bin/lpass
/usr/local/bin/lpass:
	/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
	/usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	/usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
	/usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)
➜  ~

Fix was a mixture of the steps documented above by @icirellik and hacking CMakeLists.txt to hard code the paths to curl libraries (as I also couldn't get it to work with make -e).

➜  lastpass-cli git:(master) ✗ diff CMakeLists.txt CMakeLists.txt.orig
12,13d11
< set(CURL_BASE_PATH "/usr/local/curl/")
<
38c36
<   set(OPENSSL_ROOT_DIR "/usr/local/ssl")
---
>   set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl")
51,53c49,50
< #find_package(CURL REQUIRED)
< #include_directories(${CURL_INCLUDE_DIR})
< include_directories("${CURL_BASE_PATH}/include")
---
> find_package(CURL REQUIRED)
> include_directories(${CURL_INCLUDE_DIR})
78,79c75
< #target_link_libraries(${PROJECT_NAME} ${LIBXML2_LIBRARIES} ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES})
< target_link_libraries(${PROJECT_NAME} ${LIBXML2_LIBRARIES} ${OPENSSL_LIBRARIES} "${CURL_BASE_PATH}/lib/libcurl.dylib")
---
> target_link_libraries(${PROJECT_NAME} ${LIBXML2_LIBRARIES} ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES})
112,113c108
< #target_link_libraries(lpass-test ${LIBXML2_LIBRARIES} ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES})
< target_link_libraries(lpass-test ${LIBXML2_LIBRARIES} ${OPENSSL_LIBRARIES} "/usr/local/curl/lib/libcurl.dylib")
---
> target_link_libraries(lpass-test ${LIBXML2_LIBRARIES} ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES})
➜  lastpass-cli git:(master) ✗

Compiled version working....

➜  ~ which lpass
/Users/wicksy/git/lastpass-cli/build/lpass
➜  ~ otool -L $(which lpass)
/Users/wicksy/git/lastpass-cli/build/lpass:
	/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
	/usr/local/ssl/lib/libssl.3.dylib (compatibility version 3.0.0, current version 3.0.0)
	/usr/local/ssl/lib/libcrypto.3.dylib (compatibility version 3.0.0, current version 3.0.0)
	/usr/local/curl/lib/libcurl.4.dylib (compatibility version 11.0.0, current version 11.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
➜  ~ lpass --version
LastPass CLI v1.3.3.15.g8767b5e.dirty
➜  ~ lpass login foo
Error: Failed to enter correct password.
➜  ~

@Cyberbeni
Copy link

Cyberbeni commented Dec 22, 2020

You don't need to rebuild the dependencies, those are perfectly fine from brew...
(Maybe you also have to brew install ... some other stuff from the depends_on list here: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/lastpass-cli.rb )

brew install automake cmake curl openssl@1.1
git clone git@github.com:lastpass/lastpass-cli.git
cd lastpass-cli
make
PREFIX=$(brew --prefix) make install

Edit: I beleive that on M1, you also have to search and replace "/usr/local" to "/opt/homebrew" in https://github.com/lastpass/lastpass-cli/blob/master/CMakeLists.txt

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

10 participants