[ODBC-330] MSI not created when connectors is built from source - Windows Created: 2021-08-02  Updated: 2021-08-04  Resolved: 2021-08-04

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: General
Affects Version/s: 3.1.13
Fix Version/s: 3.1.14

Type: Bug Priority: Critical
Reporter: Anel Husakovic Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: None
Environment:

Windows 10



 Description   

When following documentation https://mariadb.com/kb/en/building-mariadb-connectorodbc-from-source/
steps are ( I added for out of source, the same is happening for in source):

> mkdir bld
> cd bld
> cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off .  
> cmake --build . --config RelWithDebInfo  

We are ending with no ".msi" files created.
Note that when you run --build second time you can see the error too:

  The system cannot find the path specified.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(230
,5): error MSB6006: "cmd.exe" exited with code 3. [D:\mariadb-connector-odbc\wininstall\ODBC_WIX.vcxproj]
  odbc_basic.vcxproj -> D:\mariadb-connector-odbc\test\RelWithDebInfo\odbc_basic.exe

Also when you add CONC_WITH_MSI=ON the same happens.

When you run with cmake --build . --target MSI the error si:

D:\mariadb-connector-odbc\bld>cmake --build . --target MSI
Microsoft (R) Build Engine version 16.3.2+e481bbf88 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: MSI.vcxproj

