building boost with emscripten on windows - windows

I am trying to build boost using emscripten on windows. In particular, I am trying to use the emscripten toolset as suggested in https://stackoverflow.com/a/47751199/5969590. However, this produces the following error for me:
C:\dev\emsdk\python\3.9.2-1_64bit\python.exe: can't open file 'c:\dev\boost_1_76_0\emcc.py': [Errno 2] No such file or directory
Somewhere in the toolchain boost tries to invoke emcc.py using python, but fails by passing the wrong module path (there is no emcc.py in c:\dev\boost_1_76_0\).
I made sure path environment variables are setup correctly by executing emsdk_env.bat. Running emcc.bat (which internally runs emcc.py) manually, executes the compiler as expected.
I inserted some debug printouts in emcc.bat and from that I gather that the boost toolchain is not using that file. It seems it tries to use python and emcc.py directly. This seems to be where things break down.
Any help or hint is greatly appreciated.
Best,
David

Problem was related to this: What is the reason for batch file path referenced with %~dp0 sometimes changes on changing directory?
I solved the problem by hacking emcc.bat to use hardcoded path to the emcc.py file.

Related

Clarify how installing Bazel on windows works?

So I'm following the install instructions for Bazel 2.0, and basically it seems like all I have to do is download the ".exe" file, add it to the path, and then I can use it from windows powershell (probably bash too, although I haven't tried). What I want to know is - does the ".exe" file do any manipulation of my system (outside of the obvious compiling work) or download anything else under the hood? I ask because I want to try it out while working on a restricted computer system, as I'm sure some of you have encountered before.
It will extract itself into the location where it also (unless configured otherwise) keeps its build output. By default this would be under current user's home directory. The location can be changed with --output_user_root parameter or TEST_TMPDIR environmental variable. You can check out the docs for more detailed description.
Adding to Ondrej K.'s answer:
Yes, you just download the .exe and add it to your PATH. Do not run it from Bash though, because it's broken. (I'm linking to the documentation at master as of 2020-02-28 and as of 2.1.0 being the most recent version. The current master will become the release doc for 2.2.0.)
Yes, Bazel will download stuff. This includes tools for the languages you build (e.g. Java), and also external dependencies of the project.
Yes, Bazel will write to disk even if you just run it once: as Ondrej K. wrote, it will extract itself to a directory.
Do not set TEST_TMPDIR to tell Bazel where to run. Setting this envvar will make Bazel believe it's running inside a test, and it will significantly reduce its resource use and change its behavior in subtle ways you probably don't want. (If you want to limit its resource use, you can do so with several flags, see --jobs and --local_ram_resources, --local_cpu_resources.)

Could not configure a C compiler (Windows)

On a Windows system, currently I'm trying a waf configure on a directory of code, and it spits out the error "could not configure a C compiler."
Now, I'm 100% certain that I have gcc and g++ installed and in my path because when I type gcc --version, it gives me the current version information. (I'm using mingw and the gcc/g++ are in the /bin subdirectory).
In the author's code directory there is a wscript file which looks like
C_COMPILER = 'gcc-4.7'
CPLUSPLUS_COMPILER = 'g++-4.7'
Now, I have tried changing the strings to simply gcc as well as gcc-4.8.1 (since my current version is 4.8.1), but it still says could not configure compiler.
I tried reading one solution on this same site that looks related, but the solution was on ubuntu and trying to work through those commands didn't help
could not configure a c compiler
I'm at the end of my common sense here after making sure I have gcc and g++ installed, trying different strings in the wscript file trying to get it to recognize I have them installed, and could use some help, thanks.
Edit: I've now tried simply deleting the lines in the wscript file where it changes the compiler name, and suddenly waf configure goes through, but the waf build fails saying things like it can't find really basic things like include vector. The output says it's defaulting to msvs (microsoft visual studio) whereas the author says gcc/g++ is needed; maybe this is the issue but how do I get waf configure/build to use g++/gcc as default?

MinGW / gcc: The application was unable to start correctly (0xc000007b)

