Building static 1.2 agent

Started by KjellO, April 27, 2012, 01:01:06 PM

Previous topic - Next topic

KjellO

Hi!

I'm trying to build a static 1.2 agent,


./configure --with-static-agent


Configure script is happy, but make fails:

  CXX    snmpproxy.o
../../../tools/create_ssa_list.sh "linux ecs logwatch ping portcheck ups" > static_subagents.cpp
  CXX    static_subagents.o
  CXX    subagent.o
  CXX    sysinfo.o
  CXX    tools.o
  CXX    trap.o
  CXX    upgrade.o
  CXX    watchdog.o
make[4]: *** No rule to make target `../../../src/db/libnxdb/libnxdb.la', needed by `nxagentd'.  Stop.


Other configurations are building fine.

Any workarounds? Also, is there a way to control what subagents that are compiled in? (Trying to optimizing footprint for use in embedded devices )

Best regards.

Victor Kirhenshtein

Hi!

Looks like a bug in makefiles. I'll check it later today and let you know.

Best regards,
Victor

KjellO

Just curious... is there a chance for a fix for this issue? No panic, otherwise I'll go for a "normal" build.

Thanks!

Victor Kirhenshtein

Hi!

I've fixed that. You can download updated source archive from https://www.netxms.org/download/rc/netxms-1.2.1-rc1.tar.gz. I also add two new options for configure:

--with-all-static

linker will produce really static executable, with system libraries statically linked too;

--with-static-subagents=list

specify list of subagents to be included into static agent. For example,

./configure --with-static-agent --with-static-subagents="logwatch ping"

will produce static agent with only logwatch and ping subagents.

Best regards,
Victor

KjellO

Hi, thank you very much for your efforts!

But, I wonder if something still is broken?

Building on an old Debian etch (32-bit) with configuration

./configure --with-static-agent --with-all-static --with-static-subagents="pingcheck"


Configure script ok, but make complains:

../../../tools/create_ssa_list.sh "linux pingcheck" > static_subagents.cpp
  CXX    static_subagents.o
make[4]: *** No rule to make target `../../../src/db/libnxdb/libnxdb.la', needed by `nxagentd'.  Stop.


Also, seems to be some 64bit issues in RC1. When building on SuSE 64 bit, I get this:

  CXX    extagent.o
extagent.cpp: In function CSCPMessage* ReadMessageFromPipe(void*, void*):
extagent.cpp:131:34: error: cast from void to SOCKET loses precision
make[4]: *** [extagent.o] Error 1


Changed file include/nms_common.h, from int to intptr_t in the SOCKET typedef:

typedef intptr_t SOCKET;


Got a bit longer, next error was

push.cpp: In function void* PushConnector(void*):
push.cpp:245:63: error: cannot convert size_t* to socklen_t* for argument 3 to int accept(int, sock  addr*, socklen_t*)
make[4]: *** [push.o] Error 1


changed push.cpp,

from: size_t size = sizeof(struct sockaddr_un);
to: socklen_t size = sizeof(struct sockaddr_un);


Then a normal build is ok, but when building with
./configure --with-static-agent --with-all-static

it complains,

/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld: attempted static link of dynamic object `../../../src/db/libnxdb/.libs/libnxdb.so'
collect2: ld returned 1 exit status


I think I give up on this for now :) Will try again when next release is out. Again, thanks for your support.