I'm trying to cross compile GNU grep for Windows from Fedora, using their mingw64 cross compilers. The process is really easy, with one exception. By default, it appears that mingw64 doesn't expand wildcards on the command line, so that grep FOO * gives "Invalid argument: *" rather than searching all files in the current directory.
After a bit of research, I found that there is an external symbol, _dowildcard in the mingw64 CRT, that will trigger wildcard expansion if set to -1. But I've found no useful documentation on how to set this (maybe because it's considered obvious ;-)).
I could modify the source code to set the variable, but I'd much prefer to not have to modify the source if at all possible. (I want to set up an automated build, and applying code patches just adds complexity that I'd like to avoid). Is there any way to set _dowildcard from the configure or make command line? I seem to remember older versions of mingw having a setargv.obj file that could be linked into your project to enable wildcard expansion - is there anything similar for mingw64?
Answer from #ssbssa above:
There is a file CRT_glob.o file supplied with the mingw packages, in /usr/x86_64-w64-mingw32/sys-root/mingw/lib/CRT_glob.o (or the corresponding location for 32-bit) that you can link with your executable to activate command line globbing.
You have to specify the file by full pathname for the linker to find it.
Related
I'm new to octave, and want to run a few commands on startup automatically every time it opens.
I typed "help startup" and saw "Octave uses the file ".octaverc". I did a bit of searching online at https://www.math.utah.edu/docs/info/octave_4.html, and saw the .octaverc file should be in the following path:
OCTAVE_HOME/lib/octave/VERSION/startup/octaverc
PROBLEM:
In that directory I don't have a startup folder, only "oct" and "site". I do see hidden files, which was my first thought since the file begins with "." character. So I then used Agent Ransack in the directory, and still nothing came up.
QUESTION:
1) Do I have to make the startup folder and octaverc file myself?
2) If so, does one, both or none have to be hidden?
3) Can it be a txt file, or does it have a special extension?
4) Do I just type the commands straight into the file or is there special formatting?
NOTE:
In case I'm going about this the wrong way, there are the operations I'd like to have run on startup:
PS1('>> '), addpath('D:\Users\Me\Desktop'), clc
Thanks ahead of time for the help!!
Possible locations (and their differences) for octaverc files are specified in the documentation.
In short, these are, from more general to specific:
octave-home/share/octave/site/m/startup/octaverc (most generic, for entire system)
octave-home/share/octave/version/m/startup/octaverc (to cover for more than one octave versions installed on the system, possibly requiring different startup scripts)
~/.octaverc (where ~ is unix-speak for a user's home directory -- covering for user-specific startup files)
.octaverc files in any directory, creating specific startup conditions for specific directories
octaverc files are effectively simple script files that are executed from most generic to most specific each time octave starts. Therefore, in the presence of conflicting commands, the more specific file can effectively be used to override the more generic behaviour.
Octave also supports (but does not recommend) the use of the startup.m file, for matlab compatibility.
You might also want to check out pathdef and savepath as well.
As a more general tip, if you ever want to search for a specific keyword from the documentation (e.g. octaverc), you can type this kind of search query in duckduckgo (or google):
octaverc site:https://octave.org/doc/interpreter/
(or just download the documentation as pdf and search the pdf)
Found the solution, the file was in the following path:
OCTAVE_HOME/share/octave/site/m/startup
to find out where OCTAVE_HOME is for you, just type "OCTAVE_HOME" into your Octave command line window.
ANSWERS:
1) You do not have to make a startup octaverc file yourself
2) The file is actually not hidden, so it should be easy to find given you're looking in the right place.
3) The file doesn't have an extension. It's just octaverc.
4) Under the last line of the existing file, you can just append commands as you would type them at the Octave command line window.
the last(7.3.0) octave version placed HERE:/ does not find the THERE:/openEMS/matlab directory even it is already loaded with octaverc or addpath. It keeps looking into the work dir where openEMS is not placed and does not recognize, for instance, the 'physical_constants.m' file.
I have a C extension to Tcl where command mytest is defined. The extension is compiled correctly (I am on Linux, extension is *.so). For example, I can start tclsh and use it like this:
$ tclsh
% load /path/extension.so
% mytest abc
...
But, if I create a file myscript.tcl with the following content:
load /path/extension.so
mytest abc
then I get error:
$ tclsh myscript.tcl
invalid command name "mytest"
while executing
"mytest abc"
(file "myscript.tcl" line 2)
I am using bash on Ubuntu 14.04. Tcl 8.6.
EDIT 1: My question/problem is that I want to use tclsh with a script as an argument - this script should properly load extensions in such a way that mytest and other implemented functions are working without error.
EDIT 2: Uhh, If I use command "source myscript.tcl" inside tcl shell the result is the same. If I use absolute path for myscript.tcl the error is still the same --- "load" executes without warning but I am not sure about it because I get invalid command name "mytest". Maybe the problem is with scope, but it is working correctly when tclsh is used interactively.
If you are using the full path of the extension library in both cases, that part should work identically. It probably is doing though; if it couldn't load it, it would generate an error (which might or might not be helpful, as some of the ways that things fail give very little information; Tcl reports what it has got, but that's sometimes not enough, as it is dependent on the OS to tell it some things). Instead, the problem is probably elsewhere.
The main difference between interactive use and scripted use is that in interactive use, the unknown command will expand unknown command names to Tcl commands that the thing you typed is an unambiguous prefix of. This is convenient, but when converting to a script, you should always use the full command name. OK, not the full full command name — you mostly don't want or need the :: namespace on the front — but without abbreviation, so don't use lappe for lappend. (In interactive use, Tcl will also exec things as external programs without requiring you to type the exec explicitly; again, that's turned off in scripts as it is rather fragile.)
Could it be that this is what is going on? You can check by setting the global variable tcl_interactive to 0 before typing in your code (I recommend using cut-n-paste for that typing, so that you know exactly what is going in). If that fails, it's the interactive-mode helpfulness that is tripping you up. Check what commands you might have as an expansion for a prefix with info commands (after the load, of course):
info commands mytest*
If that just reports mytest, my theory is wrong. (Well, if it does that and the length of that string is 6; there could theoretically be extra invisible characters have been put on the command name, which would be legal Tcl but very nasty and DON'T DO THAT!)
Just downloaded and installed activeperl 5.16.3.
Trying to add DBD::mysql and found that I cannot change ppm preferences. /Perl/site/lib is unlocked but /Perl/lib is locked.
That means ppm won't put mysql.pm to /Perl/lib/DBD/ but /Perl/site/lib/DBD
Will this work without changing my perl scripts? If not, is there any way to put the module to /Perl/lib (unlock the area (D:\perl\lib)?)
The 'site' directory takes precedence, so it's the correct place to put additional & updated modules.
The other directory is the base install. If you don't muck with it, you won't easily get to a place where you irreparably break your perl.
I need to add the csv module in one module compute.ml of an OCAML package.(see discussion ocaml hash from mysql)
Do you know of a simple way to amend the makefile (it is a complex document in my case and I don't think that I can fully rewrite it or switch to ocamlfind install) to enable a compilation without "Unbound value Csv.load" error messages?
ie can I include a new library inside an existing stable Ocaml package?
modified module : compute.ml,
modification;
let data = Csv.load ("foo.csv")
....
error message during compilation :
camlp5r ../wserver/pa_macro5.cmo -DUNIX -o compute.ppo compute.ml
ocamlopt.opt -warn-error A -I ../wserver -I ../sally -I +camlp5 -c -impl compute.ppo
File "compute.ml", line 110, characters 13-21:
Error: Unbound value Csv.load
Thanks for help
You have to tell ocamlopt where to look for csv.cm{i,x} files with the appropriate -I option, like the ones you already have at the end of your command line.
If the library lies in a subdirectory of OCaml's standard library (as given by ocamlc -where), you can use
-I +csv_dir, as is done for camlp5 in your example. Otherwise, you'll have to provide the full path.
Note that this is not the only modification that you'll have to do: you'll also have to add csv.cmx (or .cmxa) on the command line that perform the final link of your application/library.
I'm forced to use ClearCase (Windows version) at work, and I want to use emacs ediff as a diff and merge tool. The problem with the ClearCase map file is that it requires .exe files - I've tried to specify a batch file calling ediff and it didn't work.
I don't want to write a C/C++ program (it's been more than 10 years since I've coded anything in C for Win32) that will call ediff with the proper arguments. Is there a simpler way?
See also:
Any way to use a custom diff tool with cleartool/clearcase?
As mentioned in this SO question, the map file allows you to call an external diff tool.
For Windows, you should try first to call emacs in ediff mode:
emacs --eval "(ediff-files \"file_1\" \"file_2\")"
or
xemacs -eval "(ediff-files \"file_1\" \"file_2\")"
(should invoke a new instance of XEmacs ediff)
If this works, you may write a .bat file called by the map file, and building the appropriate "emacs ediff" command line.
Something along the lines of:
#echo off
set local
if !%XEMACS_PATH%!==!! SET
XEMACS_PATH=C:\<XEmacs-Path>\i586-pc-win32
set FILE1=%~1
set FILE2=%~2
REM * Bad habit - working on administrative shares.. Why is $->$$ not needed?
REM SET FILE1=%FILE1:$=$$%
REM SET FILE2=%FILE2:$=$$%
REM * Escaping backslash..
SET FILE1=%FILE1:\=\\%
SET FILE2=%FILE2:\=\\%
"%XEMACS_PATH:"=%\gnudoit.exe" "(ediff \"%FILE1%\" \"%FILE2%\")"
If map file is not at ease with calling a .bat file, simply generate an .exe from your .bat.
I have done some tests and it turns out:
"compare with previous version" actually calls:
cleartool diff -graphical -pred myFile
calling the .bat through a cmd.exe call does not work
c:\Program Files\Rational\ClearCase\lib\mgrs\map
text_file_delta xcompare "c:\WINDOWS\system32\cmd.exe /c c:\cc\test.bat"
cleartool: Error: Operation "xcompare" unavailable for manager "text_file_delta"
(Operation pathname was: "C:\Program Files\Rational\ClearCase\lib\mgrs\"c:\WINDOWS\system32\cmd.exe /c c:\cc\test.bat"")
transforming the .bat in .exe does work
arg2 (%2) and arg4 (%4) are what you are looking for, with arg5 (%5) the name of the temporary file created for the content of the previous version (for snapshot view which can not access extended path name)
So the following bat (transformed in exe) works from the command-line only (not from the ClearCase Explorer: DrWatson):
"C:\Program Files\WinMerge\WinMergeU.exe" %4 %5
You should be able to adapt it to Xemacs, but Alex's suggestion (working with Clearcase from Emacs) might be another more practical solution.
you can use clearcase package as described here