InterLinked1 / lbbs

Lightweight BBS For Linux - Bulletin Board System server software
GNU General Public License v2.0
35 stars 4 forks source link

Errors when trying to compile LBBS from source #8

Closed seediffusion closed 1 year ago

seediffusion commented 1 year ago

Hi, I'm getting the following errors in Ubuntu 20.04 when trying to compile LBBS. I made sure all packages were up-to-date before proceeding, and ran the install_prereq.sh script to ensure all the required compilation libraries were installer. However, when I run the make command, I get these errors.

/bin/sh: 1: valgrind: not found /bin/sh: 1: valgrind: not found /bin/sh: 1: test: -ge: unexpected operator +--------- make bbs ---------+ make --no-builtin-rules -C bbs all make[1]: Entering directory '/usr/src/lbbs/bbs' == Compiling bbs/history.o gcc -Wall -Werror -Wunused -Wextra -Wmaybe-uninitialized -Wstrict-prototypes -Wm issing-prototypes -Wdangling-else -Wdeclaration-after-statement -Wmissing-declar ations -Wno-deprecated-declarations -Wmissing-format-attribute -Wnull-dereferenc e -Wformat=2 -Wshadow -Wsizeof-pointer-memaccess -std=gnu99 -pthread -O0 -g -Wst ack-protector -fno-omit-frame-pointer -fwrapv -D_FORTIFY_SOURCE=2 -DBBS_IN_CORE -I.. -c history.c history.c:25:10: fatal error: readline/history.h: No such file or directory 25 | #include <readline/history.h> | ^~~~~~~~ compilation terminated. make[1]: [Makefile:16: history.o] Error 1 make[1]: Leaving directory '/usr/src/lbbs/bbs' make: [Makefile:55: bbs] Error 2

I cloned everything into /usr/src/lbbs as highlighted in the readme.

InterLinked1 commented 1 year ago

Does running apt-get install -y libreadline-dev resolve this issue?

seediffusion commented 1 year ago

Now I'm getting a new error. make: *** [Makefile:59: nets] Error 2

InterLinked1 commented 1 year ago

Can you post the full output from compilation, including all the commands you ran?

seediffusion commented 1 year ago

There's too much output for my screen reader to view, even with the Windows command prompt maximized (I'm ssh'd into my Ubuntu server)

InterLinked1 commented 1 year ago

These isn't all that much output from running the commands to compile, it's not a huge source tree. You'll need to overcome that issue somehow. Command Prompt is probably best avoided for SSH. In PuTTY/KiTTY, you can increase your scrollback buffer (but the default of 10,000 should be plenty for this).

Alternately, just redirect the compilation process to a file and post that here:

make > makelog.txt 2>&1

seediffusion commented 1 year ago
/bin/sh: 1: valgrind: not found
/bin/sh: 1: valgrind: not found
/bin/sh: 1: test: -ge: unexpected operator
 +--------- make bbs ---------+
make --no-builtin-rules -C bbs all
make[1]: Entering directory '/usr/src/lbbs/bbs'
== Linking all
gcc -Wall -Werror -Wunused -Wextra -Wmaybe-uninitialized -Wstrict-prototypes -Wm
issing-prototypes -Wdangling-else -Wdeclaration-after-statement -Wmissing-declar
ations -Wno-deprecated-declarations -Wmissing-format-attribute -Wnull-dereferenc
e -Wformat=2 -Wshadow -Wsizeof-pointer-memaccess -std=gnu99 -pthread -O0 -g -Wst
ack-protector -fno-omit-frame-pointer -fwrapv -D_FORTIFY_SOURCE=2 -Wl,--export-d
ynamic -o lbbs *.o -lrt -lm -ldl -lbfd -lcap -lcrypt -lssl -lcrypto -lcurl -lrea
dline -luuid -rdynamic
make[1]: Leaving directory '/usr/src/lbbs/bbs'
 +--------- make doors ---------+
make --no-builtin-rules -C doors all
make[1]: Entering directory '/usr/src/lbbs/doors'
== Linking door_irc.so
gcc -shared -fPIC -o door_irc.so door_irc.o irc.o -lssl -lcrypto
== Compiling doors
make[1]: Leaving directory '/usr/src/lbbs/doors'
 +--------- make modules ---------+
make --no-builtin-rules -C modules all
make[1]: Entering directory '/usr/src/lbbs/modules'
== Compiling modules
make[1]: Leaving directory '/usr/src/lbbs/modules'
 +--------- make nets ---------+
