danfis / libccd

Library for collision detection between two convex shapes
Other
478 stars 108 forks source link

Installation Crashing from executing make #48

Closed josiahls closed 5 years ago

josiahls commented 5 years ago

Hi,

I am getting the following error:

cd src/
make 

cc -Wall -pedantic --std=gnu99 -I. -fvisibility=hidden  -c -o ccd.o ccd.c
In file included from ./ccd/ccd.h:21:0,
                 from ccd.c:20:
./ccd/vec3.h:35:4: error: #error You must define CCD_SINGLE or CCD_DOUBLE
 #  error You must define CCD_SINGLE or CCD_DOUBLE
    ^
./ccd/vec3.h:89:5: error: unknown type name ‘ccd_real_t’
     ccd_real_t v[3];
     ^
./ccd/vec3.h:106:25: error: unknown type name ‘ccd_real_t’
 _ccd_inline int ccdSign(ccd_real_t val);

... # More errors

ccd.c:133:12: warning: ‘penEPAPos’ defined but not used [-Wunused-function]
 static int penEPAPos(const ccd_pt_t *pt, const ccd_pt_el_t *nearest,
            ^
Makefile:37: recipe for target 'ccd.o' failed
make: *** [ccd.o] Error 1

Why is this happening? I am looking at whether the headers are being used but I am not familier with Makefile syntax enough to debug this. The thing is,for example: 'unknown type name ‘ccd_real_t’' should not be happening since ccd/vec3.h defines that type.

I think it has to do with the first line: # error You must define CCD_SINGLE or CCD_DOUBLE but aren't these supposed to have defaults???? I tried make USE_SINGLE=yes but nothing changed. I am not sure where CCD_SINGLE is supposed to be defined.

This was from the git clone https://github.com/danfis/libccd.git file.

ChenHancheng commented 5 years ago

I come into the same question. Have you solved it?

josiahls commented 5 years ago

I don't think I ever did. I was using this with ROS - Kinetic and the fetch_ros library ob Ubuntu 16.04.

I have shifted to ROS - Melodic, Ubuntu 18.04, and the Melodic branch of the fetch_ros library. If I run into this issue again, I think I will try to solve it myself and update this thread if no one else finds a solution. I am hoping upgrading lib versions with help me avoid this.

ChenHancheng commented 5 years ago

Hi, maybe you can try to modify the file ../src/ccd/congfig.h by yourself. I modify this file's content as follows and it works.

ifndef CCD_CONFIG_H

define CCD_CONFIG_H

define CCD_SINGLE

endif / CCD_CONFIG_H /

danfis commented 5 years ago

Calling make in src/ works for me. Are you sure you are including the full output of the make command? The first line of output should be something like "m4 -DUSE_DOUBLE ccd/config.h.m4 >ccd/config.h".

abhileshborode commented 5 years ago

@danfis could you please elaborate your solution ?...since I am facing the same error..

danfis commented 5 years ago

I think that the solution here is to install m4 preprocessor. The reason I was asking whether @josiahls included the whole output was that ccd/config.h is a file generated by m4 from ccd/config.h.m4. So if you don't have installed m4, then the first error line of make should be something like "m4: command not found". Problem is that if you run make repeatedly without reading the output, this error disappears because ccd/config.h is generated empty the first time make is run.

So I'm closing this issue. If the problem is somewhere else, please reopen it again and include the command line output right after cloning (or cleaning with git clean -fdx) the repository.

liangyuwei commented 3 years ago

The solution works for me:

  1. Install m4 first by sudo apt install -y m4;
  2. Then execute m4 -DUSE_DOUBLE ccd/config.h.m4 >ccd/config.h under src/ folder;
  3. And finally call make and make install following the instructions in README.md.