halcopile problem / new ubunu 14.04 installation

More
30 Nov 2016 17:07 #83494 by andypugh
I think for a non-singleton you will get comp_pin.0.idle rather than comp-pin.idle.

Editing the generated C might not be the best solution, though I am not sure that there is another, other than perhaps editing halcompile....
The following user(s) said Thank You: bkt

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

More
30 Nov 2016 17:09 #83495 by andypugh
You might want to look at the "include" command that is available before the ;; rather than using #include after the ;;

(It isn't documented, but it works). That might get round the library (math and modbus) problems.
The following user(s) said Thank You: bkt

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

More
30 Nov 2016 17:13 #83496 by bkt
Ok so option singleton yes is right.....

I've just edit halcompile ... but is a little bit different from old one ..... I can work around but now I need to make the delta go do I really need these ...

But if there are nothings else to do ...

regards
giorgio

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

More
30 Nov 2016 17:32 - 30 Nov 2016 17:33 #83498 by bkt

You might want to look at the "include" command that is available before the ;; rather than using #include after the ;;

(It isn't documented, but it works). That might get round the library (math and modbus) problems.


the code:
option singleton yes;             
option userspace yes;
option extra_compile_args "-lm -ldl -I/usr/local/include/modbus -L/usr/local/lib -lmodbus";


author "giorgiofoga <-> k-1";
license "GPL";


include <stdio.h>    
include <stdlib.h> 
include <stdint.h>   
include <string.h>  
include <fcntl.h>    
include <errno.h>    
include <signal.h>
include <modbus/modbus.h>
include <math.h>
include <assert.h>

;;

the error:
/linuxcnc-dev$ halcompile --install k1MbServer.comp
k1MbServer.comp:113:1: Trying to find one of ";"
>  include <stdlib.h> 
>  ^
while parsing Declaration():
>  include <stdio.h>    
>         ^
while parsing File():
>  include <stdio.h>    
>         ^
Last edit: 30 Nov 2016 17:33 by bkt.

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

More
30 Nov 2016 17:58 #83500 by bkt
Ok I try better ....
option singleton yes;             
option userspace yes;
option extra_compile_args "-lm -ldl -I/usr/local/include/modbus -L/usr/local/lib -lmodbus";


author "giorgiofoga <-> k-1";
license "GPL";


include "stdio.h"  ;  
include "stdlib.h";
include "stdint.h" ;
include "string.h" ;
include "fcntl.h"  ; 
include "errno.h"  ;
include "signal.h";
include "modbus/modbus.h";
include "math.h";
include "assert.h";

;;

halcompile k1MbServer.comp and I edited the result.c file adding these...
/* Autogenerated by /home/k1/linuxcnc-dev/bin/halcompile on Wed Nov 30 18:49:35 2016 -- do not edit */
#include "rtapi.h"
#ifdef RTAPI
#include "rtapi_app.h"
#endif
#include "rtapi_string.h"
#include "rtapi_errno.h"
#include "hal.h"
#include "rtapi_math64.h"

char *names[256]={0}; /*my change for delete __comp__ error*/
long unsigned int count=0; /*my change for delete __comp__ error*/

static int comp_id;

#include "stdio.h" /*I try to modify to <stdio.h> etc etc... the same*/
#include "stdlib.h"
#include "stdint.h"
#include "string.h"
#include "fcntl.h"
#include "errno.h"
#include "signal.h"
#include "modbus/modbus.h"
#include "math.h"
#include "assert.h"
#ifdef MODULE_INFO
/linuxcnc-dev$ halcompile --install --userspace k1MbServer.c
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  -o k1MbServer /tmp/tmp_y_Efy/k1MbServer.c -Wl,-rpath,/home/k1/linuxcnc-dev/lib -L/home/k1/linuxcnc-dev/lib -llinuxcnchal 
/tmp/ccuKRTqW.o: nella funzione "Rcf":
/tmp/tmp_y_Efy/k1MbServer.comp:178: undefined reference to "modbus_get_float"
/tmp/ccuKRTqW.o: nella funzione "SdFloat":
/tmp/tmp_y_Efy/k1MbServer.comp:185: undefined reference to "modbus_set_float"
/tmp/ccuKRTqW.o: nella funzione "user_mainloop":
/tmp/tmp_y_Efy/k1MbServer.comp:210: undefined reference to "floor"
/tmp/tmp_y_Efy/k1MbServer.comp:216: undefined reference to "floor"
/tmp/tmp_y_Efy/k1MbServer.comp:217: undefined reference to "floor"
/tmp/tmp_y_Efy/k1MbServer.comp:218: undefined reference to "floor"
/tmp/tmp_y_Efy/k1MbServer.comp:219: undefined reference to "floor"
/tmp/tmp_y_Efy/k1MbServer.comp:236: undefined reference to "modbus_new_tcp"
/tmp/tmp_y_Efy/k1MbServer.comp:238: undefined reference to "modbus_get_header_length"
/tmp/tmp_y_Efy/k1MbServer.comp:240: undefined reference to "modbus_set_debug"
/tmp/tmp_y_Efy/k1MbServer.comp:242: undefined reference to "modbus_mapping_new"
/tmp/tmp_y_Efy/k1MbServer.comp:247: undefined reference to "modbus_free"
/tmp/tmp_y_Efy/k1MbServer.comp:263: undefined reference to "modbus_tcp_listen"
/tmp/tmp_y_Efy/k1MbServer.comp:264: undefined reference to "modbus_tcp_accept"
/tmp/tmp_y_Efy/k1MbServer.comp:406: undefined reference to "modbus_receive"
/tmp/tmp_y_Efy/k1MbServer.comp:417: undefined reference to "modbus_reply"
/tmp/tmp_y_Efy/k1MbServer.comp:440: undefined reference to "modbus_mapping_free"
/tmp/tmp_y_Efy/k1MbServer.comp:442: undefined reference to "modbus_close"
/tmp/tmp_y_Efy/k1MbServer.comp:443: undefined reference to "modbus_free"
collect2: error: ld returned 1 exit status
make: *** [k1MbServer] Errore 1

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

More
30 Nov 2016 18:02 - 30 Nov 2016 18:03 #83501 by bkt
azz ... now I have to turn it off and run away .... but I know that count must be 1 instead of 0 ...

regards
giorgio
Last edit: 30 Nov 2016 18:03 by bkt.

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

More
30 Nov 2016 18:32 #83502 by andypugh
try #include "rtapi_math.h"
The following user(s) said Thank You: bkt

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

More
01 Dec 2016 08:13 #83514 by bkt

try #include "rtapi_math.h"


#include rtapi_math.h + count=1..... same error

regards
giorgio

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

More
01 Dec 2016 10:39 - 01 Dec 2016 10:39 #83516 by bkt
This is the difference from the old one to new one halcompile ..... and there are some row referred ios SO ... but not find other about .... this can explain count e names error ... but not -lmodbus error and -lm error ....
print >>f, """ /*******************************************************/
int __comp_parse_count(int *argc, char **argv) {
    int i;
    for (i = 0; i < *argc; i ++) {
        if (strncmp(argv[i], "count=", 6) == 0) {
            errno = 0;
            count = strtoul(&argv[i][6], NULL, 0);
            for (; i+1 < *argc; i ++) {
                argv[i] = argv[i+1];
            }
            argv[i] = NULL;
            (*argc)--;
            if (errno == 0) {
                return 1;
            }
        }
    }
    return 0;
}
"""
        print >>f, """
int __comp_parse_names(int *argc, char **argv) {
    int i;
    for (i = 0; i < *argc; i ++) {
        if (strncmp(argv[i], "names=", 6) == 0) {
            char *p = &argv[i][6];
            int j;
            for (; i+1 < *argc; i ++) {
                argv[i] = argv[i+1];
            }
            argv[i] = NULL;
            (*argc)--;
            for (j = 0; j < 16; j ++) {
                names[j] = strtok(p, ",");
                p = NULL;
                if (names[j] == NULL) {
                    return 1;
                }
            }
            return 1;
        }
    }
    return 0;
}
"""

regards
giorgio
Last edit: 01 Dec 2016 10:39 by bkt.

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

More
01 Dec 2016 11:21 - 01 Dec 2016 11:24 #83517 by bkt
bug on halcompile there is .... ok but is not about linking lib ..... so in orther to solve the problem libmodbus and math, i try to make a built package and than install.... at that point I should have a LCNC installation for a normal user .... so I should also eliminate confusion between the path that we might be ....

in orther to try to do these:
1- cancel my linuxcnc-dev folder .... reboot
2-git clone git://git.linuxcnc.org/git/linuxcnc.git linuxcnc-dev
3-cd linuxcnc-dev/debian
4-./configure uspace rtai ( or only ./configure uspace ... because I've rt-preempt)
5-cd ..
6-dpkg-checkbuilddeps
7-cd debian
8-dpkg-buildpackage -b -uc

at these point I have a normal .deb package and istall it ....

Someone can confirm these step please??

regards
giorgio
Last edit: 01 Dec 2016 11:24 by bkt.

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

Time to create page: 0.238 seconds
Powered by Kunena Forum