Sysprogs forums › Forums › VisualGDB › gtest project not building on remote linux
- This topic has 6 replies, 2 voices, and was last updated 5 years, 9 months ago by dabramson.
-
AuthorPosts
-
January 14, 2019 at 21:42 #23449dabramsonParticipant
I have setup a solution with 3 linux projects using the MSBuild option. One application, one shared library, and one unit tests with gtests that tests things in the shared library.
The build machine is an ubuntu 16.04 VM running on the same laptop as visual studio.
The target is a remote embedded linux system.
All machines on on the same subnetwork.
The application builds on the VM and runs on target without issue (it does not use the shared object). The shared object builds without error. The test project compiles the test files without issue but when it gets to compiling the gtest files gives me the following error:
make[1]: *** No rule to make target 'gtest-death-test.cc', needed by 'VisualGDB/Debug/gtest-death-test.o'. Stop.
Here is a snippet from the .msbuild.mak file:
UpdateRSP/VisualGDB/Debug/BasicCounterTests.o:
$(_V)echo "-ITestFramework/include -ITestFramework -ITestFramework/include -ITestFramework -ITestFramework/Platforms -ggdb -O0 -DDEBUG=1 -ffunction-sections -fdata-sections " > VisualGDB/Debug/BasicCounterTests.gcc.rsp-new
$(_V)cmp -s VisualGDB/Debug/BasicCounterTests.gcc.rsp-new VisualGDB/Debug/BasicCounterTests.gcc.rsp || cp VisualGDB/Debug/BasicCounterTests.gcc.rsp-new VisualGDB/Debug/BasicCounterTests.gcc.rsp
UpdateRSP/VisualGDB/Debug/gtest-death-test.o:
$(_V)echo "-ITestFramework/include -ITestFramework -ITestFramework/include -ITestFramework -ITestFramework/Platforms -ggdb -O0 -DDEBUG=1 -ffunction-sections -fdata-sections " > VisualGDB/Debug/gtest-death-test.gcc.rsp-new
$(_V)cmp -s VisualGDB/Debug/gtest-death-test.gcc.rsp-new VisualGDB/Debug/gtest-death-test.gcc.rsp || cp VisualGDB/Debug/gtest-death-test.gcc.rsp-new VisualGDB/Debug/gtest-death-test.gcc.rsp
The error is with the first gtest file mentioned in the mak file.
What could be the problem here?
- This topic was modified 5 years, 9 months ago by dabramson.
January 14, 2019 at 21:45 #23451supportKeymasterHi,
Please try updating to the final v5.4 release. The beta version contained a bug that would cause this type of problem.
January 14, 2019 at 22:23 #23454dabramsonParticipantI’m on version 5.4 build 2737, which is what installed when I downloaded from the site earlier today. Is that the latest version?
In the msbuild.mak file I found that adding the path to the gtest source will let make find the gtest source file. A snippet from the modified mak file is below. With this snippet in place the gtest-deat-test.cc file compiles, but the gtest-filepath.cc get the “No rule to make target error”.
-include VisualGDB/Debug/gtest-death-test.dep VisualGDB/Debug/gtest-death-test.o: TestFramework/src/gtest-death-test.cc VisualGDB/Debug/gtest-death-test.gcc.rsp @echo gtest-death-test.cc $(_V)/home/psidev/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ @VisualGDB/Debug/gtest-death-test.gcc.rsp -c "TestFramework/src/gtest-death-test.cc" -o "VisualGDB/Debug/gtest-death-test.o" -MD -MP -MF "VisualGDB/Debug/gtest-death-test.dep"
-include VisualGDB/Debug/gtest-filepath.dep VisualGDB/Debug/gtest-filepath.o: gtest-filepath.cc VisualGDB/Debug/gtest-filepath.gcc.rsp @echo gtest-filepath.cc $(_V)/home/psidev/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ @VisualGDB/Debug/gtest-filepath.gcc.rsp -c "gtest-filepath.cc" -o "VisualGDB/Debug/gtest-filepath.o" -MD -MP -MF "VisualGDB/Debug/gtest-filepath.dep"
Seems that something is wrong with the msbuild mak file generation.
- This reply was modified 5 years, 9 months ago by support. Reason: formatting
January 15, 2019 at 00:15 #23467supportKeymasterThanks, this indeed looks like VisualGDB doesn’t apply the test framework path properly. We have tried reproducing it on a newly created project, but could not get this behavior. It might be caused by some settings of this specific project. Please try checking if the problem persists on a newly created project. If not, please make a backup of the project, open VisualGDB Project Properties on the Test Framework page and change the framework back and forth. If this solves the problem, we would appreciate it if you could share the differences between the old and new project files so that we could fix it.
January 15, 2019 at 15:50 #23476dabramsonParticipantI made a new project in a totally new solution. I found the following 2 cases. The first case is expected behavior. The incorrect path issue is introduced by correcting the build failure in the first case.
The short story is that it seems the test project would build without issue if it didn’t need symbols from another project. Adding a reference to the project containing the code under test causes the paths to the test framework to be messed up in the msbuild.mak file.
—————————————————————————————-
CASE 1 ———————————————————————————When the shared object project is NOT referenced by the test project the msbuild.mak for the test project has to correct paths to the test framework. The test framework source compiles, but the class in the shared object cannot be referenced by the test project. The build fails with an ‘undefined reference to `BasicCounter::BasicCounter()’ error for every use of the class in the test (as would be expected).
-include VisualGDB/Debug/gtest-death-test.dep
VisualGDB/Debug/gtest-death-test.o: TestFramework/src/gtest-death-test.cc VisualGDB/Debug/gtest-death-test.gcc.rsp
@echo gtest-death-test.cc
$(_V)/home/psidev/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ @VisualGDB/Debug/gtest-death-test.gcc.rsp -c "TestFramework/src/gtest-death-test.cc" -o "VisualGDB/Debug/gtest-death-test.o" -MD -MP -MF "VisualGDB/Debug/gtest-death-test.dep"
—————————————————————————————-
CASE 2 ———————————————————————————After referencing the shared object project in the test project via the standard VS add reference feature the msbuild.mak file for the test project does not have the correct paths to the test framework and the build fails because it cannot compile the test framework.
-include VisualGDB/Debug/gtest-death-test.dep
VisualGDB/Debug/gtest-death-test.o: gtest-death-test.cc VisualGDB/Debug/gtest-death-test.gcc.rsp
@echo gtest-death-test.cc
$(_V)/home/psidev/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ @VisualGDB/Debug/gtest-death-test.gcc.rsp -c "gtest-death-test.cc" -o "VisualGDB/Debug/gtest-death-test.o" -MD -MP -MF "VisualGDB/Debug/gtest-death-test.dep"
- This reply was modified 5 years, 9 months ago by dabramson.
January 15, 2019 at 20:07 #23479supportKeymasterThanks for the repro description. Indeed, our integration tests covered libraries and unit tests separately, but never tested them together, so we overlooked this scenario.
We have fixed the issue in this build: http://sysprogs.com/files/tmp/VisualGDB-5.4.100.2743.msi
January 15, 2019 at 20:30 #23481dabramsonParticipantThank you! The tests now build.
I’m having trouble getting them to run with the VS test explorer, but I’ll start a new post for that.
-
AuthorPosts
- You must be logged in to reply to this topic.