changes in NML-interface?
- Reinhard
- Offline
- Platinum Member
- Posts: 508
- Thank you received: 94
Thank you for your attention!One of the library's is outside the standard linux library search path.
I fear, my situation is a bit different. Any way - thank you for the pointer!
Actually java runtime claims about EMC_STAT unresolved.
Digging into code shows, that constructor of EMC_STAT is in file emcops.cc which makes it into liblinuxcnc.a (a static library).
That library is used by link command, so I guess, those references should have already been resolved (statically)..
I changed the linker flags to generate absolute path for every dependencies:
LC_FLAGS = -L$(abspath lc/lib) \
-Wl,-rpath,$(abspath lc/lib) \
-shared \
-Xlinker -Map=libLinuxCNC.map \
$(abspath lc/lib/liblinuxcnc.a) \
$(abspath lc/lib/liblinuxcncini.so) \
$(abspath lc/lib/libnml.so.0) \
$(abspath lc/lib/liblinuxcnchal.so) \
$(abspath lc/lib/libtooldata.so.0) \
-L/usr/X11R6/lib
But there may be other dependencies not under my control, which may be unresolved. Don't know.
And the bad side: I have no idea, how to narrow that problem.
Please Log in or Create an account to join the conversation.
- Grotius
- Away
- Platinum Member
- Posts: 2245
- Thank you received: 1984
Attached a makefile that i use with halcompile, And for c++ linuxcnc makefiles you could look at my github in the .pro files.
The qt_linuxcnc_gui is maybe interesting for you to look at. ".pro file has the compile slogan"
# usgae : $ make clean
COMP=/home/user/Desktop/Linux-Embedded/linux-hal/hal-core/bin/halcompile
# include modinc
MODINC=$(shell $(COMP) --print-modinc)
ifeq (, $(MODINC))
$(error Unable to get modinc path)
endif
include $(MODINC)
# File list to compile
obj-m += test.o
files-to-compile := \
test.o \
cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
> /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi
module = $(patsubst %.o,%.so,$(obj-m))
EXTRA_CFLAGS := $(filter-out -Wframe-larger-than=%,$(EXTRA_CFLAGS))
$(module): $(files-to-compile)
$(CC) -shared -o $@ $(files-to-compile) -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -llinuxcnchal -lrt
%.o: %.c
$(CC) -o $@ $(EXTRA_CFLAGS) -Os -c $<
all: $(module)
clean:
rm -f $(module)
rm -f *.so *.ko *.o
rm -f *.sym *.tmp *.ver
rm -f *.mod.c .*.cmd
rm -f modules.order Module.symvers
Please Log in or Create an account to join the conversation.
- Reinhard
- Offline
- Platinum Member
- Posts: 508
- Thank you received: 94
Thank you.If i look at your code i see you miss the -lrt
I just gave it a try, but it makes no difference.
Please Log in or Create an account to join the conversation.
- arvidb
- Offline
- Platinum Member
- Posts: 512
- Thank you received: 158
When I load the lib created with the "-shared" flag I get this error:
ibLinuxCNC.so: undefined symbol: _Z9emcFormatiPvP3CMS
The name mangling is done by the C++ compiler to cope with overloading/namespaces. The actual function, emcFormat, seems to be implemented in src/emc/nml_intf/emc.cc. I'm guessing this becomes a part of libnml.so? If so, try to move it to later in the LC_FLAGS. For example:
LC_FLAGS = -L$(abspath lc/lib) \
-Wl,-rpath,$(abspath lc/lib) \
-shared \
lc/lib/liblinuxcnc.a \
lc/lib/liblinuxcncini.so \
lc/lib/liblinuxcnchal.so \
lc/lib/libnml.so.0 \
lc/lib/libtooldata.so.0 \
-L/usr/X11R6/lib -lm -lGL
It's a longshot, but it might work.
Please Log in or Create an account to join the conversation.
- Reinhard
- Offline
- Platinum Member
- Posts: 508
- Thank you received: 94
.
I know and I suspect that name mangling has its part on the error.The name mangling is done by the C++ compiler to cope with overloading/namespaces.
One problem is, that there are so many languages mixed in LC and another problem is the nesting of dependencies. Aparently no lib can be used on its own
.
Hm, I don't know, if sequence of objects/libs plays a role. I changed sequence a lot but couldn't see any difference.If so, try to move it to later in the LC_FLAGS.
I run out of ideas. Guess I have to start with a new interface layer from scratch
Please Log in or Create an account to join the conversation.
- Reinhard
- Offline
- Platinum Member
- Posts: 508
- Thank you received: 94
That way I succeeded with working nml-layer againGuess I have to start with a new interface layer from scratch
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
- Posts: 216
- Thank you received: 25
I hope this is the right place.
How would I get the distance to go from nml for each axis on a gantry CNC.
best reards
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23170
- Thank you received: 4860
The UIs seem to use the Python interface:
github.com/LinuxCNC/linuxcnc/blob/master...mc_interface.py#L308
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
- Posts: 216
- Thank you received: 25
i started with the position-logger using nml and ported it to qtcreator c/c++. No Py.
Now there is suppose to be a .dtg value for each axis.
I can not find the tuple for it in the emc_stat. And so on. No docu on that.
std::get<0> (emcSTATUS->.......... .dtg);
The docu‘s in Py I have seen already.
Please Log in or Create an account to join the conversation.