Thread overview
Trouble with building LDC on Windows, specifically with building libconfig
Jul 13, 2015
Eappen Nelluvelil
Jul 13, 2015
Kai Nacke
Jul 18, 2015
Eappen Nelluvelil
Jul 20, 2015
Kai Nacke
Jul 21, 2015
Eappen Nelluvelil
Jul 22, 2015
Johan
Jul 22, 2015
Johan
Jul 23, 2015
Kai Nacke
Jul 28, 2015
Johan Engelen
July 13, 2015
Hello, I am trying to build LDC on my machine (Windows 7 x86_64), but I am running into some trouble with building libconfig.

I am using msys2-i686, along with the compilers and tools provided via msys2 (gcc/g++ 4.9.2 and make 4.1). This is a slight change from the D wiki instructions on building LDC on Windows, as the instructions assumed the usage of msys (I am not sure if this change breaks the build process). I downloaded libconfig-1.5, and when I am in a bash instance via msys2, the configure script within the root level runs perfectly fine. However, when I issue the command make, the build stops due to some failing tests. I am not sure if I am doing something incorrectly or if I need to follow different directions to build libconfig successfully on my machine.

If it is of any help, I have created a gist of the output given when make is run:
https://gist.github.com/anonymous/fe03f33ab7fd59ed47fe

If anyone could help me out with this issue, I would be eternally grateful.
July 13, 2015
On Monday, 13 July 2015 at 05:39:40 UTC, Eappen Nelluvelil wrote:
> Hello, I am trying to build LDC on my machine (Windows 7 x86_64), but I am running into some trouble with building libconfig.
>
> I am using msys2-i686, along with the compilers and tools provided via msys2 (gcc/g++ 4.9.2 and make 4.1). This is a slight change from the D wiki instructions on building LDC on Windows, as the instructions assumed the usage of msys (I am not sure if this change breaks the build process). I downloaded libconfig-1.5, and when I am in a bash instance via msys2, the configure script within the root level runs perfectly fine. However, when I issue the command make, the build stops due to some failing tests. I am not sure if I am doing something incorrectly or if I need to follow different directions to build libconfig successfully on my machine.
>
> If it is of any help, I have created a gist of the output given when make is run:
> https://gist.github.com/anonymous/fe03f33ab7fd59ed47fe
>
> If anyone could help me out with this issue, I would be eternally grateful.

Hi Eappen,

please try building with libconfig-1.4.9 (the previous version). I had some trouble with libconfig-1.5, too, and did not yet have the time to investigate.

Regards,
Kai
July 18, 2015
On Monday, 13 July 2015 at 05:49:45 UTC, Kai Nacke wrote:
> On Monday, 13 July 2015 at 05:39:40 UTC, Eappen Nelluvelil wrote:
>> Hello, I am trying to build LDC on my machine (Windows 7 x86_64), but I am running into some trouble with building libconfig.
>>
>> I am using msys2-i686, along with the compilers and tools provided via msys2 (gcc/g++ 4.9.2 and make 4.1). This is a slight change from the D wiki instructions on building LDC on Windows, as the instructions assumed the usage of msys (I am not sure if this change breaks the build process). I downloaded libconfig-1.5, and when I am in a bash instance via msys2, the configure script within the root level runs perfectly fine. However, when I issue the command make, the build stops due to some failing tests. I am not sure if I am doing something incorrectly or if I need to follow different directions to build libconfig successfully on my machine.
>>
>> If it is of any help, I have created a gist of the output given when make is run:
>> https://gist.github.com/anonymous/fe03f33ab7fd59ed47fe
>>
>> If anyone could help me out with this issue, I would be eternally grateful.
>
> Hi Eappen,
>
> please try building with libconfig-1.4.9 (the previous version). I had some trouble with libconfig-1.5, too, and did not yet have the time to investigate.
>
> Regards,
> Kai

Kai, I ran into another problem. The configure script works as expected, and libconfig builds successfully. However, when I am trying to build ldc, I run into an issue with the location of the correct dll. On the D wiki page for building LDC from source for MinGW, the cmake command to build LDC works, but then the Ninja configuration file doesn't seem to run.

I have created a gist of the output when cmake and ninja are run:
https://gist.github.com/anonymous/83ba87ea2a8d9f0c3722

I am not really sure where to go on from here.
July 20, 2015
On Saturday, 18 July 2015 at 03:33:26 UTC, Eappen Nelluvelil wrote:
> Kai, I ran into another problem. The configure script works as expected, and libconfig builds successfully. However, when I am trying to build ldc, I run into an issue with the location of the correct dll. On the D wiki page for building LDC from source for MinGW, the cmake command to build LDC works, but then the Ninja configuration file doesn't seem to run.
>
> I have created a gist of the output when cmake and ninja are run:
> https://gist.github.com/anonymous/83ba87ea2a8d9f0c3722
>
> I am not really sure where to go on from here.

Hi Eappen!

I currently have no idea. I simply compile and install libconfig into /usr/local. Then the linker picks up the library automatically and you do not need to specify the path to the include and lib file.

At least one error is there: you need to link against libconfig.dll.a because the C version is used by ldc (I changed this some time ago).

The policy complain from CMake was introduced in cmake 3.3. The latest cmake I used to build ldc is currently 3.2.3 therefore I did not encounter this message. I will fix it as soon as I have some more time. The easiest "fix" is to use an older version of CMake.

You may want to have a look at the build scripts used to create a release: https://github.com/ldc-developers/ldc-scripts/tree/master/ldc2-packaging
They work on MingW, too, and use ninja to build ldc.

