# Building with audio component only

**URL:** <https://discourse.libsdl.org/t/building-with-audio-component-only/31160>\
**Category:** Game Development\
**Created:** [April 7, 2021, 7:06am UTC](https://discourse.libsdl.org/t/building-with-audio-component-only/31160 "2021-04-07T07:06:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LazerBlazer](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/l/fbc32d/32.png) [@LazerBlazer](https://discourse.libsdl.org/u/LazerBlazer)\
**Post date:** [April 7, 2021, 7:06am UTC](https://discourse.libsdl.org/t/building-with-audio-component-only/31160/1 "2021-04-07T07:06:18Z")

</div>

Is it possible to build SDL2 with the audio component only?

I tried unchecking the joystick, video, events in CMake, but still keeps looking for these components (undefined reference) when linking to the application.

---

<div class="post-metadata">

**Author:** ![LazerBlazer](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/l/fbc32d/32.png) [@LazerBlazer](https://discourse.libsdl.org/u/LazerBlazer)\
**Post date:** [April 7, 2021, 11:18pm UTC](https://discourse.libsdl.org/t/building-with-audio-component-only/31160/2 "2021-04-07T23:18:03Z")

</div>

If SDL2’s CMake can make you opt out these components, it does not make sense that it will search it again and throw undefined references.

Adding it back will make the lib and exe size the same as you would not opting these components out.

---

<div class="post-metadata">

**Author:** ![icculus](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/icculus/32/81_2.png) [@icculus](https://discourse.libsdl.org/u/icculus)\
**Post date:** [April 9, 2021, 2:45pm UTC](https://discourse.libsdl.org/t/building-with-audio-component-only/31160/3 "2021-04-09T14:45:50Z")

</div>

In theory you can drop all these subsystems, but in practice no one does this so it doesn’t surprise me that it doesn’t work.

There’s a lot of interconnected bits of code that we probably take for granted (for example: the audio subsystem uses the event subsystem to alert about device hotplugging, etc).

---

<div class="post-metadata">

**Author:** ![LazerBlazer](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/l/fbc32d/32.png) [@LazerBlazer](https://discourse.libsdl.org/u/LazerBlazer)\
**Post date:** [April 9, 2021, 8:54pm UTC](https://discourse.libsdl.org/t/building-with-audio-component-only/31160/4 "2021-04-09T20:54:56Z")

</div>

Hey, thanks Ryan. I see. I am trying to do this with MojoAL and hopefully reduce the bulk, but if that is the case, then I will just do some exe compression as a workaround.