Note you can create the logs to inspect with following command (note example is used for ".msi.vcxproj"project file , since there is no msi created() which doesn't make sense, but just as demo example how to create the logs) :

> msiexec.exe /i "D:\mariadb-connector-odbc\bld\wininstall\mariadb-connector-odbc-3.1.14-win64.msi.vcxproj" /L*V "D:\package.log" 



 Comments   
Comment by Lawrin Novitsky [ 2021-08-02 ]

Do you have WiX Toolset installed?
That's probably has to be added to Build instructions. Then cmake expects either WIX_DIR parameter with path to WiX binaries, or WIX env variable pointing to WiX directory.
Cmake neither looks up for wix binaries, nor check the correctness of the mentioned above parameters, as msi generation is not considered mandatory for build process.
On a side note - I think the name of the generated by cmake project for msi creation is PACKAGE, not MSI.

Comment by Anel Husakovic [ 2021-08-02 ]

No I hadn't.
Now I have installed, but don't see any result:

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off -DWIX_DIR="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\WiX\v3.x" ../

Can you share your way of creating msi packages?

Comment by Lawrin Novitsky [ 2021-08-02 ]

Is C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\WiX\v3.x where WiX binaries are located?
For me that is "C:\Program Files (x86)\WiX Toolset v3.10\bin\" and I have WIX env variable set to C:\Program Files (x86)\WiX Toolset v3.10\

Comment by Lawrin Novitsky [ 2021-08-02 ]

I've added WiX Toolset as prerequisite to BUILD.md, and added look up of WiX binaries in given location. No error is still returned even if they are not found, but better messages and targets generation is skipped. Possibly error would be better. I'll give it another consideration. But so far I am closing the ticket. Feel free to re-open, if you think it's needed.

Comment by Anel Husakovic [ 2021-08-02 ]

It was extension for Visual Studio. Now I have installed the same as you did, so

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off -DWIX_DIR="C:\Program Files (x86)\WiX Toolset v3.11\bin" ../

Build : cmake --build . --config RelWithDebInfo
The result on stdout:

  sha256_password.vcxproj -> D:\mariadb-connector-odbc\bld\libmariadb\RelWithDebInfo\sha256_password.dll
  '"C:\Program Files (x86)\WiX Toolset v3.11\bincandle.exe"' is not recognized as an internal or external command,
  operable program or batch file.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(230
,5): error MSB6006: "cmd.exe" exited with code 9009. [D:\mariadb-connector-odbc\bld\wininstall\ODBC_WIX.vcxproj]
  odbc_basic.vcxproj -> D:\mariadb-connector-odbc\bld\test\RelWithDebInfo\odbc_basic.exe

And stil no msi packages created.

When I use env variable the result is the same:

D:\mariadb-connector-odbc\bld>echo %WIX%
C:\Program Files (x86)\WiX Toolset v3.11\bin

Comment by Anel Husakovic [ 2021-08-02 ]

Still even with new patch,I don't get msi package in wininstall. The patch silently remove error found from Wix candle, but not creating the package needed for installation.
I'm reopening the issue.

Comment by Anel Husakovic [ 2021-08-02 ]

Can you please try yourself and let me know exact steps and where are msi located?
I can only show you what is installed in wininstall and don't know what else to trace

D:\mariadb-connector-odbc\bld>dir wininstall
 Volume in drive D is HDD 1
 Volume Serial Number is 0AC3-FE71
 
 Directory of D:\mariadb-connector-odbc\bld\wininstall
 
02.08.2021.  14:49    <DIR>          .
02.08.2021.  14:49    <DIR>          ..
02.08.2021.  12:42    <DIR>          change_dsns_driver.dir
02.08.2021.  14:49            23.937 change_dsns_driver.vcxproj
02.08.2021.  12:41               962 change_dsns_driver.vcxproj.filters
02.08.2021.  14:49    <DIR>          CMakeFiles
02.08.2021.  12:41             1.063 cmake_install.cmake
02.08.2021.  12:41            11.773 INSTALL.vcxproj
02.08.2021.  12:41               520 INSTALL.vcxproj.filters
02.08.2021.  14:42            15.523 mariadb-connector-odbc-3.1.14-win64.msi.vcxproj
02.08.2021.  12:41               776 mariadb-connector-odbc-3.1.14-win64.msi.vcxproj.filters
02.08.2021.  12:41             7.810 mariadb_odbc.xml
02.08.2021.  14:42            18.059 ODBC_WIX.vcxproj
02.08.2021.  12:41               714 ODBC_WIX.vcxproj.filters
02.08.2021.  12:41            12.189 PACKAGE.vcxproj
02.08.2021.  12:41               520 PACKAGE.vcxproj.filters
02.08.2021.  12:42    <DIR>          RelWithDebInfo
02.08.2021.  12:42    <DIR>          x64
              12 File(s)         93.846 bytes
               6 Dir(s)  1.936.068.321.280 bytes free

Comment by Lawrin Novitsky [ 2021-08-02 ]

anel, add slash to the end of WIX_DIR after bin. Apparently that is expected - can be seen in the error message. Even though it's probably wrong. I'll fix that, amend the commit, and then clsose the ticket.

Comment by Lawrin Novitsky [ 2021-08-02 ]

Btw, didn't Wix installer added WIX to environment? I kinda guess, that installer does it. Not sure though

Comment by Anel Husakovic [ 2021-08-02 ]

No it doesn't work for out of source builds:

D:\mariadb-connector-odbc\bld>cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off -DWIX_DIR="C:\Program Files (x86)\WiX Toolset v3.11\bin\" ..
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.
 
 
CMake Error: The source directory "D:/mariadb-connector-odbc/bld" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

Yes, WIX is adding system env variable (haven't noted that).

D:\mariadb-connector-odbc\bld>echo %WIX%
C:\Program Files (x86)\WiX Toolset v3.11\

However escaping the slash at the end works:

D:\mariadb-connector-odbc\bld>cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off -DWIX_DIR="C:\Program Files (x86)\WiX Toolset v3.11\bin\/" ..

And I finally got msi package:

 Directory of D:\mariadb-connector-odbc\bld\wininstall
 
02.08.2021.  18:26        14.094.336 mariadb-connector-odbc-3.1.14-win64.msi

Lawrin thanks for looking, it can be closed now and also I would recommend not to silently remove the error of wix.

Comment by Lawrin Novitsky [ 2021-08-04 ]

Basically, -DWIX_DIR=... is not required, if WIX env variable is set

Changed, that if WIX_DIR is specified, and wix is not found there, then cmake exits with error, otherwise, if wix binaries are not found, msi targets are not created.
Fixed, that it would fail, if WIX_DIR didn't have slash or backslash at the end.

Generated at Thu Feb 08 03:27:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.