#322 v2.5 branch fails to build with 'make OPT=-O0'

open
nobody
rtai lxrt (1)
5
2013-07-17
2013-07-17
No

on 10.04LTS/2.6.32-122-rtai v2.5_branch (0f35a677627) fails to build if OPT=-O0 is given as make argument; this does not happen on default 'make' or 'make OPT=-O1':

Linking halstreamer
../lib/liblinuxcnchal.so.0: undefined reference to _rt_shm_alloc' ../lib/liblinuxcnchal.so.0: undefined reference tort_shm_free'

also, milltask fails to link for the same reason

This is obviously caused by optimization-dependent inlining (suspicious: /usr/realtime-2.6.32-122-rtai/include/rtai_shm.h)

The fix is to always link liblxrt.a into liblinuxcnchal.so and milltask, however rtai-config is broken and does not produce useful ldflags:

$ /usr/realtime-2.6.32-122-rtai/bin/rtai-config --lxrt-ldflags
-L/usr/realtime-2.6.32-122-rtai/lib -lpthread

(NB: the candidate library /usr/realtime-2.6.32-122-rtai/lib/liblxrt.a is not contained in the output)

the following changes make the realtime config build and runtest ok

this still needs to be reworked into a proper patch:

diff --git a/src/emc/task/Submakefile b/src/emc/task/Submakefile
index 13b24b6..c24fd1c 100644
--- a/src/emc/task/Submakefile
+++ b/src/emc/task/Submakefile
@@ -23,5 +23,5 @@ USERSRCS += $(MILLTASKSRCS)

../bin/milltask: $(call TOOBJS, $(MILLTASKSRCS)) ../lib/librs274.so.0 ../lib/liblinuxcnc.a ../lib/libnml.so.0 ../lib/liblinuxcncini.so.0 ../lib/libposemath.so.0
$(ECHO) Linking $(notdir $@)
- @$(CXX) $(LDFLAGS) -o $@ $^
+ @$(CXX) $(LDFLAGS) -o $@ $^ /usr/realtime-2.6.32-122-rtai/lib/liblxrt.a -lpthread
TARGETS += ../bin/milltask
diff --git a/src/hal/Submakefile b/src/hal/Submakefile
index 5b3c881..9a964f1 100644
--- a/src/hal/Submakefile
+++ b/src/hal/Submakefile
@@ -13,7 +13,7 @@ $(HALLIB).0: $(call TOOBJS, $(HALLIBSRCS))
$(ECHO) Creating shared library $(notdir $@)
@mkdir -p ../lib
@rm -f $@
- $(Q)$(CC) $(LDFLAGS) -Wl,-soname,$(notdir $@) -shared -o $@ $^
+ $(Q)$(CC) $(LDFLAGS) -Wl,-soname,$(notdir $@) -shared -o $@ $^ /usr/realtime-2.6.32-122-rtai/lib/liblxrt.a -lpthread

Discussion

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks