My custom build rule does not work in VGDB project

Sysprogs forums Forums VisualGDB My custom build rule does not work in VGDB project

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #20191
    Michael
    Participant

    Hello, I have win_flex custom build rule that works in Windows projects of the solution. I have added the corresponding VGDB Linux project and it compiles and links well. But as I have found out it takes the lexical scanner generated by Windows build, copies it onto the Linux machine and does not run the custom build step for the Linux (VGDB) build at all!!! When I try to compile the same lex file (the same file belongs to the Windows and VGDB Linux projects) I get the modal pop-up window “Windows cannot find ‘win_flex.exe’ …”. Again the same file can be compiled with win_flex.exe from the corresponding Windows project. The custom build settings are identical but it looks like this is not the issue — I renamed win_flex.exe and got the same error for Windows builds too. I renamed it back and Windows project builds and VGDB does not.

    Please note the additional problem. VGDB Linux project with the flex custom build rule builds OK when I press the Build Project button. It uses the xxx.cpp lexer file from the Windows build and does not run the custom build rule itself!!! It fails with the error message above only when I select lex file in the project manager and select compile the lex file with the right-click menu item. I probably shall mention that I run custom build flex step on the Windows machine and you probably expect win_flex.exe on Linux (just a guess).

    I have reread my message it see it is rather messy and repeats itself. Sorry but it is pretty late already. So there are two problems:

    1. The VGDB project does not see win_flex.exe (win_flex.exe in the Windows system path and can be run from anywhere) when I choose compile lex file menu option.

    2. The VGDB project does not run flex custom build step when I choose Project build menu item. It copies lexical scanner (cpp file) generated by the Windows build to the Linux machine.

    #20197
    support
    Keymaster

    Hi,

    The custom rules defined for Windows projects might not work out-of-the-box for Linux. Please try following our Qt MSBuild tutorial for a detailed example of defining rules for running custom tools on Linux. If you have any further questions, please feel free to share more details about your current setup (e.g. what exact rules you are using) and we will try to help you.

    #20198
    Michael
    Participant

    > Please try following our <span style=”color: #24890d;”>Qt MSBuild tutorial</span> for a detailed example of defining rules for
    > running custom tools on Linux

    Sorry, but as I have written above “I probably shall mention that I run custom build flex step on the Windows machine and you probably expect win_flex.exe on Linux (just a guess).” I do not run my custom tools on Linux. I have mentioned it specially even the name of the custom tool — win_flex.exe  — undoubtedly says this is the Windows executable. I have read the article you have pointed me out and I still cannot figure out why VGDB project cannot find win_flex.exe. Am I right in my assumption that it looks for it on the Linux machine? This is not my case. I need custom build step on the Windows machine.

    BTW my assertion that VGDB uses Windows project build generated flex scanner was totally wrong — the Windows generated scanner cannot be compiled with gcc due to Windows includes like io.h and missing unistd.h (win_fflex does have Windows compatibility option and there is the different for Windows and VGDB project). The reason why I was able to compile VGDB project is that the scanner have been generated with MS native Linux build step. So MS Linux project runs my flex custom build step correctly.

    So I believe you do not understand my problem. I need VGDB run custom build step on the Windows machine, my custom tool is on the Windows system path and is visible from anywhere on my Windows machine. More over during the project build phase (solution explorer–>my project–>right click–>Build) VGDB totally ignores custom build step and even if it is incorrect does not emit any error. The custom build step can be started only for solution explorer–>my project–>lex file–>right click–>Compile sequence (and it fails with unfound win_flex.exe error).

    Can you please reconsider my problem?

    #20228
    support
    Keymaster

    Hi,

    No problem, we have double-checked the setup steps to support this and will provide the detailed instructions below. Please follow the instructions below first to check that all rules get processed properly, and then change the rules to use your actual build tool:

    1. Create 2 empty files in the project directory: test1.x and test2.x
    2. Add them to your .vcxproj file using the <CustomFile> element:
       <ItemGroup>
       <CustomFile Include="test1.x" />
       <CustomFile Include="test2.x" />
       </ItemGroup>
    3. Add a new target that will “compile” them (in this example we will just change the extension to .c):
       <Target Name="CompileCustomFiles">
         <Exec Command="copy /y %(CustomFile.Identity) @(CustomFile->'%(filename).c')" Condition="@(CustomFile) != ''"/>
         <ItemGroup>
           <ClCompile Include="@(CustomFile->'%(filename).c')"/>
         </ItemGroup>
       </Target>
    4. Finally register the new target with VisualGDB:
       <PropertyGroup>
       <ComputeCompileInputsTargets>$(ComputeCompileInputsTargets);CompileCustomFiles</ComputeCompileInputsTargets>
       </PropertyGroup>

    When you build the project, you should see VisualGDB copy the 2 files and then send the resulting files along with your sources to Linux before they are built:

    1>------ Build started: Project: LinuxProject, Configuration: Debug VisualGDB ------
    1> 1 file(s) copied.
    1> 1 file(s) copied.
    1>VisualGDB: Sending 3 updated source files to build machine...
    1>VisualGDB: Run "make -f "VisualGDB/Debug/LinuxProject.msbuild-mak" --no-print-directory" in directory "/tmp/VisualGDB/e/projects/temp/LinuxProject" on testuser@kubuntu17vm (SSH)
    1>LinuxProject.cpp
    1>Linking VisualGDB/Debug/LinuxProject...
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

    Let us know if you have any further questions and we will be happy to answer them.

    #20247
    Michael
    Participant

    I thank you for your help. But it looks like I am not qualified enough to make someone else custom build rule to apply to VGDB. I use win_flex_bison-2.5.5.zip (679159 bytes long and it exceeds your maximum attachment size but it is available on the internet by name). The project looks like to be here https://sourceforge.net/projects/winflexbison/ and I am ready to update my winflexbison to the up-to-date version.
    It looks like with their VS custom build rules I already have bullets 2 and 3. And I just need to register with VGDB somehow. I also suspect their way to run win_flex.exe (I use flex only) confuses the VGDB plug-in. If you have a possibility to provide me any help with the win_flex custom build rule from win_flex_bison-2.5.5.zip or up-to-date version I would really appreciate it.

    #20248
    support
    Keymaster

    Hi,

    Sure, we can do it as a part of our short-term consulting program. Please feel free to contact our sales to get a quote.

    #20251
    Michael
    Participant

    Very honest, thank you. We are evaluating VGDB to see if it is capable to perform our basic everyday tasks right now. At this very moment our situation is as following:
    1. We can use our official build system on Linux (it is rather inconvenient for development process) and native Visual Studio 2017 Linux support for debugging only (VS just cannot build our complex projects on Linux now).
    2. We can purchase VGDB and support and try to solve its existing problems (at least problems for us).
    3. We can continue to use (1) and look for other solutions (like WinGDB and… these are all options as I believe).

    Personally I believe in VGDB and your ability to make it the way we need it (to fully mimic Windows facilities). But our hardware guys will need the things to be available just out of the box (they completely lack the curiosity for taking troubles with new stuff). So we will need to estimates all our options.
    I thank you for your help and very interesting product.

    #20254
    support
    Keymaster

    Hi,

    Thank you for your feedback. We are committed to making VisualGDB better than other options and are constantly working on improving the usability and adding more features. However in order to keep focusing on making our products better, we are not able to provide any free project-specific customization work, although we are happy to show examples of various VisualGDB settings and explain how they work.

    If you ever decide to give VisualGDB another try, feel free to get back to us and we will be happy to answer your questions.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.