How do I build project files and packages for Borland C++ Builder 5 from the command line? - command-line

How do I build Borland C++ project files (bpr) and package files (bpk) from the command line? Project groups (bpg) are apparently make files and can be compile with make. But bpks and bprs are xml based and the Export to Makefile won't compile with make.
If I put a project in a bpg, make can't seem to find any of the files specified in the bpg since they all appear to be relative references. I changed the references to absolutes and make reports:
Fatal: Unable to open makefile

You don't need to directly compile a bpr. Just create a bpk which just includes that single bpr, and you can use make to compile it.
"c:\program files\borland\cbuilder5\bin\make" -B -s -fabc.bpg
If you also have other borland compilers installed, do not call the make.exe from the other compiler.
EDIT: execute the make command in the directory where the bpg and bpr is located.

Using bpr2mak and make works for me just fine, so as Roger said, you need to give details on what errors you're getting. BPK files can also be processed with bpr2mak. I'm using this method to compile a large project with many components, without difficulties.

Perhaps you could give some more information on 'won't compile'.
I.e. What error messages are you getting.
One frequent problem the come up with make is addressed at the following
http://www.delphigroups.info/3/8/36427.html

Related

Doxygen failed to run html help compiler, hhc.exe error HHC5010 when running from folder that has a parent folder that starts with "."

I am using Conan package manager on Windows to create a package. The conan command to create the package copies files to a folder within %USERPROFILE%\.conan (or C:\Users\xxxxxxx\.conan). Then from this location it builds a Visual Studio project and ultimately calls doxygen.exe to create a .chm help file in a post-build command. The doxygen command fails with:
error : failed to run html help compiler on index.hhp
Further investigation reveals the hhc.exe command executed by doxygen is failing with:
C:\Users\xxxxxxx\.conan\data\Module\1.0.0\user\channel\build\524dc97e4a3dd1f774ea3897f9e4faf26c5457d2\Documentation>"C:/Program Files (x86)/HTML Help Workshop/hhc.exe" html\index.hhp
HHC5010: Error: Cannot open "C:\Users\xxxxxxx\data\Module\1.0.0\user\channel\build\524dc97e4a3dd1f774ea3897f9e4faf26c5457d2\Documentation\html\Module.chm". Compilation stopped.
Close inspection reveals that in the error message, the ".conan" folder is missing. Sure enough, I confirmed that hhc.exe fails when the index.hpp resides in a folder that has a parent folder that starts with a ".".
Attempts to resolve this:
changing the Doxyfile setting OUTPUT_DIRECTORY to "$(TMP)/DoxygenModule" resolves the error, but creates the .chm file in another location, which I do not prefer.
navigating to the 8DOT3 name of the ".conan" folder, which is "CONAN~1", to run the hhc.exe command, succeeds, but unfortunately I have no way of getting conan to use this 8DOT3 path for creating the package. E.g. C:\Users\xxxxxxx\CONAN~1\...
I can live with the using the %TMP% folder but would prefer generating the .chm in the current folder. Anyone have any ideas?
HTML Help Workshop v1.31 is installed on my machine at C:\Program Files (x86)\HTML Help Workshop, probably from a Visual Studio installation (not sure). I attempted using a version downloaded from Microsoft website (v1.30) as well, which made no difference.
Other info: Conan version 1.18.0, Doxygen version 1.8.14, Windows 10 Version 1809
Unfortunately not a solution, but this is a known limitation in the hhc.exe, see: https://social.msdn.microsoft.com/Forums/en-US/0681145c-223b-498c-b7bf-be83209cbf4e/issue-with-html-workshop-in-a-windows-container?forum=visualstudiogeneral
HTML Help 1.x command line compiler hhc.exe cannot compile CHM file to folder whose full path contains folder name starting with dot. If you have that problem, you probably specified output path with folder starting with dot, e.g. "d:\My files.NET\documentation". You can use dots in folder names but not at the beginning.
Edit 2019-11-15:
I've just pushed a proposed patch to github (pull request 7402, https://github.com/doxygen/doxygen/pull/7402).
This proposed patch changes inside doxygen from the current directory to the short named current directory, but just for the HTML Help compilation.
Edit 2019-11-16:
Code has been integrated in the master version on github.
This is not an answer either. Actually, you found the answer and workaround[s] yourself.
Use OUTPUT_DIRECTORY to specify a directory containing no folder names beginning with periods.
The error you described is a known issue of the MS HTML Help compiler. More general, the HTML Help compiler does not like some folder and file names. Try and stick with these characters _, a..z, A..Z, 0..9. Do not use these signs in particular ., -, # .
Please note that the proprietary CHM file format is about 20 years old (Windows 95, ...). HTML Help is in maintenance mode, which means no new features and bug fixes are expected for either the runtime or the compiler. All mainstream development on HH has stopped.
There is no way to avoid this error if a directory name above begins with a period. Not even if only the necessary files are written by Doxygen and compiling of the index.hhp is done by a third-party tool like FAR HTML using your path that contains .conan. This is because all applications are using the faulty HHA.dll.
The above applies of course to the entire workflow you have described. Maybe you can interrupt it.
Doxygen can be configured not to call the HTMLHelp compiler. Just uncheck the GENERATE_HTMLHELP option (DoxyWizard: Experts > Topics > HTML). You have all files generated by Doxygen in your preferred output directory - but of course without the CHM file. This can be imported later e.g. by HelpNDoc and compiled as a CHM file in another location.
If you can interrupt the workflow and can also make changes to Doxygen's settings, then a preference setting of OUTPUT_DIRECTORY to e.g. C:/CacheMenu/CONAN~1/DOXYGE~1 also works as expected (here used as test case).
No matter what you do, your workaround and copy and paste from another directory outside is a quick solution at this stage. Please note the EDIT in #albert's answer.

