Fix static link problem in example

This commit is contained in:
Olof hagsand 2024-02-17 22:21:04 +01:00
parent ff171afd65
commit ea1efe8845
4 changed files with 21 additions and 18 deletions

View file

@ -78,6 +78,9 @@ CPPFLAGS = @CPPFLAGS@
ifeq ($(LINKAGE),dynamic)
CPPFLAGS += -fPIC
endif
ifeq ($(LINKAGE),dynamic)
CFLAGS += -DDYNAMICLINKAGE
endif
BE_PLUGIN = $(APPNAME)_backend.so
BE2_PLUGIN = $(APPNAME)_backend_nacm.so
@ -111,7 +114,7 @@ $(BE_PLUGIN): $(BE_OBJ)
ifeq ($(LINKAGE),dynamic)
$(CC) -Wall -shared $(LDFLAGS) -o $@ -lc $< -lclixon -lclixon_backend
else
# can include -L in LDFLAGS?
# can include -L in LDFLAGS?
$(CC) -Wall -shared $(LDFLAGS) -o $@ -lc $< -lclixon -lclixon_backend
endif
@ -176,8 +179,8 @@ install: $(YANGSPECS) $(CLISPECS) $(PLUGINS) $(APPNAME).xml restconf.xml autocli
[ -n "$$(getent passwd "$(CLICON_USER)")" ] || useradd -M -s /usr/sbin/nologin -g "$(CLICON_GROUP)" "$(CLICON_USER)"
install -d -m 0755 $(DESTDIR)$(sysconfdir)/clixon
install -m 0644 $(APPNAME).xml $(DESTDIR)$(sysconfdir)/clixon
install -m 0644 autocli.xml $(DESTDIR)$(sysconfdir)/clixon
install -m 0644 restconf.xml $(DESTDIR)$(sysconfdir)/clixon
install -m 0644 autocli.xml $(DESTDIR)$(sysconfdir)/clixon/$(APPNAME)
install -m 0644 restconf.xml $(DESTDIR)$(sysconfdir)/clixon/$(APPNAME)
install -d -m 0755 $(DESTDIR)$(datarootdir)/$(APPNAME)/yang
install -d -m 0755 $(DESTDIR)$(YANG_INSTALLDIR)
install -m 0644 $(YANGSPECS) $(DESTDIR)$(YANG_INSTALLDIR)

View file

@ -304,8 +304,11 @@ myerror(clixon_handle h,
errmsg_t *oldfn = NULL;
_errmsg_callback_fn = myerrmsg;
#ifdef DYNAMICLINKAGE
/* This does not link statically */
if (cli_remove(h, cvv, argv) < 0)
goto done;
#endif
retval = 0;
done:
_errmsg_callback_fn = oldfn;