halcopile problem / new ubunu 14.04 installation
I install on ubuntu 14.04 linuxcnnc-dev folder on Home dir .... I've my custom comp for run a MBus server ... The com is running for test in my old ubuntu 10.04 config and works fine .... actually I try to install that config with custom kins e comp in fresh linuxcnc Master on ubuntu 14.04... kins compile good and my config works... but nothing to do with my comp firtrly is because I use:
singleton yes;
k1MbServer.c: In function ‘__comp_parse_names’:
/tmp/tmpLc0aCs/k1MbServer.c:573:17: error: ‘names’ undeclared (first use in this function)
names[j] = strtok(p, ",");
^
So I see inside halcompile file and I see some void parser araund count names .... so I write the new option and cancel the oldone:
option singleton no;
In these way merge these type of error:
/tmp/cc1kjkzO.o: in function "user_mainloop":
/tmp/tmp_RtXP2/k1MbServer.comp:210: undefined reference "floor"
/tmp/tmp_RtXP2/k1MbServer.comp:216: undefined reference "floor"
/tmp/tmp_RtXP2/k1MbServer.comp:217: undefined reference "floor"
/tmp/tmp_RtXP2/k1MbServer.comp:218: undefined reference "floor"
/tmp/tmp_RtXP2/k1MbServer.comp:219: undefined reference "floor"
/tmp/tmp_RtXP2/k1MbServer.comp:236: undefined reference "modbus_new_tcp"
/tmp/tmp_RtXP2/k1MbServer.comp:238: undefined reference "modbus_get_header_length"
/tmp/tmp_RtXP2/k1MbServer.comp:240: undefined reference "modbus_set_debug"
//and other about modbus
So now I not understand if singleton yes (old on ubuntu 10.04) is right or there are the problem with path of library and singleton no is right(today in new ubuntu 14.04) .. THE OLD CONFIG ON UBUNTU10.04 WITH THESE COMP COMPILE FINE .... in the doc and terminal I read about linuxcnc-dev installation for library refer to path linuxcnc-dev/lib ... so I try to make a symlink of libmodbus on these dir but nothing change.....
Other:undefined reference "floor" is because is not find -lm on extra option row ... And I think same for -lmodbus and -L/usr/include/lib/modbus.....
I need some help for define the problem ...
Actually in linuxcnc-dev/lib there are normal link after install + symlink of libmodbus.so, all other lib is on usual dir or normal ubuntu installation ....
the comp:
(if this is not the right place to ask these question please advice me or change the folder of question).
Regards
Giorgio
Please Log in or Create an account to join the conversation.
/tmp/tmp_RtXP2/k1MbServer.comp:210: undefined reference "floor"
/tmp/tmp_RtXP2/k1MbServer.comp:216: undefined reference "floor"
I would have expected halcompile to automatically add a reference to rtapi_math
github.com/LinuxCNC/linuxcnc/blob/master/src/rtapi/rtapi_math.h
And that contains the "floor" function.
If you try halcompile without the --compile switch (and are you sure you don't want --install ? ) to view the generated C-code and check that that includes the rtapi_math.h #include.
Please Log in or Create an account to join the conversation.
andypugh wrote: without the --compile switch (and are you sure you don't want --install ? )
obviusly later I install but now would try to solve these problem... out of --compile & --install is the same... so now I have .c file..... whats is mean "count= and names= are mutually exclusive".... Is not possible names variables in these way: ja1?...
I'm not familiar with rtai.c file ... so I not see anything ... see only these it sounds to me suspiciously ...:
static int default_count=1, count=0;
char *names[16] = {0,};
int rtapi_app_main(void) {
int r = 0;
int i;
comp_id = hal_init("konembserver");
if(comp_id < 0) return comp_id;
if(count && names[0]) {
rtapi_print_msg(RTAPI_MSG_ERR,"count= and names= are mutually exclusive\n");
return -EINVAL;
}
if(!count && !names[0]) count = default_count;
if(count) {
for(i=0; i<count; i++) {
char buf[HAL_NAME_LEN + 1];
rtapi_snprintf(buf, sizeof(buf), "konembserver.%d", i);
r = export(buf, i);
if(r != 0) break;
}
} else {
int max_names = sizeof(names)/sizeof(names[0]);
for(i=0; (i < max_names) && names[i]; i++) {
if (strlen(names[i]) < 1) {
rtapi_print_msg(RTAPI_MSG_ERR, "names[%d] is invalid (empty string)\n", i);
r = -EINVAL;
break;
}
r = export(names[i], i);
if(r != 0) break;
}
}
if(r) {
hal_exit(comp_id);
} else {
hal_ready(comp_id);
}
return r;
}
konembserver-with-singleton-no.c file
konembserver-with-singleton-yes.c file
regards
Giorgio
Please Log in or Create an account to join the conversation.
You can't have:
loadrt mycomp count=3 names=names1,names2,names3,names4
You have neither, so it won't matter.
Please Log in or Create an account to join the conversation.
![:laugh: :laugh:](/media/kunena/emoticons/laughing.png)
regards
Giorgio
Please Log in or Create an account to join the conversation.
other things ....
option extra_link_args "…" - (default: "") This option is ignored if the option userspace (see above) is set to no. When linking a userspace component, the arguments given are inserted in the link line. Note that because compilation takes place in a temporary directory, "-L." refers to the temporary directory and not the directory where the .comp source file resides.
so:
gcc -Os -g -I. -I/home/k1/linuxcnc-dev/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/home/k1/linuxcnc-dev/include -Wframe-larger-than=2560 -DSIM -fPIC -URTAPI -U__MODULE__ -DULAPI -Os -lm -ldl -L/usr/local/include/modbus -lmodbus -o K1MbServer /tmp/tmp0wIaJv/konembserver.c -Wl,-rpath,/home/k1/linuxcnc-dev/lib -L/home/k1/linuxcnc-dev/lib -llinuxcnchal
/*********** -lm -ldl -L/usr/local/include/modbus -lmodbus*************/
the commented row .. the link is search in /tmp/.... or in the right place on /usr/include...???
Regards
giorgio
I "virtually" joint the post
![:laugh: :laugh:](/media/kunena/emoticons/laughing.png)
regards
giorgio
Please Log in or Create an account to join the conversation.
(option userpspace yes )
It seems that a bug with halcompile means that userpsace and singleton don't work well together, but you can probably work round that.
I am afraid that I don't know the meaning of any of the compiler switches.
Please Log in or Create an account to join the conversation.
names & count error when compile with singleton
Is possible to add declaration of names and count variable ... I add global as long unsigned int for count and int for names ... the error disappear ....
For libmodbus and math .... i'm working around
regards
giorgio
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I have bad understand the doc? If I need mycomp.idle for example I need option singleton yes... or I'm in wrong?
Please make your correction ... I'm confused on the arguments...
UPDATE:
option singleton yes - (default: no) Do not create a count module parameter, and always create a single instance. With singleton, items are named component-name.item-name and without singleton, items for numbered instances are named component-name.<num>.item-name.
I understand if option singleton yes => mycomp.idle is possible...whitout mycomp.0.idle ... I understand well?
![:ohmy: :ohmy:](/media/kunena/emoticons/shocked.png)
regards
Giorgio
Please Log in or Create an account to join the conversation.