Skip to content

CI: Update to ubuntu-26.04 - #4477

Draft
hdiethelm wants to merge 3 commits into
LinuxCNC:masterfrom
hdiethelm:ci_update_ubuntu_26.04
Draft

CI: Update to ubuntu-26.04#4477
hdiethelm wants to merge 3 commits into
LinuxCNC:masterfrom
hdiethelm:ci_update_ubuntu_26.04

Conversation

@hdiethelm

@hdiethelm hdiethelm commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

This solves an issue with po4a that does not translates all the document, see: #4471 (comment)

However, some build jobs fail, WIP:

  • cppcheck Fixed
  • clang build Fixed
  • tests:
    • interp/g71-endless-loop
    • interp/g71-endless-loop_2
    • interp/g71-with-g70

This solves an issue with po4a that does not translates all the
documents.

However, some build jobs fail now and will be fixed in the following
commits.
@hdiethelm
hdiethelm marked this pull request as draft August 26, 2026 21:31
Comment on lines 1061 to 1063
//no more used since menu/toolbar added...
#ifdef AAAAAAAAAAAAAAAAAAAAAA
#if false
hboxbottom = gtk_hbox_new (FALSE,0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The standard method is #if 0. There is usually no "false" defined and then you could just as well keep it as AAAAAAAAAAAAAAAAAAAAAA.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed. The AAAAAAAAAAAAAAAAAAAAAA seams to create issues with the new cppcheck that checks also the AAAAAAAAAAAAAAAAAAAAAA case which has a (void*)1 in it that is not worth inspecting and fixing in unused code.

Comment thread src/Makefile Outdated
Comment on lines 279 to 282
LDFLAGS := -L$(LIB_DIR) -Wl,-rpath,$(LIB_DIR) $(LIBTIRPC_LIBS) $(LDFLAGS) -latomic
else
LDFLAGS := -Wl,-rpath-link,../lib $(LIBTIRPC_LIBS) $(LDFLAGS)
LDFLAGS := -Wl,-rpath-link,../lib $(LIBTIRPC_LIBS) $(LDFLAGS) -latomic
endif

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question is why is this suddenly necessary?
Also, this only seems to be necessary with clang.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error is:

Linking rtapi_app
/usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/atomic_base.h:999:(.text+0x3cd5): undefined reference to `__atomic_compare_exchange'
clang++ -std=gnu++20 -rdynamic -o ../bin/rtapi_app objects/rtapi/uspace_rtapi_main.o objects/rtapi/uspace_rtapi_app.o objects/rtapi/uspace_rtapi_parport.o objects/rtapi/uspace_rtapi_string.o objects/rtapi/rtapi_pci.o  -pthread -lrt -lfmt -ludev -ldl -lcap -L/home/runner/work/linuxcnc/linuxcnc/lib -Wl,-rpath,/home/runner/work/linuxcnc/linuxcnc/lib -ltirpc -lgpiod
/usr/bin/x86_64-linux-gnu-ld.bfd: /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/atomic_base.h:999:(.text+0x3d44): undefined reference to `__atomic_compare_exchange'
/usr/bin/x86_64-linux-gnu-ld.bfd: objects/rtapi/uspace_rtapi_main.o: in function `boost::lockfree::detail::fixed_size_freelist<boost::lockfree::queue<message_t, boost::lockfree::capacity<128ul> >::node, boost::lockfree::detail::compiletime_sized_freelist_storage<boost::lockfree::queue<message_t, boost::lockfree::capacity<128ul> >::node, 129ul> >::deallocate_impl(unsigned short)':
/usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/atomic_base.h:999:(.text+0x3d8d): undefined reference to `__atomic_compare_exchange'
/usr/bin/x86_64-linux-gnu-ld.bfd: /usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/atomic_base.h:999:(.text+0x3dcf): undefined reference to `__atomic_compare_exchange'
/usr/bin/x86_64-linux-gnu-ld.bfd: objects/rtapi/uspace_rtapi_main.o: in function `bool std::__atomic_impl::__compare_exchange<false, boost::lockfree::detail::tagged_index>(boost::lockfree::detail::tagged_index&, std::remove_volatile<boost::lockfree::detail::tagged_index>::type&, std::remove_volatile<boost::lockfree::detail::tagged_index>::type&, bool, std::memory_order, std::memory_order)':
/usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/atomic_base.h:999:(.text+0x40df): undefined reference to `__atomic_compare_exchange'
/usr/bin/x86_64-linux-gnu-ld.bfd: objects/rtapi/uspace_rtapi_main.o:/usr/lib/gcc/x86_64-linux-gnu/15/../../../../include/c++/15/bits/atomic_base.h:999: more undefined references to `__atomic_compare_exchange' follow

So it is most probably boost::lockfree that needs it, could be a boost change that behaves differently with clang. Commit is ready that adds this flag only to rtapi_app.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://en.cppreference.com/cpp/atomic/atomic
Quote: On GCC and Clang, some of the functionality described here requires
linking against -latomic.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... time to kill boost then, I guess. Moving to pybind11 would probably be the best way to go.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why pybind? It is this one:

static boost::lockfree::queue<message_t, boost::lockfree::capacity<128>> rtapi_msg_queue;

Could be rewritten using atomics or an other library can be used but not in this PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake, I thought it came from gcodemodule (because it also uses boost).

Anyway, it is not right to add -latomic globally. Only the one failing should require it. And, yes, if it can be changed not to be a problem anymore, then that would actually be better.

I still do not understand how/why this fails now. Only if the size of the exchange exceeded an instruction size, but then the lockfree would be history too.

If it the dependency can be removed, then that is even better.

Comment thread src/emc/sai/driver.cc
Comment on lines 566 to 568
#ifdef TOOL_NML //{
tool_nml_register((CANON_TOOL_TABLE*)& _sai._tools);
tool_nml_register(& _sai._tools);
#else //}{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't this trip in emc/task/taskclass.cc, emc/usr_intf/axis/extensions/emcmodule.cc and emc/usr_intf/halui.cc?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

& _sai._tools is already type CANON_TOOL_TABLE, no need to cast it seams.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but why does cppcheck accept the same "old style cast" in those other files?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do you see one that is not a cast of NULL? Looks like either casting NULL is allowed or #ifdef / #else is not reached. Anyway, the old cppcheck also did not complain.

Comment thread scripts/cppcheck.sh
CPPCHKOPT=( -j "$nproc" --force "$EXHAUSTIVE" --inline-suppr )
CPPCHKOPT+=( "--enable=warning,performance,portability" )
CPPCHKOPT+=( "-I$(realpath "$(dirname "$0")/../include")" )
CPPCHKOPT+=( "-I$(realpath "$(dirname "$0")/../src/rtapi")" ) #Needed for KERNEL_VERSION and MODULE_VERBOSE macros

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which header is involved?

It is probably not a good idea to have this added for all files. We are trying to isolate public/private headers and the include/search order is important.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is rtapi.h included from hal_lib.c:

Checking hal/hal_lib_query.c: RTAPI...
hal/hal_lib.c:3477:2: error: failed to evaluate #if condition, undefined function-like macro invocation: KERNEL_VERSION( ... ) [syntaxError]
#if defined(__KERNEL__) && defined( CONFIG_PROC_FS ) && LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
 ^

And also an issue in mb2hal.c with MODULE_VERBOSE that got solved adding this line but I did not verify why. The error was:

Checking hal/user_comps/mb2hal/mb2hal_hal.c: MODULE_VERBOSE...
hal/user_comps/mb2hal/mb2hal.h:36:1: error: syntax error [syntaxError]
Checking hal/user_comps/mb2hal/mb2hal_hal.c: RTAPI...
MODULE_VERBOSE(emc2, "component:mb2hal:Userspace HAL component to communicate with one or more Modbus devices");
^

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that there is a wrong assumption here because, f.ex., hal_lib.c needs to compile once as a user-space library and once as a RT library. These have different points of view. That means that the error must be dealt with locally and the real cause must be found. There is probably an assumption in there that cppcheck chokes on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it looks like with adding this include path, cppckeck does not check any more the MODULE_VERBOSE case.

I greped the whole repo, /usr/include, /usr/src and /usr/realtime-: MODULE_VERBOSE exists only in mb2hal.h. Can this this might be just be deleted? Looks to me like a long gone makro.

@hdiethelm
hdiethelm force-pushed the ci_update_ubuntu_26.04 branch from 28dbfc4 to e668eb2 Compare August 26, 2026 21:56
cppcheck passes now.

Replace #ifdef AAAAA with #if 0 so cppcheck does not check unused code.
clang needs -latomic: See https://en.cppreference.com/cpp/atomic/atomic

Quote: On GCC and Clang, some of the functionality described here requires
linking against -latomic.
@hdiethelm
hdiethelm force-pushed the ci_update_ubuntu_26.04 branch from e668eb2 to a5d5858 Compare August 26, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants