I use my own build tool in cdt eclipse. It builds the target files and writes some build information to the console window.
For the indexer I only enables the cdt gcc Output parser, and my expectations is that all the information for the include path and dependencies are getting from the build output.
Unfortunately the parser seems not to work correctly. It could not resolve the dependencies. I tried several times to rebuild the indexer
I tried it with the default Compiler command pattern: *(g?cc)|([gc]++)|(clang)
and for example I simplified log line to compile a single c-file is as follows:
INFO :: Command C:\target-gcc.exe -c- -IC:\Include1 -IC:\Include2.. C:\Projects\test.c -o C:\Projects\test.o
Using the the CDT GCC Build in Compiler Settings MinGw in principle works, but then I have some addtional errors in the Problems windows which I want to avoid.
Related
I was reading a previous stack overflow question about setting up ant tasks for scalac:
FSC recompiles every time
The weird thing is when I test the -dependencyfile option, I find no dependency file generated anywhere. I am testing this with ubuntu's scalac 2.9.1 and also with the official 2.10.2 jar in ant tasks. It seems the command-line utility and the ant task both take my input without complaining anything (they are grammatically correct?) though.
Am I using this feature in the wrong way?
E.g. from command-line:
scalac -dependencyfile scala_dependencies *.scala
from an ant tasks
<!-- inside a macro definition -->
<scalac destdir="#{destdir}" deprecation="yes"
force="yes" dependencyfile="scala_dependencies"
addparams="#{addparams}"
scalacdebugging="true">
<!-- src, classpath, patternset and etc -->
</scalac>
updates:
I added -make:transitive options to comand-line it does generate a file for me but I ran it for the second time, scalac simply crashed.
$ scalac -make:transitive -dependencyfile scala_dependencies *.scala
Recompiling 2 files
warning: there were 1 deprecation warnings; re-run with -deprecation for details
error: java.lang.NullPointerException
at scala.tools.nsc.io.Path$.apply(Path.scala:73)
at scala.tools.nsc.dependencies.DependencyAnalysis$$anonfun$saveDependencyAnalysis$1.apply(DependencyAnalysis.scala:33)
at scala.tools.nsc.dependencies.DependencyAnalysis$$anonfun$saveDependencyAnalysis$1.apply(DependencyAnalysis.scala:33)
at scala.tools.nsc.dependencies.Files$FileDependencies$$anonfun$emit$1$2$$anonfun$apply$6.apply(Files.scala:96)
at scala.tools.nsc.dependencies.Files$FileDependencies$$anonfun$emit$1$2$$anonfun$apply$6.apply(Files.scala:96)
at scala.collection.mutable.HashSet.foreach(HashSet.scala:72)
at scala.tools.nsc.dependencies.Files$FileDependencies$$anonfun$emit$1$2.apply(Files.scala:96)
at scala.tools.nsc.dependencies.Files$FileDependencies$$anonfun$emit$1$2.apply(Files.scala:96)
at scala.collection.mutable.OpenHashMap$$anonfun$foreach$1.apply(OpenHashMap.scala:221)
at scala.collection.mutable.OpenHashMap$$anonfun$foreach$1.apply(OpenHashMap.scala:219)
at scala.collection.mutable.OpenHashMap$$anonfun$foreachUndeletedEntry$1.apply(OpenHashMap.scala:226)
at scala.collection.mutable.OpenHashMap$$anonfun$foreachUndeletedEntry$1.apply(OpenHashMap.scala:226)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:34)
at scala.collection.mutable.ArrayOps.foreach(ArrayOps.scala:38)
at scala.collection.mutable.OpenHashMap.foreachUndeletedEntry(OpenHashMap.scala:226)
at scala.collection.mutable.OpenHashMap.foreach(OpenHashMap.scala:219)
at scala.tools.nsc.dependencies.Files$FileDependencies.emit$1(Files.scala:96)
at scala.tools.nsc.dependencies.Files$FileDependencies.writeTo(Files.sca
la:103)
at scala.tools.nsc.dependencies.Files$FileDependencies$$anonfun$writeTo$1.apply(Files.scala:92)
at scala.tools.nsc.dependencies.Files$FileDependencies$$anonfun$writeTo$1.apply(Files.scala:92)
at scala.tools.nsc.dependencies.Files$class.writeToFile(Files.scala:163)
at scala.tools.nsc.Global$dependencyAnalysis$.writeToFile(Global.scala:498)
at scala.tools.nsc.dependencies.Files$FileDependencies.writeTo(Files.scala:92)
at scala.tools.nsc.dependencies.DependencyAnalysis$class.saveDependencies(DependencyAnalysis.scala:87)
at scala.tools.nsc.Global$dependencyAnalysis$.saveDependencies(Global.scala:498)
at scala.tools.nsc.dependencies.DependencyAnalysis$class.saveDependencyAnalysis(DependencyAnalysis.scala:32)
at scala.tools.nsc.Global$dependencyAnalysis$.saveDependencyAnalysis(Global.scala:498)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1022)
at scala.tools.nsc.Global$Run.compile(Global.scala:1038)
at scala.tools.nsc.Main$.process(Main.scala:106)
at scala.tools.nsc.Main$.main(Main.scala:123)
at scala.tools.nsc.Main.main(Main.scala)
for 2.10.2, the compiler complains:
warning: -make is deprecated: this option is unmaintained. Use sbt or an IDE for selective recompilation.
and I still can't find the generate file
I have a small project in Nvidia's Nsight, which creates the makefiles for me. I want to use some SSE instructions and would like to compile cpp-files in the project with gcc instead of nvcc.
Is there a way to configure Nsight to do that or do I have to write the Makefile manually?
EDIT: .cu file should be compiled with nvcc of course.
You should be able to use GCC SSE instructions in the CU files - NVCC compiles all the host code with your platform compiler.
If you still would like to use GCC, you have two options:
Create two projects - one is a static library project compiled with NVCC and another a regular executable project compiled with GCC. Then you can setup Nsight to link the executable with your library. (You may also use NVCC for executable and GCC for the library)
As #Eric mentioned, you can create a "Makefile Project" and write the makefile by hand.
To use gcc in Nsight, you have to create makefile project and write the makefile by hand.
Alternatively, uou could use nvcc to compile your .cpp/.c file. To add extra compiler options which do not recognized by nvcc (only recognized by gcc), the nvcc option -Xcompiler should be prefixed.
One of the side-effects using nvcc is that your .cpp program will require libcudart.so to run, even it does not really need that.
I have a program, written in fortran90, previously successfully compiled on a compaq compiler and working, that I'm now trying to compile with gfortran. I can compile the code to an .exe and run it. It works fine until a certain point in the routine and then an error is thrown.
My current configuration:
Windows 7
Eclipse Juno with CDT
Photran
Cygwin installation with gfortran compiler and GDB debugger (gdb.exe)
Configurations for the debugger:
GDB command set: Standard (Windows)
Protocol: mi
Shared libraries: don't load shared library symbols automatically (when activating this, no changes are noted).
When running the debug command I get the following output:
.gdbinit: No such file or directory.
Reading symbols from /cygdrive/c/Users/thys/Documents/doctoraat/12_in progress/Hamfem/Debug/Hamfem.exe...done.
auto-solib-add on
Undefined command: "auto-solib-add". Try "help".
Warning: C:/Users/thys/Documents/doctoraat/12_in progress/Hamfem/Hamfem/in: No such file or directory.
[New Thread 5816.0x1914]
[New Thread 5816.0x654]
Basicly that leaves me with 2 questions:
Where can I find the .gdbinit file in the cygwin installation?
Are there any other possible errors in my setup, or points to think about?
Did you add the debugging information when compiling? When using gdb in console it shouldn't be a problem, except looking at memory addresses and a lot of gibberish, but there could be complications from using Eclipse...
(sorry for my bad english...)
I'm trying to build my .so library in Eclipse, with the CDT plugin. (It's an android project, with native code...)
I changed the build command [Project->Properties->C/C++ build] to suit my needs:
C:\SDK\android-ndk-r8\ndk-build.cmd
But I got this message in the console:
C:\SDK\android-ndk-r8\ndk-build.cmd
Cannot run program "C:\SDK\android-ndk-r8\ndk-build.cmd": Le fichier spécifié est introuvable.
Error: Program "C:/SDK/android-ndk-r8/ndk-build.cmd" is not found in PATH
I tried with only "ndk-build.cmd" in the eclipse's build command, and the path to this command in my PATH environment variable, but I still have the same error. In fact, I can't execute any program from the eclipse's build command.
I have no problem to build the library when I call ndk-build.cmd in cmd.exe, but when I try to automate the library's build in Eclipse, it doesn't work...
Does anyone have a solution to my problem?
Go to your project Properties -> C/C++ Build -> Environment. Click Add... and set name as PATH, value as your NDK_ROOT, I met the same problem and slove with it
I tried to compile Scala^Z3 on Win XP using Cygwin and JDK 1.7.0 but it didn't work out as expected.
I did the following:
- Use SBT 0.7.4
- Use current Scala^Z3 revision from github
- Use Cygwin and its gcc
- Use JDK 1.7.0 (javac)
"sbt update" was successfull.
"sbt package" end up in several errors stating undefined references like the following:
\psuter-ScalaZ3-35cb691\src\c/z3_Z3Wrapper.c:10: undefined reference to `_Z3_mk_config'
In order to make it work at all I changed ....\PSuterScalaZ3\psuter-ScalaZ3-35cb691\project\build\scalaz3.scala line 74 to:
lazy val gcc : ManagedTask = if(isUnix || is32bit) {
On the homepage it is stated that it should work for Windows, too. Does it at all?
Is there a precompiled jar available?
I saw a z3.jar here: http://lara.epfl.ch/~psuter/jniz3/z3.jar
This is a Linux Version too, I guess? Because it didn't work for me either...
Scala^Z3 is a really good piece of code (if i can get it to work ;))
Sorry about that, the sbt script indeed currently only works for Linux (and as you can tell by the absolute path, we're not quite used to having external users yet).
Here are the steps I use to compile it under Windows:
compile all Java sources with javac (there are no dependencies)
generate the header files using javah
compile all the Scala sources with scalac (using only the Java .class files as dependencies)
compile the .c + .h files with Visual Studio
manually create a jar file with everything
We also hope to release a precompiled .jar file with the shared library for Linux and Windows once we adapted Scala^Z3 to the new changes in Z3 3.1.
EDIT The GitHub repository now contains a precompiled .jar file prepared for Scala 2.9.1 and Z3 3.2. It works under Windows and Linux (32bit). The repository also contains more detailed instructions on how to compile the shared library in Windows, using MinGW instead of Visual Studio (hence removing the need for VS runtime libraries).
I had a similar problem some months back and here is what it I had to do in order to compile it with Visual Studio 2010. I am not sure if it is still relevant since Scala^Z3 and Z3 itself changed a lot, but I hope it nevertheless is helpful.
Created a new Visual C++ Win32 project (.NET Framework 4) for
creating DLLs.
Added all .h and .c files in the src/c/ directory. VC somehow
complained about the "inline" modifier and a work mate suggested to
remove them, which I did.
Added z3.h from Z3 2.19, Z3 2.16 wasn't accepted. Also added the
corresponding z3.lib (x86, haven't tried x64 yet). VC wouldn't accept
z3.dll and complaint about the file being corrupt. No clue why, Z3
itself works fine for me.
The project compiles with 13 warnings and a dll is created which
apparently MUST be named scalaz3.dll.
sbt compile, adding scalaz3.dll to lib-bin, jar the whole thing
together to scalaz3.jar
'scala -classpath scalaz3.jar test.scala' with scalaz3.jar and z3.dll
in the current folder works