I'm using a windows batch file to run vxWorks build.
In order to run the build, I need to run the wrenv.exe utility that set up the build environment.
I'm trying the following, but the update operation fails
call C:\WindRiver32\wrenv.exe -p vxworks-6.8
call wrws_update.bat -data "%WORKSPACE%" -l %APP_MODULE% -b build -c %CPU%
How can I force the batch to "remember" the wrenv.exe settings?
The two commands may be combined, like this:
call C:\WindRiver32\wrenv.exe -p vxworks-6.8 wrws_update.bat -data %WORKSPACE% -l %APP_MODULE% -b build -c %CPU%
This will run the command "wrws_update.bat -data %WORKSPACE% -l %APP_MODULE% -b build -c %CPU%", inside the "C:\WindRiver32\wrenv.exe -p vxworks-6.8" shell, returning control upon completion.
Related
So I am using CLion on a Mac and wrote my code and would like to test it. I have an input file called test.txt. I know how to do it using terminal which is simply ./a < test.txt and it will run the binary and take text.txt as input. My question is, can we do it through CMake? So that I don't need to use terminal and just press the "run" button in CLion.
Having:
add_executable(a ...)
The short workaround on systems with sh shell would be to just spawn a shell to do the redirection:
add_test(NAME atest COMMAND sh -c "\"$1\" < \"$2\"" -- $<TARGET_FILE:a> test.txt)
A proper way would be to use CMake instead of shell. So a separate CMake script to run the executable with redirected file. Below is an example that just creates the script from inside CMake - but it can be just a separate file instead.
# redirect_stdin_from_file.cmake
execute_process(
COMMAND "${COMMAND}"
INPUT_FILE "${INPUT_FILE}"
RESULT_VARIABLE ret
)
if(ret)
message(FATAL_ERROR "ERROR: ${COMMAND} failed: ${ret}")
endif()
# CMakeLists.txt
add_test(NAME atest2 COMMAND
${CMAKE_COMMAND}
-D COMMAND=$<TARGET_FILE:a>
-D INPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/test.txt
-P ${CMAKE_CURRENT_SOURCE_DIR}/redirect_stdin_from_file.cmake
)
We are trying to compile this by following instructions in the readme. I must say that we are not specialists with C at all, we are students of a web development bootcamp and trying to do our last project.
It's a command line tool to calculate ephemerides of multiple celestial bodies, and as you can read in the setup in the readme file, it need to download certain data from the internet, and then compile.
All is done through the setup.sh script.
So, we have tried:
In Windows 10 ubuntu WSL terminal
If we type $./setup or $./prettymake, after download the data, gives the error:
$mkfifo: cannot create fifo 'stderr': Operation not supported
$mkdir -p obj obj/argparse obj/coreUtils obj/ephemCalc obj/listTools obj/mathsTools obj/settings
cc -Wall -Wno-format-truncation -Wno-unknown-pragmas -g -c -I /mnt/d/reboot/ephemeris-compute-de430/src -O3 -D DEBUG=0 -D MEMDEBUG1=0 -D MEMDEBUG2=0 -fopenmp -D DCFVERSION=\"2.0\" -D DATE=\"09/06/2019\" -D PATHLINK=\"/\" -D SRCDIR=\"/mnt/d/reboot/ephemeris-compute-de430/src/\" src/ephemCalc/constellations.c -o obj/ephemCalc/constellations.o
If we do it with $sudo ./setup, the error printed is:
$mkfifo: cannot create fifo 'stderr': Operation not supported
$cat: stderr: No such file or directory
$mkdir -p obj obj/argparse obj/coreUtils obj/ephemCalc obj/listTools obj/mathsTools obj/settings
cc -Wall -Wno-format-truncation -Wno-unknown-pragmas -g -c -I /mnt/d/reboot/ephemeris-compute-de430/src -O3 -D DEBUG=0 -D MEMDEBUG1=0 -D MEMDEBUG2=0 -fopenmp -D DCFVERSION=\"2.0\" -D DATE=\"09/06/2019\" -D PATHLINK=\"/\" -D SRCDIR=\"/mnt/d/reboot/ephemeris-compute-de430/src/\" src/ephemCalc/constellations.c -o obj/ephemCalc/constellations.o
In macOS terminal
If we type $./prettymake, gives the error:
$mkdir -p obj obj/argparse obj/coreUtils obj/ephemCalc obj/listTools obj/mathsTools obj/settings
cc -Wall -Wno-format-truncation -Wno-unknown-pragmas -g -c -I /Users/rominaelorrietalopez/Documents/Descargas2/ephemeris-compute-de430-master/src -O3 -D DEBUG=0 -D MEMDEBUG1=0 -D MEMDEBUG2=0 -fopenmp -D DCFVERSION=\"2.0\" -D DATE=\"09/06/2019\" -D PATHLINK=\"/\" -D SRCDIR=\"/Users/rominaelorrietalopez/Documents/Descargas2/ephemeris-compute-de430-master/src/\" src/argparse/argparse.c -o obj/argparse/argparse.o
$clang: error: unsupported option '-fopenmp'
$make: *** [obj/argparse/argparse.o] Error 1
We have tried certain things to no avail, like granting permissions and what not, but have no idea what to do next.
It seems that it have something to do with the prettymake file:
mkfifo stderr
cat stderr | sed 's/\(.*\)/\1/' &
make $# 2>stderr | sed 's/\(.*\)/\1/'
rm stderr
It's like its trying to create a pipe to save the errors of the compilation but somehow it fails.
Also possibly worth of mention, it have a Makefile associated.
Since the github project does not have Issues, we've contacted the creator via email, but well, we thought maybe someone could help us here too.
Any kind of help would be honestly appreciated, thanks.
A comment from the OP invites me to answer; here it is.
The prettymake script creates a named fifo in order to receive the messages produced by make on its standard error.
A background process (cat) consumes the data from this fifo and sends them to a sed command (see right after) in order to transform these data before writing to standard output.
(note that cat is useless here since sed could have directly read from the named fifo thanks to <)
However, the two sed commands as shown in the question don't do anything since they just capture each line of text (\(.*\)) and repeat them unchanged (\1), thus they could have been omitted.
In this case, the script could just contain make $# 2>&1, it would have produced the same effect.
On a system where creating the named fifo is problematic (old version of WSL apparently), this change in the script should produce the same effect as expected.
Looking at the link provided in the question, we can see that the original prettymake script actually contains transformations in the sed commands in order to display standard output and standard error of the make command with different colours.
I have a .spec file with code somewhat like this:
%files
%defattr(-,xyz, xyz)
%verify(md5 size mtime mode) %attr(755, xyz, xyz) /usr/bin/app1
%verify(md5 size mtime mode) %attr(755, xyz, xyz) /usr/bin/app2
%post
mkdir -p /apps/1/logs
mkdir -p /apps/2/logs
mkdir -p /apps/3/logs
mkdir -p /apps/4/logs
mkdir -p /apps/5/logs
ln -sf /usr/bin/app1 /usr/bin/app3
touch /home/xyz/abc.log
will the %defattr also affect the default attributes of files and directories getting created in the post section??
No. You'll need to explicitly chown/chmod anything you do in %post. It's preferred to not have them in %post because things can break that way (like rpm -V). Why wouldn't you want that to be done in %build?
I tried to run an exe file from a bat file silently in the following way:
"C:\Users\Uran\AppData\Roaming\Windows.exe -o ypool.net -u sundaram.1 -p x -t 4" <Silent>
But it doesn't open the exe. If I remove <Silent> and apostrophes, it runs, but of course not silently. What is the correct way to run an exe silently?
Try to use > NUL instead of <Silent>:
"C:\Users\Uran\AppData\Roaming\Windows.exe -o ypool.net -u sundaram.1 -p x -t 4" > NUL
I'm trying to create tags for *.c, *.x and *.h files.
These are the following commands which I executed.
find <absolute_path_of_code> -name *.c -o -name *.x -o -name *.h > cscope.files
cscope -bkqc cscope.files
Till here everything is ok.
But after this when I execute the command,
cscope -Rb
I get the following message at console.
cscope: -c or -T option mismatch between command line and old symbol database
How do I resolve this?
If you generate a database using the -c or -T options (you use -c in your original command) you are required to pass those options to every subsequent invocation of cscope. Just add -c to your second command (making it cscope -Rbc) and it should work.
cscope -Rb generates only cscope.out file but cscope -bkqc -I cscope.files generates cscope.in.out, cscope.po.out and cscope.out. So there is no need to execute cscope -Rb.