Regards,
Kai
July 21, 2015
On Monday, 20 July 2015 at 05:53:31 UTC, Kai Nacke wrote:
> On Saturday, 18 July 2015 at 03:33:26 UTC, Eappen Nelluvelil wrote:
>> Kai, I ran into another problem. The configure script works as expected, and libconfig builds successfully. However, when I am trying to build ldc, I run into an issue with the location of the correct dll. On the D wiki page for building LDC from source for MinGW, the cmake command to build LDC works, but then the Ninja configuration file doesn't seem to run.
>>
>> I have created a gist of the output when cmake and ninja are run:
>> https://gist.github.com/anonymous/83ba87ea2a8d9f0c3722
>>
>> I am not really sure where to go on from here.
>
> Hi Eappen!
>
> I currently have no idea. I simply compile and install libconfig into /usr/local. Then the linker picks up the library automatically and you do not need to specify the path to the include and lib file.
>
> At least one error is there: you need to link against libconfig.dll.a because the C version is used by ldc (I changed this some time ago).
>
> The policy complain from CMake was introduced in cmake 3.3. The latest cmake I used to build ldc is currently 3.2.3 therefore I did not encounter this message. I will fix it as soon as I have some more time. The easiest "fix" is to use an older version of CMake.
>
> You may want to have a look at the build scripts used to create a release: https://github.com/ldc-developers/ldc-scripts/tree/master/ldc2-packaging
> They work on MingW, too, and use ninja to build ldc.
>
> Regards,
> Kai

Hi Kai!

I gave up on building on Windows. I was running into all sorts of issues with Ninja and libconfig, and I couldn't get ldc to link against libconfig.all.a. I'm going to assume it's most likely an issue with my toolchain, because msys2 is kinda broken for me, and Cygwin wasn't faring any better. Good news is that I got a Lubuntu virtual machine up and running, and I after an hour or so of hunting down some needed packages, I got ldc up and running successfully :) I'll keep looking into the issues with building ldc on Windows (for some odd reason, MSVC wasn't working either, and it ended up having to do with libconfig). Oh well :P Thanks for helping me out Kai!
July 22, 2015
On Tuesday, 21 July 2015 at 07:46:32 UTC, Eappen Nelluvelil wrote:
>
> I gave up on building on Windows. I was running into all sorts of issues with Ninja and libconfig, and I couldn't get ldc to link against libconfig.all.a. I'm going to assume it's most likely an issue with my toolchain, because msys2 is kinda broken for me, and Cygwin wasn't faring any better. Good news is that I got a Lubuntu virtual machine up and running, and I after an hour or so of hunting down some needed packages, I got ldc up and running successfully :) I'll keep looking into the issues with building ldc on Windows (for some odd reason, MSVC wasn't working either, and it ended up having to do with libconfig). Oh well :P Thanks for helping me out Kai!

I am back on D development after a short break, and I am rebuilding my build setup ;)
Just now I succeeded building LDC on Windows using MSVC 2015 Community + LLVM 3.7 + libconfig-1.4.9.
Next week I'll have time to fix up the wiki page on how to build LDC, but I believe it is pretty much as described there. I jotted down some hints below, hope this helps.

I built libconfig by following these instructions from the wiki page:

Alternative you can use a custom CMakeLists.txt:
- Extract libconfig source.
- Download CMakeLists.txt from this gist and place it into the root folder.
- Create a build directory: md build_libconfig
- cd build_libconfig
- Now create the build files:
  cmake ..\libconfig-1.4.9

Then, I opened 'libconfig++.sln' in MSVC 2015, changed the 'active solution platform' to x64 (some clicking involved), then Ctrl+Shift+B for build. The build output ends with
"2>  libconfig++.vcxproj -> E:\libconfig-1.4.9\build_msvc2015\x64\Debug\libconfig++.lib"
So that's where the .lib file went, which is needed for the cmake command to build LDC.

To build LDC, I have a 'run_cmake.bat' file in a separate 'build' folder in the ldc checkout, that contains:

cmake -G Ninja -DCMAKE_INSTALL_PREFIX="E:/ldc_msvc/ldc37/install" -DCMAKE_CXX_FLAGS="/DWIN32 /D_HAS_EXCEPTIONS=0 /MP /W2 /GR- /GS- /d2Zi+" -DLLVM_ROOT_DIR="E:/ldc_msvc/LLVM37" -DLIBCONFIG_INCLUDE_DIR="E:/libconfig-1.4.9/lib" -DLIBCONFIG_LIBRARY="E:/libconfig-1.4.9/build_msvc2015/x64/Debug/libconfig++.lib" ..

July 22, 2015
Perhaps obvious but important: this was all done using the "VS2015 x64 Native Tools Command Prompt".
July 23, 2015
On Wednesday, 22 July 2015 at 21:19:26 UTC, Johan wrote:
> Alternative you can use a custom CMakeLists.txt:

Did you have a look at https://github.com/ldc-developers/ldc-scripts/blob/master/ldc2-win64/RELEASE.proj?

Regards,
Kai
July 28, 2015
On Thursday, 23 July 2015 at 04:52:50 UTC, Kai Nacke wrote:
> On Wednesday, 22 July 2015 at 21:19:26 UTC, Johan wrote:
>> Alternative you can use a custom CMakeLists.txt:
>
> Did you have a look at https://github.com/ldc-developers/ldc-scripts/blob/master/ldc2-win64/RELEASE.proj?

Hi Kai,
  First time I see it!

-Johan