How to get Google Protobuf working in Matlab?

So if one was to want to use Google protocol buffers in Matlab and using a Windows computer what would be the best way to do that since Matlab is not in the list of supported languages?
I haven't seen an answer on this and I thought the solution was a bit obscure so I am going to post a how to for matlab_out using the protoc.exe
A how to for google protocol buffer matlab out, this is using resources from the internet I will also include a zip file containing all this already done.
Unzip protobuf-‘version#’.zip (looks like: protobuf-#.#.#)
Open file protobuf-#.#.# -> src
Choose your favorite editor (Notepad++ is good) and change Makefile.am (do not include quotes)
a. Under “nobase_include_HEADERS =”
and below “$(GZHEADERS)”
add the line “farsounder/protobuf/compiler/matlab/matlab_generator.h \” (Note the back slash)
b. Under “libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la”
add lines
“farsounder/protobuf/compiler/matlab/matlab_generator.cc \”
“farsounder/protobuf/compiler/matlab/matlab_plugin.cc \”
c. Save the file and exit out
While still in the src directory go into ->google ->protobuf->compiler and change main.cc
a. Under “#include <google/protobuf/compiler/java/java_generator.h>”
add the line “#include <farsounder/protobuf/compiler/matlab/matlab_generator.h>”
b. In main function add the lines
“// Proto2 Matlab
farsounder::protobuf::compiler::matlab::MatlabGenerator matlab_generator;
cli.RegisterGenerator("--matlab_out", &matlab_generator,
"Generate Matlab M files.");”
c. Save the file and exit out
Unzip protobuf-matlab
Open file protobuf-matlab ->src and copy the farsounder directory to protobuf-#.#.# -> src directory
Go back to protobuf-#.#.# directory and into -> vsprojects and open protobuf.sln in Visual Studio, I believe any version should work
There should be a popup that wants to convert the solution file to a more updated version, go ahead and do that
If you do not see solutions explorer open it up using ctrl+alt+L
Open a new windows explorer and go into protobuf-#.#.# ->src->farsounder->protobuf->compiler->matlab, now in visual studio using the solutions explorer expand the libprotoc->Header Files, now in windows explorer copy the matlab_generator.h file and paste it into the Header Files directory
Still in Solutions explorer go into the Source Files directory and copy in the matlab_generator.cc
Contract libprotoc and right click on protoc and click on properties
Under Configuration Properties->Linker->General, Edit Enable Incremental Linking to be No
Under Configuration Properties->Linker->Input, Edit Additional Dependencies
a. Add the lines “Release\libprotobuf.lib” and underneath “Release\libprotoc.lib”
b. Click OK on the Additional Dependencies window and OK on the protoc Property Page
Change the build type to Release
Right-click on libprotobuf and select build, once completed right-click on libprotoc and select build
Once completed right-click on protoc and select build, it should provide you with an protoc.exe under protobuf-#.#.# ->vsprojects->Release, this will now allow you to create matlab .m files by using the matlab_out command
Help to find protobuf-#.#.# and the protobuf-matlab:
Follow these links:
https://code.google.com/p/protobuf-matlab/source/browse/
download the zip file
https://github.com/google/protobuf/releases
download the source code
Extra help, for using protoc.exe
Copy and paste the created protoc.exe to where your .proto file is
Run cmd and change the directory to where your protoc.exe and .proto file is
Run this command (lets pretend the name of my .proto file is “afunprotofile”) “protoc –matlab_out=./ -I./ afunprotofile.proto”
The easiest way is to use Java
The FarSounder code was nice, but it is quite old and unmaintained. The easiest way to produce Matlab compatible code is to just use the Java version of Protobuf. This solution should work on any platform that supports Matlab and Java.
The Steps
Create a .proto file
Process the file with the protoc compiler and output Java source
Using IntelliJ or other tool produce a JAR file that includes the dependencies
Add the JAR file to the Matlab classpath. edit('classpath.txt')
Restart Matlab
The protobuf runtime dependencies
I include these in a single JAR file output of the Protobuf and the two runtime libraries.
protobuf-java-3.3.0.jar
protobuf-java-util-3.3.0.jar
A sample
I wrote a simple Java wrapper class to hide the MyProtobuf.Builder return type from Matlab that I added to the JAR file
public class MyProtobufWrapperWrapper {
public static MyProtobuf.Builder newBuilder()
{
return MyProtobuf.newBuilder();
}
}
In Matlab
p = com.cameronpalmer.MyProtobufWrapper.newBuilder();
p.setIdentifier(java.util.UUID.randomUUID().toString());
p.setTimestampMilliseconds(timestamp);
p.setAngleRadians(0);
p.addAllChannelSamples(channel_vector);
planeWaveBuilt = p.build();
byteArray = planeWaveBuilt.toByteArray();
As Cameron Lowell Palmer's answer suggests, the way to go is via Java.
Is I lost a couple of hours today on this problem, I would like to elaborate some more. I started with Cameron's answer but I had to do a couple of more steps. Essentially, I had to do all of the following:
Compile proto message for java, e.g. protoc --java_out=./ your_file.proto
Remember to install protobuf java runtime, e.g. in ubuntu: sudo apt install libprotobuf-java
Locate the protobuf java runtime on your system, e.g.: /usr/share/java/protobuf-3.6.1.jar; its path will be used later on. The name should always follow the pattern protobuf-version.jar or protobuf-java-version.jar, therefore locate protobuf- | grep jar$ should reduce the search space for you.
Add a short java file to the same directory, where your protobuf java files went (./x/y/z/MyProto.java). Use your package path instead of x/y/z. If you did not declare java package explicitly in the proto file, then protoc just used your filename as package name. Either way, you can probably check where the protoc generated files went by yourself. Contents of MyProto.java are listed below. Just replace YourProtoFileName and YourMessageName with your stuff. Note that this step is not optional, as this will not generate a simple helper class. For the life of me, Matlab would not let me use inner classes directly (in java, YourMessageName is the inner class of YourProtoFileName). But with the above helper, it was quite happy to generate them for me. Note that if you have more than one message defined in your proto file, you might need to expose more than one builder in this way. And if you only need to read protobuffers, then you might need to export just YourMessageName and not Builder.
package x.y.z;
import x.y.z.YourProtoFileName; // if you do not know it, do `ls x.y.z/*.java`
public class MyProto {
public static YourProtoFileName.YourMessageName.Builder newBuilder() {
return YourProtoFileName.YourMessageName.newBuilder();
}
}
Check Matlab's version of java; in Matlab write version -java. In my case it was 1.8, while the default java installed on my system (java -version) is 11. I had to manually select java 1.8 for the next step, otherwise the whole thing did not work. Even worse, Matlab only produced a very nondescript error "No class x.y.z.YourProtoFileName." Thanks Matlab! You might need to install proper version first (sudo apt install openjdk-8-jdk) and then use update-java-alternatives or just locate javac for the appropriate java version on your system.
Compile both your java file and the one generated by protoc. Remember to point classpath at the jar file or protobuffer runtime that you found above. And remember to use your javac path. In a single command: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac x.y.z/*.java -cp /usr/share/java/protobuf-3.6.1.jar. This will generate class files in ./x/y/z/.
Optional: pack the class files in a jar for easier distribution: jar cvf ./YourProtoFilename.jar x/y/z/*.class. Note that this command line works for me, since I've put all classes, including MyProto, in the same package. You might need to adapt it to your needs.
Start Matlab.
% make Matlab aware of your new classes
javaaddpath('./')
% tell Matlab where protobuf dependancy lives (use the path from step 3)
javaaddpath('/usr/share/java/protobuf-3.6.1.jar')
% test if the classes were found
methods('x.y.z.YourProtoFilename.YourMessageName')
% if methods are listed then you are good to go
% use the helper form step 4
b = x.y.z.MyProto.newBuilder();
% now you have a builder you can use to build your protobuf message
See Google's protobuf java primer to go on from here, as using java in Matlab is fairly straight forward: just write java statements. As long as they are simple statements :)
The same procedure works on octave too. With a bit different syntax for java inside octave. And octave was less picky about the java version in my case. YMMV
#WPFUser,
We followed below steps to build protoc for matlab.
1) git clone https://github.com/protocolbuffers/protobuf.git to protobuf-main folder
2) git submodule update --init --recursive
3) git clone https://github.com/farsounder/protobuf-matlab.git - protobuf_matlab folder
4) Copied src folder from protobuf_matlab repo to protobuf-main/src
5) Updated cmake/libprotoc.cmake to include matlab_generator.cc and matlab_generator.h files
6) Updated cmake/extract_includes.bat.in to include matlab_generator.h file
7) \src\google\protobuf\compiler\main.cc to include matlab_generator

is there a coffeescript auto compile / file watcher for windows?

I'd like to play around with integrating coffeescript into my dev process. But as I see it, I'll have to make a bat file that iterates a set of coffee files and spits out js files. Every time I write a bat file, useful as they may be, I ask myself: is there a better way?
Which makes me wonder: is there an app of some sort for Windows that will watch a directory or a file and spit out one/many js files when a coffee file is saved? I'm thinking of building one but don't want to reinvent the wheel. I looked around and found things that were similar but nothing that elevated it beyond "run this command line" on Windows.
Edit: already marked an answer, but looking at this 10 months later the answer is: grunt. Because it'll do a lot more than just auto-compile your coffeescript and you'll probably need to do more than just that to get your app going.
coffee --watch -o lib -c src
where src is a directory containing your coffee files, and lib is your JavaScript output directory.
See update at bottom of post.
I was hunting for the same thing the other day and came across this: https://github.com/danenania/CoffeePy
It's a simple python script that uses PyV8 to run coffee-script.js.
It doesn't do anything fancy, just watches a folder recursively, and compiles any .coffee files whenever they're changed. It doesn't even have a bare option. These things could be very easily added though!
Edit:
I forked the script and added --bare and --output options.
You can get it here: https://github.com/johtso/CoffeePy
Personally, I prefer using build tools like grunt.js / yeoman or brunch for that purpose.
grunt.js
&
grunt coffee
Mindscape Workbench has a built in compiler/editor for VS 2010. Haven't tried it yet, but it looks like it'd be even better than a watcher/compiler. Scott Hanselman has a post about it here:
http://www.hanselman.com/blog/CoffeeScriptSassAndLESSSupportForVisualStudioAndASPNETWithTheMindscapeWebWorkbench.aspx
I think there is a simplier way just using -w option of coffeescript compiler
coffee -c -w *.coffee
This will compile all coffee files under the folder you are (put more file pathes if needed) each time you change one.
Another possibility: WebStorm 6. They've added a built in file-watcher for a variety of next-gen languages like SASS and Coffescript.
If you want a different way of doing it, this might help:
http://jashkenas.github.com/coffee-script/#scripts
If you include the coffeescript compiler on your page, you can include files with a "text/coffeescript" type and they will get compiled client-side.
Word of warning: Obviously, client-side compilation is not for something serious, but its completely fine for a small project/quick development. It would then be trivial to compile them on the server and change the MIME-type and filename when something a bit quicker is necessary.
CoffeeScript-dotnet does what you want, but it is a command line tool.
Command line tool for compiling CoffeeScript. Includes a file system watcher to automatically recompile CoffeeScripts when they change. Roughly equivalent to the coffee-script node package for linux / mac.
Here is the best way to do it:
Say your work is in "my-project-path" folder.
Go to the parent folder of "my-project-path"
Start a terminal and type coffee -o my-project-path -cw my-project-path
This line will watch and compile anything name as "*.coffee" in "my-project-path" folder, even if it is in "my-project-path/scripts/core" or "my-project-path/test/core".The js file will locate in the save folder as the .coffee file.

how to run doctrine.php in command prompt

I'm trying to use Doctrine with Zend, I have copied the doctrine.php and doctrine file in the script folder in the Source Files folder.
However when I type in command prompt following command: "php doctrine.php" by entering in the scripts folder, Nothing happens, there is no error printed, the cursor just goes to next line. Can someone please tell me how can I use doctrine.php.
When using Guilherme's integration suite, you need to do a couple of things.
Download / clone the Doctrine Common, DBAL and ORM libraries and make sure they're available in your include path. For this, I usually just copy the lib/Doctrine code from each into my project's library folder. If using git, you can add them as subtree splits but that's a topic for another time ;-)
You also need the Symfony Console and Yaml namespaces. Again, it's easiest to place them in your project's library folder under library/Symfony/Component/Console and library/Symfony/Component/Yaml. These usually come as submodule dependencies in the Doctrine libraries but you can also get them from their github pages
Console
Yaml
Remove the bootstrap('Config') call from the doctrine.php script. Don't know what Guilherme was thinking there :-)
That's it, from there it should work as expected.

Fix source file search path when doing out-of-source autotools build within emacs

I have a project that uses autotools. A nice feature of autotools is 'out-of-source' builds, wheras instead of doing :
cd foobar
./configure
make
I actually create a folder for builds, in which I do the configuration :
cd foobar/builds/linux
../../configure
make
(The nicety is that my source folder is not crippled with the generated Makefiles, and it helps when cross-compiling).
So when I am working on my code in emacs, to run the compilation I'll do M-x compile specifying the compile command as cd ~/foobar/builds/linux ; make .
This works fine until a compilation error occurs. The compilation buffer will list the files with ugly path (like ../../../../src...), which points to a source file, relative to the build folder.However, it seems like emacs does not stay in the build folder at the end of the compile, so the link does not point to anything. Hence, I cannot easily browse back to the error.
I tried playing with compilation-search-path, whithout luck.
Is there a way to force emacs to 'stay' in the compilation folder (so that the paths in the compilation buffer reference existing files ?)
Thanks
PH
If you instead use make -C ~/foobar/builds/linux, emacs should be able to track the Entering directory ..., Leaving directory ... messages that make emits and use this to keep proper references to the files.
Using jamessan advice, I could partially fix the issue by :
setting 'compilation-directory to be one of the 'source' folders (builds/linux/current/src/client)
settting 'compilation-command to change to one of those source folders using -C
Not so sure if both are needed or if it is the best way to do things ...
Thanks anyway !