[SOLVED] "syntax error in VERSION script" compiling kins with Halcompile.

  • andypugh
  • andypugh's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
More
01 Nov 2025 13:21 #337652 by andypugh
I have found a solution to the problem often seen when trying to compile Kinematics (or occasionally other) modules  from C-code with halcompile.

Solution:

Make sure that the .c file contains the following code and the problem should be solved.
#include "rtapi_app.h"

This requires the file to supply an app_main and exit:
int comp_id;
int rtapi_app_main(void) {
    comp_id = hal_init("bipodkins");
    hal_ready(comp_id);
    return comp_id;
}

void rtapi_app_exit(void)
{
  hal_exit(comp_id);
}

Explanation

Halcompile creates a Makefile to compile the component. This includes Makefile.modinc

Makefile.modinc contains this code:
    $(Q)objdump -w -j .rtapi_export -t $*.tmp \
    | awk 'BEGIN{print "{ global :"} /rtapi_exported_/{printf("%s;\n", substr($$6,16))} END{print "local : * ; };"}' \
    > $*.ver

Which is what creates the modulename.ver file that the complaint is about. Without #include "rtapi_app.h" the .rtapi_export section doesn't exist, so the .ver file is invalid.

Adding the header is enough to complile the module, but it will then fail to load without an rtapi_app_main()
The following user(s) said Thank You: tommylight, rodw, unknown

Please Log in or Create an account to join the conversation.

More
02 Nov 2025 07:11 #337695 by Aciera
Thanks for figuring that out!

Please Log in or Create an account to join the conversation.

Time to create page: 0.055 seconds
Powered by Kunena Forum