lwt icon indicating copy to clipboard operation
lwt copied to clipboard

`src/unix/config/discover.exe` puts too much `-I` includes which can mislead the compiler

Open dinosaure opened this issue 2 years ago • 0 comments

I try to cross-compile lwt.unix with another toolchain than the basic one and it seems that discover.exe puts, by default, some -I (like /usr/include) which can mislead the C compiler about where is the real - in my case - pthread library. I think the first initial behavior should be to try to compile a program with pthread without extra options and only with:

$ cc test.c -o test.exe -lpthread

Indeed, the C compiler used can, internally, includes some paths required for such libraries. Behind the scene and specially about a cross-compiler, these includes are definitely different than the usual /usr/include/ but a clash takes place between the host's pthread definition and the one provided by the cross-toolchain if 1) we systematically put -I/usr/include and 2) the cross-compiler puts internally some -I.

I will try to propose a PR which try such path before others to be able to cross-compile lwt.unix.

dinosaure avatar May 17 '22 10:05 dinosaure