Open johannphilippe opened 5 years ago
Welcome, and sorry you're having issues with Terra!
First off, did you install Terra from a binary or from source? What Terra version? Which LLVM did you use? Can you include the full value of the terralib.includepath
you're setting, particularly the part for the C standard library?
I'm a little surprised that it's possible to have a redeclaration issue with math.h
. Most headers are protected to avoid this. Could it be that the library in question is redeclaring something?
You can double check that redeclaration is an issue with something like:
terralib.includecstring([[
#include "math.h"
#include "math.h"
]])
If that has an issue, then we'll have to figure out what to do with that. Otherwise it could be something in the library.
The other thing I wonder, since it seems like you're setting the C standard library path explicitly, is whether we're getting the wrong C standard library somehow. Do you by any chance have multiple Visual Studio versions installed? Or Msys, or Cygwin, or anything else that might have its own copy of the standard library?
Thanks.
Thank you for the answer. I took the Terra binary for windows (last release i found - 2016). The full path i write is : terralib.includepath="C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/include;C:/Program Files/Csound6_x64/include"
I actually run the test you adviced, and in fact it wasn't the redeclaration, because even if i include math.h once, the error occurs. Even for the c standard library, i write the full path because if i don't, terra doesn't seem to find any c standard library. But if i include the path, the C standard lib (like stdio.h for example) is working fine. And, for visual studio, i only find one version, but yes, i have Msys and Cygwin installed (i also tried with including the path of msys library instead of visual studio, and some other errors occurs, but it's also working for simple test like stdio.h). Is it a problem ? Even if i include the full path ?
After those tests - I guess the significant part of the error message is the following one : C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/include\math.h:464:55: note: 'cabs' is a builtin with type 'double (_Complex double)'
But i don't really understand what "cabs" is refering to... Maybe i should try to reconfigure all the C libraries installed on my computer ? And Then, what C standard library would you recommand ?
Thanks for helping. Regards. Johann
After a few hours, and reinstalling all the new Visual Studio C extensions i could make it work. The Csound C Api is responding perfectly fine here. Still, i had to include three different path to make it work : the csound path (perfectly normal), the C standard library path (also quite normal) and another path (to vcruntime.h, which was one of the many headers called from stdio.h). Recent versions of Visual Studio do split some headers (like vcruntime) in a different place, so, as long as it's required by the standard library, it need to be included too. It's quite a long "includepath" but it's working well !
Thank you, again, for this beautiful work. I really enjoy learning the way it works.
I'm glad you were able to get it resolved.
I believe that the path issues would go away if you were to compile LLVM and Terra from source. My understanding is that the standard library paths get baked into Clang by some sort of auto-detect logic at build time, and it's not smart enough to detect them if it moves to a system that's too different from the one where it was built (Visual Studio version differences being the most likely culprit).
However, I'll warn you now that we don't have a good grip on Windows builds in general, so it is likely that you would have issues building. As you can see from our CI, the only setup that is confirmed to work is VS 2013 with LLVM 3.5:
https://github.com/zdevito/terra/blob/master/appveyor.yml
In general we're run completely by volunteers, so unless someone steps up to fix this it's unlikely to change any time soon. If this is something you'd be interested in, I'll try to help to the extent that I can, but I don't currently have a Windows dev environment to test on. No pressure either way, of course; we're happy that you're just using the language. :smile:
For now it's working fine for me, using the Terra functions to extend the includepath. But yes, i guess it could be great to build a recent windows version.
If I can find any time, i'll give a try. I'm not really aware of build methods, but maybe i'll find something ! The point is to compile both Terra and Llvm at the same time with Clang right ?
Also, about building Terra for windows, i'm reading the "README" in msvc folder. Is it only available with Luajit 2.0.3 ? Or can i try with 2.0.5 ?
Any version of LuaJIT should be fine, it may just be that you might need to update some paths, or something like that.
LLVM versions are more problematic; e.g. I haven't been able to get AppVeyor working with LLVM 3.8.
I've also got some LLVM binaries that I built with AppVeyor here:
https://github.com/elliottslaughter/llvm-package-windows/releases
However, note that the LLVM 3.8 here is the same one that's not working for building Terra, so it's entirely possible I'm doing something wrong!
Hello,
I'm a new user of Terra. First of all, thank you for this wonderful possibilities.
I already could run the tests of Terra, which, after a few corrections for my configurations, run well !
I'm currently trying to use the Csound API with Terra (CSOUND is a programming library/software for sound/music).
So i'm defining the path, and including libraries as following :
"terralib.includepath="my standard C path ; my csound path"
csound = terralib.includec("csound.h")"
The return error is :
In file included from:1:
In file included from C:/Program Files/Csound6_x64/include/csound\csound.h:312:
In file included from C:/Program Files/Csound6_x64/include/csound/sysdep.h:177:
C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/include\math.h:464:55: warning: incompatible redeclaration of library function 'cabs'
_CRT_NONSTDC_DEPRECATE(_cabs) _CRTIMP double __cdecl cabs(In struct _complex _X);
^
C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/include\math.h:464:55: note: 'cabs' is a builtin with type 'double (_Complex double)'
After a few tests, i can only say that csound.h needs the stdio.h library, which is calling a few other libraries (like math.h) who are in both includepath (the csound path and the C standard path). So, i'm quite sure that the second call of the math.h library is causing issue.
Is there any way to avoid that "redeclaration" .
Thanks in advance Johann Philippe