Lightning: Failed to make install on FreeBSD

Created on 21 Sep 2019  路  11Comments  路  Source: ElementsProject/lightning

Failed to install on FreeBSD 12.0-RELEASE. I was running c-lightning v0.7.1-30-ga6516f4 and decided to upgrade to the latest version (v0.7.2.1) from github yesterday. with no luck.
To ./configure this time, there were new additional dependencies required: py36-mako and gettext, so i've installed them. After that, ./configure & gmake executed fine, but failed on gmake install.

_/usr/bin/ld: error: undefined symbol: __start_xautodata_db_backends                       
 >>> referenced by db.c:662 (wallet/db.c:662)                                                
 >>>               wallet/db.o:(db_config_find)                                                                                                                                                                                                

/usr/bin/ld: error: undefined symbol: __stop_xautodata_db_backends                                                                                                                                          
 >>> referenced by db.c:662 (wallet/db.c:662)                                                                                                                                                                                                  
 >>>               wallet/db.o:(db_config_find)                                                                                                                                                                                                
cc: error: linker command failed with exit code 1 (use -v to see invocation)                                                                                                                                                                  
gmake: *** [Makefile:390: lightningd/lightningd] Error 1_ 

image

bsd

Most helpful comment

It appears to me that HAVE_SECTION_START_STOP needs to be set to 0 on FreeBSD in ccan/config.h.

FWIW, manually changing this solves the __start_xautodata_db_backends issue for me. Thanks!
So it looks like there is a bug in the detection of HAVE_SECTION_START_STOP on FreeBSD at least.

Or maybe the detection is correct, but the statements aren't handled as you'd expect by FreeBSD's linker.

I do not have the sqlite3 detection issue here. Oh actually I do! I see

% ./launch-lightning.sh
Unable to find DB driver for sqlite3:///home/user/.lightning2/lightningd.sqlite3

at runtime now :cry: Could try to bisect, but here the problem is clear. Manually setting this in the config file solved the issue for now, so all in all on FreeBSD 12 you need the following ccan/config.h overrides:

#define HAVE_SECTION_START_STOP 0
#define HAVE_SQLITE3_EXPANDED_SQL 1
#define HAVE_SQLITE3 1

All 11 comments

gmake actually failed as well with error:

/usr/bin/ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[1]: * [: tools/test/gen_test.c.tmp] Error 1
gmake: *
[tools/test/Makefile:40: tools/test/gen_test.c] Error 1
rm external/libwally-core/src/secp256k1/libsecp256k1.la tools/test/gen_test.c.tmp.c

here's the full trace:
image

image

Same problem here on FreeBSD 12.0 with master (as of a4204226b46a31b3eb637967fb5c18d87d1cd9bb).

I bisected the problem to the commit acedcc593f52b17936843496336eee6c04bf8a9e:

acedcc593f52b17936843496336eee6c04bf8a9e is the first bad commit
commit acedcc593f52b17936843496336eee6c04bf8a9e
Author: Christian Decker <[email protected]>
Date:   Thu Jul 25 12:59:14 2019 +0200

    wallet: Look up the db_config for the given driver in db_open

    Signed-off-by: Christian Decker <[email protected]>

 wallet/db.c          | 25 +++++++++++++++++++++++++
 wallet/test/Makefile |  1 +
 2 files changed, 26 insertions(+)

I see the problem in the first screenshot with gmake on FreeBSD 12.0, too.

It appears to me that HAVE_SECTION_START_STOP needs to be set to 0 on FreeBSD in ccan/config.h.

Edit:
Also SQLite3 is not being detected. So you need to set HAVE_SQLITE3 to 1.

@nakal have you got success?

Yes. With the manual corrections above, the lightning node is up and running.

EDIT: yes, able to compile both 0.7.2.1 and master with suggestions

@ devs:

I found out, that the configurator tool should use -I /usr/local/include and -L /usr/local/lib, because it's different from Linux. The compiler does not add it transparently. The compile options will make it find Sqlite3.

I don't know exactly why HAVE_SECTION_START_STOP was set to 1. When I start the tool standalone it's set to 0. Is gcc hardwired somewhere in the configure phase or something like that? FreeBSD uses CLANG.

It appears to me that HAVE_SECTION_START_STOP needs to be set to 0 on FreeBSD in ccan/config.h.

FWIW, manually changing this solves the __start_xautodata_db_backends issue for me. Thanks!
So it looks like there is a bug in the detection of HAVE_SECTION_START_STOP on FreeBSD at least.

Or maybe the detection is correct, but the statements aren't handled as you'd expect by FreeBSD's linker.

I do not have the sqlite3 detection issue here. Oh actually I do! I see

% ./launch-lightning.sh
Unable to find DB driver for sqlite3:///home/user/.lightning2/lightningd.sqlite3

at runtime now :cry: Could try to bisect, but here the problem is clear. Manually setting this in the config file solved the issue for now, so all in all on FreeBSD 12 you need the following ccan/config.h overrides:

#define HAVE_SECTION_START_STOP 0
#define HAVE_SQLITE3_EXPANDED_SQL 1
#define HAVE_SQLITE3 1

Nothing wrong with section markers on freebsd. It's that it can't find sqlite3. Fix is simple, thanks for report!

I can confirm that master again builds (and runs) without manual configuration changes on FreeBSD 12.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ZmnSCPxj picture ZmnSCPxj  路  4Comments

Xian001 picture Xian001  路  3Comments

gallizoltan picture gallizoltan  路  3Comments

SPIRY-RO picture SPIRY-RO  路  4Comments

cdecker picture cdecker  路  4Comments