lhmouse / mcfgthread

Cornerstone of the MOST efficient std::thread on Windows for mingw-w64
https://gcc-mcf.lhmouse.com/
Other
277 stars 28 forks source link

Compilation problem with MSYS2 #25

Closed eldiener closed 7 years ago

eldiener commented 7 years ago

When trying to build your library under MSYS2 using mingw-64 I get this error:

"Building shared library... x86_64-w64-mingw32-gcc -x c-header -DHAVE_CONFIG_H -Wall -Wextra -pedantic -pedantic-errors -Werror -Wwrite-strings -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Winvalid-pch -Wundef -Wshadow -Wstrict-aliasing=2 -Wstrict-overflow=5 -pipe -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel -ffreestanding -DNDEBUG $(echo "" "-include pch.h -std=c11 -Wstrict-prototypes" | sed "s/-include pch\.h//") -O3 -ffunction-sections -fdata-sections -m64 pch.h -o pch.h.gch __pch.h:1:70: fatal error: /e/Programming/VersionControl/mcfgthread/src/env/_crtdef.h: No such file or directory

include "/e/Programming/VersionControl/mcfgthread/src/env/_crtdef.h"

                                                                  ^

compilation terminated. make: *** [Makefile:1143: __pch.h.gch] Error 1"

Yet when I do:

ls -al /e/Programming/VersionControl/mcfgthread/src/env/_crtdef.h

the output is:

-rw-r--r-- 1 eldnew8 None 2107 Apr 5 20:24 /e/Programming/VersionControl/mcfgthread/src/env/_crtdef.h

so clearly the file exists. Any ideas why gcc tells me that there is no such file or directory ?

lhmouse commented 7 years ago

This was because the rule

__pch.h: ${srcdir}/src/env/_crtdef.h
    echo "#include \"$<\"" > $@

generated an #include directive with an absolute POSIX path that a native GCC would not accept.

It was an oversight. David had a partially correct solution here. Note that the path is meant to be placed in double quotes, so cygpath -w would cause problems because of backslashes. We have to use cygpath -m here.

lhmouse commented 7 years ago

Thanks for the report. Please pull and try again. The problem should no longer happen.

eldiener commented 7 years ago

Thanks, your fix enabled me to correctly build both a 32-bit and 64-bit version of your library.

lhmouse commented 7 years ago

:joy: