← All tasks
cppBehaviorTree/BehaviorTree.CPP #314Not a task: not reproduced

Build error when -DBUILD_EXAMPLES=False

envgap__BehaviorTree__BehaviorTree.CPP-314

01 / FAILURE SIGNATURE

As reported upstream

collect2: error: ld returned 1 exit status
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
7312ad64c2aa73e0efaa5b54d28b56d432a44194
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

BehaviorTree/BehaviorTree.CPP #314 · read the original issue
Greetings,



I tried building the latest `master` with `-DBUILD_EXAMPLES=False` and I encounter the error below



```

/usr/bin/ld: cannot find -lbt_sample_nodes

collect2: error: ld returned 1 exit status

make[2]: *** [tests/CMakeFiles/behaviortree_cpp_v3_test.dir/build.make:284: tests/behaviortree_cpp_v3_test] Error 1

make[1]: *** [CMakeFiles/Makefile2:227: tests/CMakeFiles/behaviortree_cpp_v3_test.dir/all] Error 2

make: *** [Makefile:141: all] Error 2

```



This happens since lib `bt_samples_nodes` is only built when `BUILD_EXAMPLES` is enabled but is linked to the [tests](https://github.com/BehaviorTree/BehaviorTree.CPP/blob/7312ad64c2aa73e0efaa5b54d28b56d432a44194/tests/CMakeLists.txt#L31-L32) which gets [built regardless](https://github.com/BehaviorTree/BehaviorTree.CPP/blob/7312ad64c2aa73e0efaa5b54d28b56d432a44194/CMakeLists.txt#L245-L247) 



## Instructions to reproduce error:

```bash

git clone https://github.com/BehaviorTree/BehaviorTree.CPP.git

cd BehaviorTree.CPP

mkdir build && cd build

cmake .. -DBUILD_EXAMPLES=False

make

```

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]