- Posts: 19306
- Thank you received: 0
[SOLVED] "syntax error in VERSION script" compiling kins with Halcompile.
11 months 4 weeks ago #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.
This requires the file to supply an app_main and exit:
Explanation
Halcompile creates a Makefile to compile the component. This includes Makefile.modinc
Makefile.modinc contains this code:
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()
Solution:
Make sure that the .c file contains the following code and the problem should be solved.
Code:
#include "rtapi_app.h"
This requires the file to supply an app_main and exit:
Code:
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:
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()
Please Log in to join the conversation.
Time to create page: 0.552 seconds
