Skip to content

Bug: Makefile: Improve portability for libwebsockets and CC assignment #109

@bhanucbp

Description

@bhanucbp

Problem/Opportunity

The current Makefile has hardcoded assumptions for the presence of static libraries and the assignment of the compiler. This causes build failures or suboptimal linking in some environments.

Problems:

libwebsockets linking:
The Makefile always tries to use a static library (libwebsockets.a) if the directory exists, but does not fall back to dynamic linking if it does not. This causes build failures if only the shared library is available.

CC assignment:
The Makefile unconditionally sets CC := gcc ..., which overrides any externally provided compiler (e.g., from the environment or build system). This breaks cross-compilation and integration with build systems like Yocto.

Proposed Fix (see attached patch):

Use -lwebsockets if the static library is not present.
Use CC ?= gcc ... so that an externally provided compiler is respected.

Steps to reproduce

No response

Expected Behavior

should be portable to integrate to any environment

Actual Behavior

Paths are hardcoded

Notes (Optional)

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status

Changes Requested

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions