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

MacOS - linking help with libssh? #23

Open
Ralithune opened this issue Jun 27, 2020 · 4 comments
Open

MacOS - linking help with libssh? #23

Ralithune opened this issue Jun 27, 2020 · 4 comments

Comments

@Ralithune
Copy link

Hi - could someone help me with library linking? After installing libssh with brew install libssh, trying to make sshping throws the error that the file isn't found.

[-2020-06-27 12:49:26 ~/git/sshping $> make
Scanning dependencies of target sshping
[ 33%] Building CXX object CMakeFiles/sshping.dir/src/sshping.cxx.o
/Users/mtippie/git/sshping/src/sshping.cxx:35:10: fatal error: 'libssh/libssh.h' file not found
#include <libssh/libssh.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/sshping.dir/src/sshping.cxx.o] Error 1
make[1]: *** [CMakeFiles/sshping.dir/all] Error 2
make: *** [all] Error 2
[-2020-06-27 12:49:27 ~/git/sshping $>

I altered sshping.cxx to make sure #define LIBSSH_STATIC 1 was run even outside the ifdef / else statement (as some googling suggested) but that seems to have no effect on the error.

Any help would be appreciated.

@OlegSmelov
Copy link

I was able to build sshping for macOS 10.14 by installing libssh with Homebrew and removing /usr/include/libssh/libssh.h from this line:

bin/sshping: src/sshping.cxx /usr/include/libssh/libssh.h

I didn't use cmake, just regular old make.

@casouri
Copy link

casouri commented Oct 21, 2021

For those who uses macports, install libssh and use this Makefile. Basically adding -I/opt/local/include and -L/opt/local/lib.

# See https://github.com/spook/sshping

.PHONY=default sshping man
CFLAGS=-I/opt/local/include -Iext -L/opt/local/lib -lssh

default: sshping

sshping: bin/sshping

bin/sshping: src/sshping.cxx
	g++ -Wall -o bin/sshping $(CFLAGS) src/sshping.cxx

man: doc/sshping.8.gz

doc/sshping.8.gz: doc/sshping.8
	gzip -9cn $< > $@

doc/sshping.8: doc/sshping.pod
	if command -v pod2man &> /dev/null; then \
	  pod2man --section=8 -c "ssh-based ping test utility" -d 2018-03-13 -r v0.1.4 doc/sshping.pod doc/sshping.8; \
	else \
	  echo '*** Please install pod2man so that we can create the man page'; \
	  exit 2; \
	fi

@hexacera
Copy link

hexacera commented Feb 3, 2022

For Apple Silicon the paths are these ones instead:

CFLAGS=-I /opt/homebrew/include -I ext -L /opt/homebrew/lib -lssh

Remember to add $(CFLAGS) to the g++ line though!

@alshdavid
Copy link

alshdavid commented Sep 1, 2023

For Apple Silicon the paths are these ones instead:

CFLAGS=-I /opt/homebrew/include -I ext -L /opt/homebrew/lib -lssh

Remember to add $(CFLAGS) to the g++ line though!

I'm not too familiar with building C projects. This is what I ran to compile the project on an Apple SIlicon MBP

brew install libssh
g++ -Wall -I /opt/homebrew/include -I ext -L /opt/homebrew/lib -o bin/sshping src/sshping.cxx -lssh

lgarron added a commit to lgarron/homebrew-lgarron that referenced this issue Jul 3, 2024
Uses the compilation workaround from spook/sshping#23 (comment)
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