Skip to content

Error on externally linked library #220

@davispolito

Description

@davispolito

I am trying to use the cmake testing environment for an external we have been developing but I get a seg fault whenever I go to run the test. The external otherwise builds and operates perfectly fine in max.

I assume it has something to do with how I link the external library to the test build.

I use this line in my CMake for the external

target_link_libraries(${TEST_NAME} PRIVATE hidapi::hidapi)
This links the hidapi to the test file. I did this based off of what happens in min-object-unittest.cmake to create the test file itself. The test executable otherwise cannot find the hidapi.h files in my external.

Whenever I run a simple test that should only create my object the code segfaults at the line

SCENARIO(...
Here is my full test file

/// @file
/// @InGroup minexamples
/// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved.
/// @license Use of this source code is governed by the MIT License found in the License.md file.

#include "c74_min_unittest.h" // required unit test header

#include "min.manta.cpp" // need the source of our object so that we can access it

// Unit tests are written using the Catch framework as described at
// https://github.com/philsquared/Catch/blob/master/docs/tutorial.md

SCENARIO("object produces correct output") {
std::cout << "constructor called " << c74::min::endl;
ext_main(nullptr); // every unit test must call ext_main() once to configure the class

GIVEN("An instance of minmanta") {

	 test_wrapper<manta> an_instance;
	 manta&              my_object = an_instance;

	REQUIRE(1 == TRUE);
	
}

}
It does run the line right before ext_main but after that nothing gets run.

Here is a link to the repo for anyone interested https://github.com/spiricom/MantaMaxObject

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions