Re: [CMake] CMAKE_SIZEOF_VOID_P is unset when building libgit2 on Windows

2016-03-29 Thread Sebastian Schuberth
On 3/29/2016 11:39, Sebastian Schuberth wrote:

>>$ cat CMakeLists.txt
>>cmake_minimum_required(VERSION 3.5)
>>project(test C)
>>message("${CMAKE_SIZEOF_VOID_P}")
>>
>> If that reproduces the problem, try configuring with --debug-trycompile
>> so that the CMakeFiles/CmakeTmp/CMakeFiles/cmTC_*.dir/build.make files
>> will be left behind for inspection.
> 
> Yes, that does reproduce the issue, ${CMAKE_SIZEOF_VOID_P} evaluates to an 
> empty string. I was looking at the CMakeFiles/cmTC_21eb3.dir/build.make file 
> for CMakeCCompilerABI but was not seeing any suspicious. Calling
> 
> $ /c/Ruby-DevKit/bin/make -f CMakeFiles/cmTC_21eb3.dir/build.make 
> cmTC_21eb3.exe
> 
> Also successfully builds the executable.
> 
> What should I try next?

Ok, I seem to have found the root cause of the problem. Altough CMake is 
correctly using gcc from C:/Ruby-DevKit/mingw/bin/gcc.exe, it's using gmake 
from C:/Strawberry/c/bin/gmake.exe (which is from Strawberry Perl that I also 
have installed). Ruby-DevKit does not come with gmake.exe, only with 
bin/make.exe (and with mingw/bin/mingw32-make.exe). But for some reason CMake 
seems to prefer gmake over make, despite the latter coming from the same parent 
directory than gcc.

While C:/Ruby-DevKit/bin/make.exe is an executable linked against MSYS-1.0.DLL 
that understands Unix-style paths on Windows, C:/Strawberry/c/bin/gmake.exe is 
a native Windows exeutable linked against MSVCRT.DLL that does not. Removing 
C:/Strawberry/c/bin from PATH so that CMake doe snot find gmake properly works 
around the issue for me.

So far, so good, but I'm yet unsure what's the best / most generic fix for 
this. As Ruby-DevKit is based on MSYS, I tried to replace "Unix Makefiles" in

$ cmake .. -DBUILD_CLAR=OFF -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF 
-DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=RelWithDebInfo -G "Unix Makefiles"

with "MSYS Makefiles" so that it reads

$ cmake .. -DBUILD_CLAR=OFF -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF 
-DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=RelWithDebInfo -G "MSYS Makefiles"

and that seems to work.

Brad, do you think that's a reasonable fix? What's the difference between 
CMake's "Unix Makefiles" and "MSYS Makefiles" anyway?

Regards,
Sebastian


-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


Re: [CMake] CMAKE_SIZEOF_VOID_P is unset when building libgit2 on Windows

2016-03-29 Thread Sebastian Schuberth
On 3/28/2016 16:09, Brad King wrote:

>> /usr/bin/sh: -c: line 0: syntax error near unexpected token `('
>> /usr/bin/sh: -c: line 0: `C:/Ruby-DevKit/mingw/bin/gcc.exe-fPIC
>> -o CMakeFiles/cmTC_c0166.dir/CMakeCCompilerABI.c.obj   -c \C:/Program
>> Files (x86)/CMake/share/cmake-3.5/Modules/CMakeCCompilerABI.c\'
>> CMakeFiles/cmTC_c0166.dir/build.make:65: recipe for target
>> 'CMakeFiles/cmTC_c0166.dir/CMakeCCompilerABI.c.obj' failed
>> ---8<---
>>
>> There seems to be some problem in escaping the non-alphanumeric chars
>> in the path to "CMakeCCompilerABI.c".
> 
> Strange.  CMake is regularly used from "C:/Program Files (x86)/CMake".
> 
>> Any hint how to debug this further?
> 
> Try running the logged compiler command line by hand:
> 
>C:/Ruby-DevKit/mingw/bin/gcc.exe -c "C:/Program Files 
> (x86)/CMake/share/cmake-3.5/Modules/CMakeCCompilerABI.c"

This seems to work, with no output on the console and an exit code of 0.

> Also try configuring a small test project in a fresh build tree:
> 
>   $ cat CMakeLists.txt
>   cmake_minimum_required(VERSION 3.5)
>   project(test C)
>   message("${CMAKE_SIZEOF_VOID_P}")
> 
> If that reproduces the problem, try configuring with --debug-trycompile
> so that the CMakeFiles/CmakeTmp/CMakeFiles/cmTC_*.dir/build.make files
> will be left behind for inspection.

Yes, that does reproduce the issue, ${CMAKE_SIZEOF_VOID_P} evaluates to an 
empty string. I was looking at the CMakeFiles/cmTC_21eb3.dir/build.make file 
for CMakeCCompilerABI but was not seeing any suspicious. Calling

$ /c/Ruby-DevKit/bin/make -f CMakeFiles/cmTC_21eb3.dir/build.make cmTC_21eb3.exe

Also successfully builds the executable.

What should I try next?

Regards,
Sebastian


-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


Re: [CMake] CMAKE_SIZEOF_VOID_P is unset when building libgit2 on Windows

2016-03-28 Thread Brad King
On 03/25/2016 05:08 PM, Sebastian Schuberth wrote:
> Looking at CMakeError.log was a good hint. I found:
> 
> C:/Ruby-DevKit/mingw/bin/gcc.exe-fPIC-o
> CMakeFiles/cmTC_c0166.dir/CMakeCCompilerABI.c.obj   -c "C:/Program
> Files (x86)/CMake/share/cmake-3.5/Modules/CMakeCCompilerABI.c"
> 
> /usr/bin/sh: -c: line 0: syntax error near unexpected token `('
> /usr/bin/sh: -c: line 0: `C:/Ruby-DevKit/mingw/bin/gcc.exe-fPIC
> -o CMakeFiles/cmTC_c0166.dir/CMakeCCompilerABI.c.obj   -c \C:/Program
> Files (x86)/CMake/share/cmake-3.5/Modules/CMakeCCompilerABI.c\'
> CMakeFiles/cmTC_c0166.dir/build.make:65: recipe for target
> 'CMakeFiles/cmTC_c0166.dir/CMakeCCompilerABI.c.obj' failed
> ---8<---
> 
> There seems to be some problem in escaping the non-alphanumeric chars
> in the path to "CMakeCCompilerABI.c".

Strange.  CMake is regularly used from "C:/Program Files (x86)/CMake".

> Any hint how to debug this further?

Try running the logged compiler command line by hand:

  C:/Ruby-DevKit/mingw/bin/gcc.exe -c "C:/Program Files 
(x86)/CMake/share/cmake-3.5/Modules/CMakeCCompilerABI.c"

Also try configuring a small test project in a fresh build tree:

 $ cat CMakeLists.txt
 cmake_minimum_required(VERSION 3.5)
 project(test C)
 message("${CMAKE_SIZEOF_VOID_P}")

If that reproduces the problem, try configuring with --debug-trycompile
so that the CMakeFiles/CmakeTmp/CMakeFiles/cmTC_*.dir/build.make files
will be left behind for inspection.

-Brad
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


Re: [CMake] CMAKE_SIZEOF_VOID_P is unset when building libgit2 on Windows

2016-03-25 Thread Gregor Jasny via CMake
On 25/03/16 22:11, Sebastian Schuberth wrote:
> I also just realized CMAKE_C_ABI_COMPILER is set to FALSE in
> CMakeCCompiler.cmake. Looking at CMakeError.log was a good hint. I
> found:
> 
> ---8<---
> Building C object CMakeFiles/cmTC_c0166.dir/CMakeCCompilerABI.c.obj
> 
> C:/Ruby-DevKit/mingw/bin/gcc.exe-fPIC-o
> CMakeFiles/cmTC_c0166.dir/CMakeCCompilerABI.c.obj   -c "C:/Program
> Files (x86)/CMake/share/cmake-3.5/Modules/CMakeCCompilerABI.c"
> 
> /usr/bin/sh: -c: line 0: syntax error near unexpected token `('
> /usr/bin/sh: -c: line 0: `C:/Ruby-DevKit/mingw/bin/gcc.exe-fPIC
> -o CMakeFiles/cmTC_c0166.dir/CMakeCCompilerABI.c.obj   -c \C:/Program
> Files (x86)/CMake/share/cmake-3.5/Modules/CMakeCCompilerABI.c\'
> CMakeFiles/cmTC_c0166.dir/build.make:65: recipe for target
> 'CMakeFiles/cmTC_c0166.dir/CMakeCCompilerABI.c.obj' failed
> ---8<---

