On Thu, Mar 08, 2018 at 04:29:00PM +0000, andy pugh wrote: > Is it possible to compile a kins module without compiling all of LinuxCNC? > halcompile appears not to properly compile pumakins (as an example).
Not in general. pumakins is an example of a kinematics module that actually is a combination of several source files (in addition to pumakins.c, _posemath.c and sincos.c are included). halcompile does not handle such components. (this dependency is a bit hidden, it's written in src/Makefile, search for pumakins) You didn't show the error, but I assume that it was something like (assuming uspace) pumakins: dlopen: ...: undefined symbol the named symbol (such as pmRpyQuatConvert) comes from one of those other source files that is linked into the pumakins component when built inside LinuxCNC. tripodkins, on the other hand, not only compiles with halcompile, but the result will also 'loadrt'. By using Makefile.modinc directly, you should be able to build C components from multiple source files. However, this is not documented or tested, so it's probably broken and how would you know about it anyway? Well, here, I at least wrote a test. It passes in master branch with uspace. -- >8 -- Subject: [PATCH] tests: test building a component with multiple source files --- tests/halcompile/multisrc/.gitignore | 2 ++ tests/halcompile/multisrc/Makefile | 10 ++++++++++ tests/halcompile/multisrc/checkresult | 2 ++ tests/halcompile/multisrc/extra.c | 1 + tests/halcompile/multisrc/go.hal | 2 ++ tests/halcompile/multisrc/multisrc.comp | 9 +++++++++ tests/halcompile/multisrc/test.sh | 6 ++++++ 7 files changed, 32 insertions(+) create mode 100644 tests/halcompile/multisrc/.gitignore create mode 100644 tests/halcompile/multisrc/Makefile create mode 100755 tests/halcompile/multisrc/checkresult create mode 100644 tests/halcompile/multisrc/extra.c create mode 100644 tests/halcompile/multisrc/go.hal create mode 100644 tests/halcompile/multisrc/multisrc.comp create mode 100755 tests/halcompile/multisrc/test.sh diff --git a/tests/halcompile/multisrc/.gitignore b/tests/halcompile/multisrc/.gitignore new file mode 100644 index 000000000..cc2070e0a --- /dev/null +++ b/tests/halcompile/multisrc/.gitignore @@ -0,0 +1,2 @@ +*.so +multisrc.c diff --git a/tests/halcompile/multisrc/Makefile b/tests/halcompile/multisrc/Makefile new file mode 100644 index 000000000..c799a90a6 --- /dev/null +++ b/tests/halcompile/multisrc/Makefile @@ -0,0 +1,10 @@ +obj-m += multisrc.o +multisrc-objs := multisrc.o extra.o + +%.c: %.comp + halcompile --preprocess $^ + +include $(shell halcompile --print-modinc) + +clean: + rm -f multisrc.c *.o *.[sk]o diff --git a/tests/halcompile/multisrc/checkresult b/tests/halcompile/multisrc/checkresult new file mode 100755 index 000000000..6a2d1e553 --- /dev/null +++ b/tests/halcompile/multisrc/checkresult @@ -0,0 +1,2 @@ +#!/bin/sh +grep -q -F 'RT multisrc' $1 diff --git a/tests/halcompile/multisrc/extra.c b/tests/halcompile/multisrc/extra.c new file mode 100644 index 000000000..3d7062941 --- /dev/null +++ b/tests/halcompile/multisrc/extra.c @@ -0,0 +1 @@ +int f() { return 1; } diff --git a/tests/halcompile/multisrc/go.hal b/tests/halcompile/multisrc/go.hal new file mode 100644 index 000000000..8f22120fc --- /dev/null +++ b/tests/halcompile/multisrc/go.hal @@ -0,0 +1,2 @@ +loadrt multisrc +show diff --git a/tests/halcompile/multisrc/multisrc.comp b/tests/halcompile/multisrc/multisrc.comp new file mode 100644 index 000000000..e991f209a --- /dev/null +++ b/tests/halcompile/multisrc/multisrc.comp @@ -0,0 +1,9 @@ +component multisrc; +pin out bit out; +function _; +license "GPL"; +;; +extern int f(); +FUNCTION(_) { + out = f(); +} diff --git a/tests/halcompile/multisrc/test.sh b/tests/halcompile/multisrc/test.sh new file mode 100755 index 000000000..ab1d52bb8 --- /dev/null +++ b/tests/halcompile/multisrc/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e +make modules +make install +halrun go.hal +make clean -- 2.11.0 Jeff ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers