Skip to content

cpp build error notes

BergWerkGIS edited this page Oct 21, 2014 · 5 revisions

Page listing problems and solutions found for C++ related build errors you might encounter with source builds of new Mason packages.

Windows

Good to know

Create patch files

Say the patch needs to be against Makefile.win...

  • cp Makefile.win Makefile.win_
  • Manually edit Makefile.win
  • diff -u Makefile.win_ Makefile.win > ../../../patchs/some.diff
  • then commit that some.diff to git
  • then apply it on the fly in the build script with patch

When I need to create patches that span multiple files I just do git init . && git add . then edit things and do git diff to get the patch out. I later apply it still with the patch command.

Monitor build output on the console and redirect to file, too

When building e.g. mapnik-dependencies, mapnik and node-mapnik all at once, thousands of messages are displayed and it is easy to miss an important one.

With mtee it is possible to view the output on the console and have it redirected to a log file at the same time. The log file can then be searched easily for warnings or errors.

Usage: build.bat | mtee mylogfile.txt


Discover dynamic shared library dependencies

  • win-ldd Google Code
  • dumpbin /DEPENDENTS, MSDN: "Dumps the names of the DLLs from which the image imports functions. Does not dump the names of the imported functions. Only the /HEADERS DUMPBIN option is available for use on files produced with the /GL compiler option."
  • for running processes: tasklist /m MSDN: Tasklist. Filter to cmd.exe: tasklist /m /fi "imagename eq cmd.exe"

Determine if a lib has been built with /MT or /MD

One way is to use dumpbin's /DIRECTIVES option to find which runtime libraries the objects in the .lib want to link with:

dumpbin /directives foo.lib

Look for instances of the runtime libraries specified here (MSDN: CRT Library Features).

For example, you might see:

  • /DEFAULTLIB:MSVCRT: /MD)
  • /DEFAULTLIB:MSVCRTD: /MDd
  • /DEFAULTLIB:MSVCRT: /MD
  • /DEFAULTLIB:LIBCMT: /MT

There will probably be many /DEFAULTLIB directives, so you can search using terms like:

Usage: dumpbin /DIRECTIVES foo.lib | find /i "msvcr"


Determine if a EXE, DLL or LIB is native, 32/64bit or .NET assembly

Install Manta Property Extension. Afterwards you will see things like 32-bit Library file, 64-bit DLL, 32-bit GUI Application and the like in the details pane.


npm install Error: ENOENT, stat 'C:\Users<USER>\AppData\Roaming\npm'

SOLUTION: Manually create the directory shown in the error message.