Dependency for add_jar cmake - cmake

I am actually generating java source files dynamically through code generators. I want to create jar file containing the java files created through this code generator.
add_custom_target(lang ALL)
add_custom_command(
TARGET lang
COMMAND ${Protobuf_PROTOC_EXECUTABLE} ${CMD_PRG_LNG} --proto_path=${PROTO_FILES} ${COMMONS}/*.proto")
If I run my cmake without add_jar command, it successfully run and generate java files in the respective folders. But, if I add add_jar
add_jar(${JAR_NAME} ${JAVA_SOURCES})
The above instruction fails with the following error message.
Scanning dependencies of target ProtoJava
make[2]: *** No rule to make target '../protoJava/Data.java', needed by 'CMakeFiles/ProtoJava.dir/java_compiled_ProtoJava'. Stop.
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ProtoJava.dir/all' failed
make[1]: *** [CMakeFiles/ProtoJava.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
How to get the jar file created? I tried putting add_jar inside add_custom_command under the same target as java file creation.
add_custom_command(
TARGET lang_java
COMMAND add_jar(${JAR_NAME} ${JAVA_SOURCES}))
but it errors out with message
/bin/sh: 1: Syntax error: word unexpected (expecting ")")
CMakeFiles/lang_java.dir/build.make:57: recipe for target 'lang_java' failed
make[2]: *** [lang_java] Error 2
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/lang_java.dir/all' failed
make[1]: *** [CMakeFiles/lang_java.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
How to fix this one?

Related

.lst file generation in cmake

I want to generate .lst files for my source file. I am successfully able to generate the executable.
But I don't know how to generate .lst files for my source files.
get_property(allsrcfiles TARGET myExe PROPERTY SOURCES)
foreach(srcfile IN LISTS allsrcfiles)
set_source_files_properties(${srcfile} PROPERTIES COMPILE_FLAGS "-Wa, anhlmsd=${srcfile}.lst")
endforeach()
I have added the above script in my CMakelists.txt, if I add the above script I am getting the following error
[100%] Linking C executable myExe
dld: error: Can't open file 'CMakeFiles/myExe.dir/src/sample.c.obj': No such file or directory
CMakeFiles\myExe.dir\build.make:101: recipe for target 'myExe' failed gmake[2]: *** [myExe] Error 1
CMakeFiles\Makefile2:93: recipe for target 'CMakeFiles/myExe.dir/all' failed
gmake[1]: *** [CMakeFiles/myExe.dir/all] Error 2
Makefile:101: recipe for target 'all' failed
gmake: *** [all] Error 2
sample.c.obj file is getting generated without source_file_properties.
compiler : WIND RIVER
Target : ppc - embedded
Host : windows
is list file generation commands depends on the compiler?

error build all ros packages in this repo the error occur in catkin_make step

I followed instruction by Michael Huang.
My error message reads:
In file included from /home/evadro/quadevac_sim_ws/catkin_ws/src/menge_gazebo/menge_congregate/include/MengeCong.h:10:0,
from /home/evadro/quadevac_sim_ws/catkin_ws/src/menge_gazebo/menge_congregate/src/MengeCong.cpp:8:
/home/evadro/quadevac_sim_ws/catkin_ws/src/menge_gazebo/menge_congregate/../menge_common/include/MengePlugin.h:13:44: fatal error: gazebo/physics/InstancedActor.hh: No such file or directory
compilation terminated.
menge_gazebo/menge_congregate/CMakeFiles/menge_congregate.dir/build.make:62: recipe for target 'menge_gazebo/menge_congregate/CMakeFiles/menge_congregate.dir/src/MengeCong.cpp.o' failed
make[2]: * [menge_gazebo/menge_congregate/CMakeFiles/menge_congregate.dir/src/MengeCong.cpp.o] Error 1
CMakeFiles/Makefile2:4099: recipe for target 'menge_gazebo/menge_congregate/CMakeFiles/menge_congregate.dir/all' failed
make[1]: * [menge_gazebo/menge_congregate/CMakeFiles/menge_congregate.dir/all]
The 2nd error is:
make[1]: *** Waiting for unfinished jobs....
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j24 -l24" failed
Your Error is gazebo/physics/InstancedActor.hh No such file or directory.
this header is not on standard version of Gazebo.
Make Sure you Compiled Gazebo Repo mentioned in External Depenencies Here with No errors. Then Double checks paths so compiler can find the missing headers.

No rule to make target 'vexpress_gem5_dvfs_defconfigmake'. Stop

I am trying to run DVFS on gem5 that I am trying to create a Makefile Based on this site :http://www.gem5.org/Running_gem5#Experimenting_with_DVFS
When I try to make I get the following error message:
(/home/farideh/linux-linaro-tracking-gem5/scripts/kconfig/Makefile:36: recipe for target 'silentoldconfig' failed
make[2]: * [silentoldconfig] Error 1
/home/farideh/linux-linaro-tracking-gem5/Makefile:526: recipe for target 'silentoldconfig' failed
make[1]: * [silentoldconfig] Error 2
make: *** No rule to make target 'vexpress_gem5_dvfs_defconfigmake'. Stop.)
I don't know this error for things and what do I do by this error?

CMake not finding files - Can't build detectron with pytorch

make ops for detectron isn't working
export Caffe2_DIR=<path to my pytorch>/torch
make ops
Error Message
[ 40%] Building CXX object CMakeFiles/caffe2_detectron_custom_ops.dir/detectron/ops/zero_even_op.cc.o
In file included from /home/ubtuntu/detectron/detectron/ops/zero_even_op.cc:17:0:
/home/ubtuntu/detectron/detectron/ops/zero_even_op.h:20:33: fatal error: caffe2/core/context.h: No such file or directory
compilation terminated.
CMakeFiles/caffe2_detectron_custom_ops.dir/build.make:62: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops.dir/detectron/ops/zero_even_op.cc.o' failed
make[3]: *** [CMakeFiles/caffe2_detectron_custom_ops.dir/detectron/ops/zero_even_op.cc.o] Error 1
make[3]: Leaving directory '/home/ubtuntu/detectron/build'
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops.dir/all' failed
make[2]: *** [CMakeFiles/caffe2_detectron_custom_ops.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
/home/ubtuntu/detectron/detectron/ops/zero_even_op.cu:17:37: fatal error: caffe2/core/context_gpu.h: No such file or directory
compilation terminated.
CMake Error at caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o.cmake:219 (message):
Error generating
/home/ubtuntu/detectron/build/CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/detectron/ops/./caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o
CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/build.make:63: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/detectron/ops/caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o' failed
make[3]: *** [CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/detectron/ops/caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o] Error 1
make[3]: Leaving directory '/home/ubtuntu/detectron/build'
CMakeFiles/Makefile2:109: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/all' failed
make[2]: *** [CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/all] Error 2
make[2]: Leaving directory '/home/ubtuntu/detectron/build'
Makefile:129: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/ubtuntu/detectron/build'
Makefile:13: recipe for target 'ops' failed
make: *** [ops] Error 2
What I've Tried
In the error message, it says it can't find caffe2/core/context.h however the file exists in pytorch/caffe2/core/context.h. So I've tried exporting the caffe2 folder instead of the torch folder, but then the build fails earlier
- I've also tried setting it to pytorch/cmake and pytorch/build folders
I then tried creating a caffe2 link to pytorch/caffe2 inside of pytorch/torch, however that had no effect. I'm out of ideas :(

Mono: "mdoc: There is an error in XML document"

I modified a few lines of C# code in the source of Mono, and now it does not build anymore:
make[7]: Leaving directory `/home/nico/src/mono-roman/mono-2.10.8.1/mcs/mcs'
make[7]: Entering directory `/home/nico/src/mono-roman/mono-2.10.8.1/mcs/docs'
/usr/bin/make all-local
make[8]: Entering directory `/home/nico/src/mono-roman/mono-2.10.8.1/mcs/docs'
MDOC [net_4_0] cs-errors.tree
mdoc: There is an error in XML document.
See `mdoc help' for more information.
make[8]: *** [cs-errors.tree] Error 1
make[8]: Leaving directory `/home/nico/src/mono-roman/mono-2.10.8.1/mcs/docs'
make[7]: *** [do-all] Error 2
make[7]: Leaving directory `/home/nico/src/mono-roman/mono-2.10.8.1/mcs/docs'
make[6]: *** [all-recursive] Error 1
make[6]: Leaving directory `/home/nico/src/mono-roman/mono-2.10.8.1/mcs'
make[5]: *** [profile-do--net_4_0--all] Error 2
make[5]: Leaving directory `/home/nico/src/mono-roman/mono-2.10.8.1/mcs'
make[4]: *** [profiles-do--all] Error 2
make[4]: Leaving directory `/home/nico/src/mono-roman/mono-2.10.8.1/mcs'
make[3]: *** [all-local] Error 2
make[3]: Leaving directory `/home/nico/src/mono-roman/mono-2.10.8.1/runtime'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/nico/src/mono-roman/mono-2.10.8.1'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/nico/src/mono-roman/mono-2.10.8.1'
make: *** [build-stamp] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
Build command 'cd mono-2.10.8.1 && dpkg-buildpackage -b -uc' failed.
E: Child process failed
The problem is mdoc: There is an error in XML document. MDOC is a kind of Javadoc for Mono. I am surprised that changing a few benign C# lines would make MDOC fail?
Any tip on what is going on here? I also have no idea what XML document this is about.
The initial analysis I posted in the comments seems to be right. MDOC is loading the cs-errors.config, and using the newly built runtime. The changes you have made produce the following exception while loading said file:
System.InvalidOperationException: Element 'FilesPath' has wrong order in sequence (expected - -1, actual - 0
This was added by your patch. I am guessing you might want to check readBySoapOrder as well, such as:
if (readBySoapOrder && info.ExplicitOrder != ind)
throw new InvalidOperationException(string.Format("Element '{0}' has wrong order in sequence (expected - {1}, actual - {2}", Reader.LocalName, info.ExplicitOrder, ind));
With this little change MDOC is happy and compilation succeeds, but I have no idea if it is the correct behavior.
Try "make clean" before trying "make" again.