I have been using MinGW and the GNU Fortran compiler for a while in order to compile Fortran programs on Windows, which has always been a successful method. However, I have been getting the following error for the past 4 days:
The application was unable to start correctly (0xc000007b). Click OK to close the application.
The error only happens when running applications that I wrote myself, and that I compiled using the MinGW/gfortran combo. When compiling using Visual Studio and iFort, I have no problem running the applications. The error seems retroactive: applications that were compiled using gfortran a long time ago and ran perfectly until now also break, even though I didn't recompile them. This leads me to think that it is a dynamic library problem. Online searches show that it probably is a compatibility problem between a 64-bit dll and a 32-bit application
I am using Windows 7. One of the latest things I remember doing before starting to get the problem was trying to update MinGW ; I used the mingw-get update and mingw-get upgrade command lines.
After looking around online, I have tried the following fixes:
- reinstalled the Visual C++ Runtime Environment
- reinstalled the .NET framework
- downloaded and replaced a bunch of .dlls like mscvr100.dll, mscvr100d.dll, etc...
- uninstalled and reinstalled MinGW in order to make sure I had the latest gcc version
- run Dependency Walker on a simple application ("Hello World!" type program)
Dependency Walker tells me that a number of .dlls cannot be found (full list: API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL, API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL, API-MS-WIN-CORE-WINRT-L1-1-0.DLL, API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL, API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL, API-MS-WIN-SHCORE-SCALING-L1-1-1.DLL, DCOMP.DLL, GPSVC.DLL, IESHIMS.DLL).
It also highlights in red the libquadmath-0.dll (on which libgfortran-3.dll seems to depend). Indeed, it seems that libquadmath-0.dll is a 64-bit DLL in the middle of a 32-bit program. When opening said .dll with Dependency Walker, I can see that all the modules in this library are x86 except the library itself which is x64 (CPU column of DW). I am not exactly sure how this is possible / how to fix it. The library is found in the Python/Anaconda folder (I installed Python and Anaconda a few weeks ago, the problem did NOT appear at that time).
If anybody has an idea of how to get my environment to work again without reinstalling Windows, I would greatly appreciate it! Thanks!!
I had a similar problem. Looking at Dependency Walker I wasn't loading API-MS-WIN-CORE entries. However, when I went to edit my path it turned out that by bin folder wasn't on the path. Adding, in my case the mingw64 bin folder to the path fixed this issue for me. I only mention the API-MS-WIN-CORE entries since I thought it might be the problem, but in reality it wasn't causing my issue.
I was getting this same error code, and used Dependency Walker to discover that, in my case, the 64-bit version of libwinpthread-1.dll was not being found. This helped me resolve my issue.
So, the solution is to determine the missing dll, track it down on your system and reference its location in your path variable, or find out how to install it if you don't have it.
That said, I also came across the following caveat that's important to know about when using Dependency Walker. It's currently out of date and will actually show false results for WIN-CORE dlls: https://stackoverflow.com/a/36244483/4438237
To work around this, there's a newer program called Dependencies by lucasg, that properly interprets these and won't mistakenly tell you about these falsely missing dlls.
I was getting same Error, as mentioned in above answers the problem is "path not being set" aside from setting path you can alternatively Do this; if u don't want to set the path for some reason:
Open CMD
cd C:\MinGW\bin to navigate to the bin directory of mingw
now u can compile the code as following Gcc (dir of ur .c file) -o (ur output dir) for ex : gcc I:\dir\Hello.c -o I:\dir\output.exe
alternatively if u want to automate the process u can make a batch file to automatically do it for you.
here's the batch file if anyone needs it
#echo off
C:
cd \MinGW\bin\
gcc I:\dir\*.c -o "I:\dir\Output.exe" Rem Replace "dir" with your own directory and * with ur own FileName!
pause
I had a similar error but over came it by editing my environment variables.
I had g77 as part of my path variables and by removing it and leaving gfortran alone, the error disappeared
I was on Windows 10 using cmake-gui to generate a MinGW-w64 project and meet same problem.
My solution: go to start windows, search and open MinGW-w64 terminal, then in terminal call cmake with specifiying cmake options.
Yes the old posts got it right. It is the environmental parameters messed up. I got the same error. It is solved by putting the msys64 path to the first:
Path=c:\msys64\mingw64\bin;%PATH%
The msys64 path was the last, now it is the first. Type it once at the command line after Windows started, or edit the Path environmental parameter if you have the admin right.

Using Google's ProtoBuf (and a .proto file) to create a Python API Library

I have the .proto file used in the open-source Android API (http://code.google.com/p/android-market-api/), and am having some trouble compiling the file to generate the .py.
I'm trying to follow the instructions here, https://developers.google.com/protocol-buffers/docs/pythontutorial , and am on the steps that are under the header "Compiling Your Protocol Buffers".
I've downloaded the compiler, protoc.exe. The readme says "To install, simply place this binary somewhere in your PATH," which I'm not understanding. I'm messed around with it for a while now, but can't think of how to proceed.
I'm quite the novice programmer, so please tell me if something isn't clear, or if I'm having some sort of fundamental misunderstanding... about anything. I'm on Windows 7 by the way.
Thanks!
if protoc.exe is not in the same directory you're calling it from, you need to add it to your PATH environment variable to be accessible from the calling directory when you're in the shell. open up a command shell and execute:
set PATH=%PATH%c:\directory\to\proto\executable;
then change directories over to where your source code is and execute the compilation line as instructed from the google page.
I had the same problem because it is not written that clear in the README.txt. What they mean is to:
1. take the protoc.exe and put it in the same folder with the other files of your project.
2. open the cmd to that directory and run: protoc --cpp_out=. myfile.proto
=> This will create the 2 new files in the folder with the files of your project, and then you can add them normally to your program.
This helped me: http://www.scriptol.com/programming/protocol-buffers-tutorial.php
This is for c++, but I guess it will be something similar for python; I guess you just have to change the command you are using in the cmd :)

Configuring Bison to compile an input file under Visual C 6

I'm trying to get Bison to do it's thing in VC6. I'm sure this must be a problem with my configuration. At the moment I have a Custom Build step as follows.
<Commands>
echo Start parser generation
"C:\GnuWin32\bin\bison.exe" $(InputPath)
echo Finish parser generation
<Outputs>
$(ProjDir)\$(InputName).c
$(ProjDir)\$(InputName).h
The error I get is "C:\GnuWin32\bin\bison.exe: m4: No such file or directory", which makes me think the m4.exe doesn't exist or isn't on the path, but I can run the exact same command from CMD in the same directory with no errors.
This thought process makes me think it's a problem with the output options, but I've tried various configurations with no luck.
Any help would be great, thanks in advance.
Edit: I've added some more visual studio versions to the tag list to try to get some more exposure for the question. Hopefully someone will have done this in a later version and I can work backwards.
Okay, I've managed to slove this in a very round-about way but I will try my best to document it here.
It seems that VC6 Custom build options will only look in the project directory for the m4.exe, even when you specify where the calling exe (bison) is explicitly. To solve this I did a bit of a hack and did a full cd command in the custom build window to get to the gnuwin32 directory (where both bison and m4 live) before trying to call the parser generator.
This works fine but is a bit of a hassle for trying to distribute it to other people when they may have installed GNU tools to a different location.

Resources