To unblock you until the problem is sorted out you might want to install
a 64bit version of cmake which should not have the problematic (x86) in
the path (or you choose a custom install location).

http://ifw.podsvirov.pro/cmake/files/v3.5/

Hope that helps,
Gregor

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


Re: [CMake] CMAKE_SIZEOF_VOID_P is unset when building libgit2 on Windows

2016-03-25 Thread Sebastian Schuberth

On 3/24/2016 16:53, Brad King wrote:


Configuring libgit2 fails as CMake does not set CMAKE_SIZEOF_VOID_P
(nor CMAKE_C_SIZEOF_DATA_PTR), see the attached CMakeCCompiler.cmake file.

I tried to search CMake's source code to find out how the value of
@CMAKE_C_SIZEOF_DATA_PTR@ is determined in CMakeCCompiler.cmake.in,
but I failed. Does anyone have suggestions on how to debug this further,
or what the possible root causes might be?


It is supposed to be done here:

  
https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeDetermineCompilerABI.cmake;hb=v3.5.0#l23
  
https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeCCompilerABI.c;hb=v3.5.0

The try_compile produces a binary file that encodes strings with the
information.  Then we use file(STRINGS) to parse the strings right out
of the binary.  The INFO:sizeof_dptr[...] string contains the size of
data pointer types.

Check CMakeFiles/CMake{Output,Error}.log to see if anything went wrong
with that step that was logged.  Otherwise you can add debugging code.


I also just realized CMAKE_C_ABI_COMPILER is set to FALSE in
CMakeCCompiler.cmake. Looking at CMakeError.log was a good hint. I
found:

---8<---
Building C object CMakeFiles/cmTC_c0166.dir/CMakeCCompilerABI.c.obj

C:/Ruby-DevKit/mingw/bin/gcc.exe-fPIC-o
CMakeFiles/cmTC_c0166.dir/CMakeCCompilerABI.c.obj   -c "C:/Program
Files (x86)/CMake/share/cmake-3.5/Modules/CMakeCCompilerABI.c"

/usr/bin/sh: -c: line 0: syntax error near unexpected token `('
/usr/bin/sh: -c: line 0: `C:/Ruby-DevKit/mingw/bin/gcc.exe-fPIC
-o CMakeFiles/cmTC_c0166.dir/CMakeCCompilerABI.c.obj   -c \C:/Program
Files (x86)/CMake/share/cmake-3.5/Modules/CMakeCCompilerABI.c\'
CMakeFiles/cmTC_c0166.dir/build.make:65: recipe for target
'CMakeFiles/cmTC_c0166.dir/CMakeCCompilerABI.c.obj' failed
---8<---

There seems to be some problem in escaping the non-alphanumeric chars
in the path to "CMakeCCompilerABI.c". Any hint how to debug this
further?

Regards,
Sebastian


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


Re: [CMake] CMAKE_SIZEOF_VOID_P is unset when building libgit2 on Windows

2016-03-24 Thread Brad King
On 03/24/2016 11:28 AM, Sebastian Schuberth wrote:
> Configuring libgit2 fails as CMake does not set CMAKE_SIZEOF_VOID_P
> (nor CMAKE_C_SIZEOF_DATA_PTR), see the attached CMakeCCompiler.cmake file.
> 
> I tried to search CMake's source code to find out how the value of
> @CMAKE_C_SIZEOF_DATA_PTR@ is determined in CMakeCCompiler.cmake.in,
> but I failed. Does anyone have suggestions on how to debug this further,
> or what the possible root causes might be?

It is supposed to be done here:

 
https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeDetermineCompilerABI.cmake;hb=v3.5.0#l23
 
https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeCCompilerABI.c;hb=v3.5.0

The try_compile produces a binary file that encodes strings with the
information.  Then we use file(STRINGS) to parse the strings right out
of the binary.  The INFO:sizeof_dptr[...] string contains the size of
data pointer types.

Check CMakeFiles/CMake{Output,Error}.log to see if anything went wrong
with that step that was logged.  Otherwise you can add debugging code.

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake