HalView - view HAL pin values externally in C++

More
18 Aug 2014 21:38 - 18 Aug 2014 22:16 #49998 by ArcEye

The error is that it cannot find the header file. I did an export to include the location in the path.


Where did you export it?

$PATH is only used for binaries, ie executable programs

You need to export LDFLAGS for libraries and either CFLAGS or CPPFLAGS for includes (see which one the Makefile uses)

Easiest way is to put them in your ~/.bash.rc file

regards

PS
As you are using Qt, you could put it in the INCLUDEPATH string in the halview.pro file, then remake the Makefile with qmake -makefile from the dir with the pro file in it
Last Edit: 18 Aug 2014 22:16 by ArcEye.
More
18 Aug 2014 22:29 #50000 by mariusl
Hi Mick
Halview did actually build correctly it is the component redisclient.comp that is give me crap.

In a terminal I did the export and I did the rip-environment. Then used comp to compile the comp.
More
18 Aug 2014 22:57 #50001 by ArcEye

In a terminal I did the export and I did the rip-environment. Then used comp to compile the comp.


You can export the same way with CFLAGS or just copy hiredis.h into one of the include dirs that are in the include path, probably simpler
(or even put a copy in the directory with the comp file, the first place it looks is I.)
More
18 Aug 2014 23:11 #50002 by mariusl
Even if I put the component in the hiredis directory. Comp still cannot find it.
More
18 Aug 2014 23:24 - 18 Aug 2014 23:54 #50004 by ArcEye
The repo has now moved to github.com/redis/hiredis.git

Looking at the Makefile, by default it installs to /usr/local/include/hiredis and /usr/local/lib

Those are not in your gcc line and you will hit problems with linking even after you get it to compile, if you have not set them.

Try running a cut and paste of this from the commandline, does that find the header and lib?

gcc -Os -g -I. -I/usr/realtime-2.6.32-122-rtai/include -I/usr/local/include/hiredis -D_FORTIFY_SOURCE=0 -mhard-float -DRTAI=3 -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/home/marius/dev/linuxcnc-dev/include -Wframe-larger-than=2560 -URTAPI -U__MODULE__ -DULAPI -Os -o redisclient /tmp/tmpRfXK3r/redisclient.c -Wl,-rpath,/home/marius/dev/linuxcnc-dev/lib -L/usr/local/lib -L/home/marius/dev/linuxcnc-dev/lib -llinuxcnchal -lhiredis

EDIT

Forgot you have to produce a c file first with comp

comp redisclient.comp will produce redisclient.c

Assuming the other stuff in your gcc line was right, this should build the binary

color=#0000ff]gcc -Os -g -I. -I/usr/realtime-2.6.32-122-rtai/include -I/usr/local/include/hiredis -D_FORTIFY_SOURCE=0 -mhard-float -DRTAI=3 -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/home/marius/dev/linuxcnc-dev/include -Wframe-larger-than=2560 -URTAPI -U__MODULE__ -DULAPI -Os -o redisclient redisclient.c -Wl,-rpath,/home/marius/dev/linuxcnc-dev/lib -L/usr/local/lib -L/home/marius/dev/linuxcnc-dev/lib -llinuxcnchal -lhiredis[/color]
Last Edit: 18 Aug 2014 23:54 by ArcEye.
More
18 Aug 2014 23:52 #50006 by mariusl
It says no such file
marius@cnc-dev:~/programs/halview$ gcc -Os -g -I. -I/usr/realtime-2.6.32-122-rtai/include -I/usr/local/include/hiredis -D_FORTIFY_SOURCE=0 -mhard-float -DRTAI=3 -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/home/marius/dev/linuxcnc-dev/include -Wframe-larger-than=2560 -URTAPI -U__MODULE__ -DULAPI -Os -o redisclient /tmp/tmpRfXK3r/redisclient.c -Wl,-rpath,/home/marius/dev/linuxcnc-dev/lib -L/usr/local/lib -L/home/marius/dev/linuxcnc-dev/lib -llinuxcnchal -lhiredis
gcc: /tmp/tmpRfXK3r/redisclient.c: No such file or directory
marius@cnc-dev:~/programs/halview$ 
More
18 Aug 2014 23:54 - 18 Aug 2014 23:56 #50007 by ArcEye
Yeah I posted as you did

EDIT

Forgot you have to produce a c file first with comp

comp redisclient.comp will produce redisclient.c

Assuming the other stuff in your gcc line was right, this should build the binary (in the same dir that redisclient.c is)

gcc -Os -g -I. -I/usr/realtime-2.6.32-122-rtai/include -I/usr/local/include/hiredis -D_FORTIFY_SOURCE=0 -mhard-float -DRTAI=3 -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/home/marius/dev/linuxcnc-dev/include -Wframe-larger-than=2560 -URTAPI -U__MODULE__ -DULAPI -Os -o redisclient redisclient.c -Wl,-rpath,/home/marius/dev/linuxcnc-dev/lib -L/usr/local/lib -L/home/marius/dev/linuxcnc-dev/lib -llinuxcnchal -lhiredis
Last Edit: 18 Aug 2014 23:56 by ArcEye.
More
18 Aug 2014 23:56 #50008 by mariusl
this is where the file is located
marius@cnc-dev:/$ sudo find | grep hiredis.h
[sudo] password for marius: 
./home/marius/programs/redis/redis-2.8.13/deps/hiredis/hiredis.c
./home/marius/programs/redis/redis-2.8.13/deps/hiredis/hiredis.o
./home/marius/programs/redis/redis-2.8.13/deps/hiredis/hiredis.h
./home/marius/programs/hiredis-master/hiredis.h
./home/marius/programs/halview/hiredis.h
./usr/local/include/hiredis/hiredis.h
marius@cnc-dev:/$ 
More
18 Aug 2014 23:58 #50009 by ArcEye
The error was because it could not find redisclient.c

With the Include and Lib dirs specified and redisclient.c created, it should build
More
19 Aug 2014 00:00 #50010 by mariusl
No error but no output either. The redisclient.c is there but that line did nothing.
Time to create page: 0.183 seconds
Powered by Kunena Forum