Details
Description
Overview
Asfter installing on a Mac, every cbc tool (cbc and all the names symbolically to cbc) will not work due to a @rpath issue as such none of them work after install
cd /Applications/Couchbase\ Server.app/Contents/Resources/couchbase-core/bin
|
cbc -h
|
dyld: Library not loaded: @rpath/libcouchbase.2.dylib |
A quick fix to currently installed Mac deployments (should be in release notes)
A simple fix for both MacOS 10.11.6 “OS X El Capitan” and MacOS 10.14.5 “Mojave” can be made as follows:
cd /Applications/Couchbase\ Server.app/Contents/Resources/couchbase-core/bin
|
install_name_tool -add_rpath @executable_path/../lib cbc |
Note, install_name_tool seems to be part of the standard MacOS 10.14.5 “Mojave”, however for my MacOS 10.11.6 “OS X El Capitan” it was missing but it gave me a prompt and auto installed for me.
The cbc command now works as expected e.g.
./cbc create SampleDocument2 -V '{"a_key": "a_value"}' -U couchbase://localhost/source -u Administrator -P password --expiry=600 |
SampleDocument2 Stored. CAS=0x15ef61cb1c080000 |
Details on what and why I did the above to fix the @rpath issue can be found at: https://blog.krzyzanowskim.com/2018/12/05/rpath-what/
The proper solution (build the cbc binary right).
If we deliver 'cbc' and it's symbolically linked tool set (cbc-touch, cbc-cat, etc.) then the binaries should be built correctly in the first place so that 'cbc' just works right after install.
This shouldn't be hard as other executables like couch_dbdump are built correctly the difference cann be seen via 'otool -l':
otool -l cbc | grep executable_path
|
install_name_tool -add_rpath @executable_path/../lib cbc |
otool -l cbc | grep executable_path
|
path @executable_path/../lib (offset 12) |
otool -l couch_dbdump | grep executable_path
|
path @executable_path/../lib (offset 12) |