make --no-builtin-rules -C nets all
make[1]: Entering directory '/usr/src/lbbs/nets'
objdump: '/lib/x86_64-linux-gnu/libssh.so': No such file
== Compiling net_sftp.o
gcc -Wall -Werror -Wunused -Wextra -Wmaybe-uninitialized -Wstrict-prototypes -Wm
issing-prototypes -Wdangling-else -Wdeclaration-after-statement -Wmissing-declar
ations -Wno-deprecated-declarations -Wmissing-format-attribute -Wnull-dereferenc
e -Wformat=2 -Wshadow -Wsizeof-pointer-memaccess -std=gnu99 -pthread -O0 -g -Wst
ack-protector -fno-omit-frame-pointer -fwrapv -D_FORTIFY_SOURCE=2 -fPIC -DBBS_MO
DULE=\"net_sftp\" -DBBS_MODULE_SELF_SYM=__internal_net_sftp_self -I.. -c net_sft
p.c
net_sftp.c:597:13: error: static declaration of 'sftp_server_free' follows non-s
tatic declaration
  597 | static void sftp_server_free(sftp_session sftp)
      |             ^~~~~~~~~~~~~~~~
In file included from net_sftp.c:40:
/usr/include/libssh/sftp.h:870:17: note: previous declaration of 'sftp_server_fr
ee' was here
  870 | LIBSSH_API void sftp_server_free(sftp_session sftp);
      |                 ^~~~~~~~~~~~~~~~
make[1]: *** [Makefile:24: net_sftp.o] Error 1
make[1]: Leaving directory '/usr/src/lbbs/nets'
make: *** [Makefile:59: nets] Error 2
InterLinked1 commented 1 year ago

The auto detection of libssh's version seems to not be working for you. libssh has incompatible changes between their library versions and (AFAIK) no easy way to detect what functions exist in their library, annoyingly, so if they aren't present they need to be shimmed.

You could manually add -DHAVE_SFTP_SERVER_FREE to your CFLAGS and that should fix this, but I'm curious what you get when you run:

shell objdump -T /lib/x86_64-linux-gnu/libssh.so | grep "sftp_server_free"

The results of that are being used to determine whether to pass that flag to the compiler or not.

seediffusion commented 1 year ago

objdump: '/lib/x86_64-linux-gnu/libssh.so': No such file

InterLinked1 commented 1 year ago

I'm presuming libssh is installed, correct?

apt-get install -y libssh-dev

I wonder if it may be located elsewhere on your system. Can you check similar directories, e.g. /usr/lib/ instead of /lib, etc. and see if it might be there?

seediffusion commented 1 year ago

Replacing /lib with /usr/lib in the command produces this output. 0000000000041710 g DF .text 0000000000000099 LIBSSH_4_8_0 sftp_server_free

InterLinked1 commented 1 year ago

Ah, okay, so good, it's installed, just for some reason on your system it only works with /usr/lib, and on others either /lib or /usr/lib seem to work.

I've pushed a small update (e035ce37e0d286e6089c88c4fd0758bc0ba72584) that should make it work for you - feel free to give the latest source a try.

seediffusion commented 1 year ago

The compilation and installation worked fine after the update, but now I'm having trouble getting HTTP(s) and SSH to work. I'm pretty sure I configured my conf files in /etc/lbbs correctly. Also it says that no auth provider is registered, though I ran the sql script to create the mysql database and dable values. I can access the BBS via telnet, but it says connection refused when I try to access it via SSH, even on localhost. I've allowed my desired SSH port through UFW. For your convenience, here's my most recent BBS log. bbs.log

InterLinked1 commented 1 year ago

Thanks for uploading a log; in the future if you can include debug as well, that is always best.

Most of the secure services require that tls.conf also be set up, although the SSH module uses its own certificates that must be specified in net_ssh.conf. The log tells you why it didn't load, it didn't find any acceptable keys to use:

[2023-03-21 08:26:50.183] VERBOSE[106617]: config.c:432 config_parse: Parsed config /etc/lbbs/net_ssh.conf
[2023-03-21 08:26:50.183] WARNING[106617]: net_ssh.c:70 bind_key: Can't access key /etc/ssh/ssh_host_rsa_key - missing or not readable?
[2023-03-21 08:26:50.183] WARNING[106617]: net_ssh.c:70 bind_key: Can't access key /etc/ssh/ssh_host_ecdsa_key - missing or not readable?
[2023-03-21 08:26:50.183]  ERROR[106617]: net_ssh.c:99 start_ssh: Failed to configure listener, unable to bind any SSH keys
[2023-03-21 08:26:50.183]  ERROR[106617]: module.c:469 load_resource: Module 'net_ssh.so' could not be loaded.

You can try tweaking the key settings in the config file and see if that works, I've had to do that on different systems.

What does your modules.conf look like? It seems that perhaps you may have disabled autoload. I see you're loading mod_mysql, but you also need mod_auth_mysql as that is what actually provides the database-backed authentication. If autoload is disabled, you'll want to explicitly load that module, load = mod_auth_mysql.so