diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c
index f020836f88..5018397c46 100644
--- a/app/test-bbdev/test_bbdev_vector.c
+++ b/app/test-bbdev/test_bbdev_vector.c
@@ -5,6 +5,7 @@
 #ifdef RTE_EXEC_ENV_FREEBSD
 	#define _WITH_GETLINE
 #endif
+#include <ctype.h>
 #include <stdio.h>
 #include <stdbool.h>
 #include <rte_malloc.h>
diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-crypto-perf/cperf_test_vector_parsing.c
index 87f3a90055..2c9087b5f9 100644
--- a/app/test-crypto-perf/cperf_test_vector_parsing.c
+++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
@@ -4,6 +4,7 @@
 #ifdef RTE_EXEC_ENV_FREEBSD
 	#define _WITH_GETLINE
 #endif
+#include <ctype.h>
 #include <stdio.h>
 
 #include <rte_malloc.h>
diff --git a/app/test-eventdev/parser.h b/app/test-eventdev/parser.h
index 696b40a3e2..954371b5b8 100644
--- a/app/test-eventdev/parser.h
+++ b/app/test-eventdev/parser.h
@@ -5,6 +5,7 @@
 #ifndef __INCLUDE_PARSER_H__
 #define __INCLUDE_PARSER_H__
 
+#include <ctype.h>
 #include <stdint.h>
 
 #define PARSE_DELIMITER				" \f\n\r\t\v"
diff --git a/app/test-pmd/bpf_cmd.c b/app/test-pmd/bpf_cmd.c
index 648e0e9294..46f6b7d6d2 100644
--- a/app/test-pmd/bpf_cmd.c
+++ b/app/test-pmd/bpf_cmd.c
@@ -2,7 +2,9 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#include <ctype.h>
 #include <stdio.h>
+
 #include <rte_mbuf.h>
 #include <rte_ethdev.h>
 #include <rte_flow.h>
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b4fe9dfb17..07566c7a77 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -3,6 +3,7 @@
  * Copyright(c) 2014 6WIND S.A.
  */
 
+#include <ctype.h>
 #include <stdarg.h>
 #include <errno.h>
 #include <stdio.h>
diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index fb56a234c5..1bc6c00998 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -2,6 +2,8 @@
  * Copyright(c) 2017 Intel Corporation
  */
 
+#include <ctype.h>
+
 #include <cmdline_parse.h>
 #include <cmdline_parse_num.h>
 #include <cmdline_parse_string.h>
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index a2939867c4..86054455d2 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -3,6 +3,7 @@
  * Copyright 2013-2014 6WIND S.A.
  */
 
+#include <ctype.h>
 #include <stdarg.h>
 #include <errno.h>
 #include <stdio.h>
diff --git a/app/test/test.h b/app/test/test.h
index 7115edf469..85f57efbc6 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -5,7 +5,9 @@
 #ifndef _TEST_H_
 #define _TEST_H_
 
+#include <errno.h>
 #include <stddef.h>
+#include <stdlib.h>
 #include <sys/queue.h>
 
 #include <rte_hexdump.h>
diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c
index 3969faf16d..3d6f63344a 100644
--- a/drivers/bus/vdev/vdev_params.c
+++ b/drivers/bus/vdev/vdev_params.c
@@ -2,6 +2,7 @@
  * Copyright 2018 Gaëtan Rivet
  */
 
+#include <errno.h>
 #include <string.h>
 
 #include <rte_dev.h>
diff --git a/drivers/common/cnxk/cnxk_telemetry_nix.c b/drivers/common/cnxk/cnxk_telemetry_nix.c
index 4119e9ee4f..b7285cf137 100644
--- a/drivers/common/cnxk/cnxk_telemetry_nix.c
+++ b/drivers/common/cnxk/cnxk_telemetry_nix.c
@@ -2,6 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 
+#include <ctype.h>
 #include "cnxk_telemetry.h"
 #include "roc_api.h"
 #include "roc_priv.h"
diff --git a/drivers/common/cnxk/cnxk_telemetry_npa.c b/drivers/common/cnxk/cnxk_telemetry_npa.c
index ae515df84f..b6ae108b10 100644
--- a/drivers/common/cnxk/cnxk_telemetry_npa.c
+++ b/drivers/common/cnxk/cnxk_telemetry_npa.c
@@ -2,6 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 
+#include <ctype.h>
 #include "cnxk_telemetry.h"
 #include "roc_api.h"
 #include "roc_priv.h"
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index dd198080bf..2750fe8bd3 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -1,6 +1,8 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2017 Intel Corporation
  */
+#include <ctype.h>
+
 #include <rte_common.h>
 #include <rte_hexdump.h>
 #include <rte_cryptodev.h>
diff --git a/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c
index bfdbd1ee5d..c38af63bdc 100644
--- a/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c
+++ b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c
@@ -2,6 +2,8 @@
  * Copyright(C) 2022 Marvell.
  */
 
+#include <ctype.h>
+
 #include <rte_telemetry.h>
 
 #include <roc_api.h>
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 67d79de08d..36ca42aa87 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2017 Intel Corporation
  */
 
+#include <ctype.h>
 #include <stdio.h>
 #include <errno.h>
 #include <stdint.h>
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 506fcff6e3..652f0d00a5 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2017 Intel Corporation
  */
 
+#include <ctype.h>
 #include <sys/queue.h>
 #include <stdio.h>
 #include <errno.h>
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index b2300790ae..e8304a1f2b 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -5,6 +5,7 @@
 #include <rte_string_fns.h>
 #include <ethdev_pci.h>
 
+#include <ctype.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/drivers/net/softnic/parser.h b/drivers/net/softnic/parser.h
index 6f408b2485..c17a5d8ef0 100644
--- a/drivers/net/softnic/parser.h
+++ b/drivers/net/softnic/parser.h
@@ -5,6 +5,7 @@
 #ifndef __INCLUDE_SOFTNIC_PARSER_H__
 #define __INCLUDE_SOFTNIC_PARSER_H__
 
+#include <ctype.h>
 #include <stdint.h>
 
 #include <rte_ip.h>
diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index 3dbef6ed45..b9448c7c4b 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2016-2017 Intel Corporation
  */
 
+#include <ctype.h>
 #include <getopt.h>
 #include <stdint.h>
 #include <stdio.h>
diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c
index 12b9b03f56..7719b56123 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#include <ctype.h>
 #include <stdio.h>
 #include <string.h>
 
diff --git a/examples/ip_pipeline/parser.h b/examples/ip_pipeline/parser.h
index 4538f675d4..5224b18a89 100644
--- a/examples/ip_pipeline/parser.h
+++ b/examples/ip_pipeline/parser.h
@@ -5,6 +5,7 @@
 #ifndef __INCLUDE_PARSER_H__
 #define __INCLUDE_PARSER_H__
 
+#include <ctype.h>
 #include <stdint.h>
 
 #include <rte_ip.h>
diff --git a/examples/ipsec-secgw/parser.h b/examples/ipsec-secgw/parser.h
index a0ff7e1b3f..b5c5d0210f 100644
--- a/examples/ipsec-secgw/parser.h
+++ b/examples/ipsec-secgw/parser.h
@@ -5,6 +5,7 @@
 #ifndef __PARSER_H
 #define __PARSER_H
 
+#include <ctype.h>
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <netinet/ip.h>
diff --git a/examples/l3fwd-power/perf_core.c b/examples/l3fwd-power/perf_core.c
index 4705967ea2..3051c45674 100644
--- a/examples/l3fwd-power/perf_core.c
+++ b/examples/l3fwd-power/perf_core.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2018 Intel Corporation
  */
 
+#include <ctype.h>
 #include <stdio.h>
 #include <string.h>
 
diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c
index ad553f19ab..41eefbaae8 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2020 Intel Corporation
  */
 
+#include <ctype.h>
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 7e1666f42a..71d053bf0c 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2017 Intel Corporation
  */
 
+#include <ctype.h>
 #include <arpa/inet.h>
 #include <getopt.h>
 #include <linux/if_ether.h>
diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index 174d4c40ae..e64c923a00 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -3,6 +3,7 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
+#include <ctype.h>
 #include <inttypes.h>
 
 #include <rte_eal.h>
diff --git a/lib/eal/common/eal_common_debug.c b/lib/eal/common/eal_common_debug.c
index 15418e957f..dcb554af1e 100644
--- a/lib/eal/common/eal_common_debug.c
+++ b/lib/eal/common/eal_common_debug.c
@@ -3,6 +3,8 @@
  */
 
 #include <stdarg.h>
+#include <stdlib.h>
+
 #include <rte_eal.h>
 #include <rte_log.h>
 #include <rte_debug.h>
diff --git a/lib/eal/common/eal_common_string_fns.c b/lib/eal/common/eal_common_string_fns.c
index 5fc4ee71dc..9ca2045b18 100644
--- a/lib/eal/common/eal_common_string_fns.c
+++ b/lib/eal/common/eal_common_string_fns.c
@@ -2,8 +2,10 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-#include <stdio.h>
+#include <ctype.h>
 #include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
 
 #include <rte_string_fns.h>
 #include <rte_errno.h>
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 26fbc91b26..ee5c929da8 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -3,6 +3,7 @@
  * Copyright(c) 2014 6WIND S.A.
  */
 
+#include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
diff --git a/lib/eal/include/generic/rte_rwlock.h b/lib/eal/include/generic/rte_rwlock.h
index da9bc3e9c0..6f600db2af 100644
--- a/lib/eal/include/generic/rte_rwlock.h
+++ b/lib/eal/include/generic/rte_rwlock.h
@@ -21,6 +21,8 @@
 extern "C" {
 #endif
 
+#include <errno.h>
+
 #include <rte_common.h>
 #include <rte_atomic.h>
 #include <rte_pause.h>
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 86c50c55e0..2e22c1b955 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -17,9 +17,6 @@ extern "C" {
 #endif
 
 #include <stdint.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <errno.h>
 #include <limits.h>
 
 #include <rte_config.h>
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 37d29643a5..46bf52cef0 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -3,6 +3,7 @@
  * Copyright(c) 2012-2014 6WIND S.A.
  */
 
+#include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
diff --git a/lib/eal/linux/eal_vfio_mp_sync.c b/lib/eal/linux/eal_vfio_mp_sync.c
index 4e26781948..157f20e583 100644
--- a/lib/eal/linux/eal_vfio_mp_sync.c
+++ b/lib/eal/linux/eal_vfio_mp_sync.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2018 Intel Corporation
  */
 
+#include <errno.h>
 #include <unistd.h>
 #include <string.h>
 
diff --git a/lib/eal/unix/eal_unix_timer.c b/lib/eal/unix/eal_unix_timer.c
index cc50159104..e71602b3a1 100644
--- a/lib/eal/unix/eal_unix_timer.c
+++ b/lib/eal/unix/eal_unix_timer.c
@@ -2,6 +2,7 @@
  * Copyright 2020 Mellanox Technologies, Ltd
  */
 
+#include <errno.h>
 #include <time.h>
 
 #include <rte_cycles.h>
diff --git a/lib/eal/windows/rte_thread.c b/lib/eal/windows/rte_thread.c
index 077152568f..63442ece9d 100644
--- a/lib/eal/windows/rte_thread.c
+++ b/lib/eal/windows/rte_thread.c
@@ -3,6 +3,8 @@
  * Copyright (C) 2022 Microsoft Corporation
  */
 
+#include <errno.h>
+
 #include <rte_common.h>
 #include <rte_errno.h>
 #include <rte_thread.h>
diff --git a/lib/ethdev/sff_telemetry.c b/lib/ethdev/sff_telemetry.c
index 887f07c47e..81dec4a39c 100644
--- a/lib/ethdev/sff_telemetry.c
+++ b/lib/ethdev/sff_telemetry.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2022 Intel Corporation
  */
 
+#include <ctype.h>
 #include <errno.h>
 
 #include "rte_ethdev.h"
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index bf8741d2ea..2ce7dc652c 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2017 Intel Corporation.
  * All rights reserved.
  */
+#include <ctype.h>
 #if defined(LINUX)
 #include <sys/epoll.h>
 #endif
diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c
index e0d978d641..27bf4c85b3 100644
--- a/lib/eventdev/rte_event_timer_adapter.c
+++ b/lib/eventdev/rte_event_timer_adapter.c
@@ -3,6 +3,7 @@
  * All rights reserved.
  */
 
+#include <ctype.h>
 #include <string.h>
 #include <inttypes.h>
 #include <stdbool.h>
diff --git a/lib/meter/rte_meter.c b/lib/meter/rte_meter.c
index 4549b97d36..6545803d36 100644
--- a/lib/meter/rte_meter.c
+++ b/lib/meter/rte_meter.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
+#include <errno.h>
 #include <stdio.h>
 #include <math.h>
 
diff --git a/lib/pci/rte_pci.c b/lib/pci/rte_pci.c
index 355772ff56..1c5ef951d3 100644
--- a/lib/pci/rte_pci.c
+++ b/lib/pci/rte_pci.c
@@ -3,6 +3,7 @@
  * Copyright 2013-2014 6WIND S.A.
  */
 
+#include <errno.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/lib/pipeline/rte_swx_ctl.c b/lib/pipeline/rte_swx_ctl.c
index 710e89a46a..fecc215398 100644
--- a/lib/pipeline/rte_swx_ctl.c
+++ b/lib/pipeline/rte_swx_ctl.c
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2020 Intel Corporation
  */
+#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
diff --git a/lib/sched/rte_pie.c b/lib/sched/rte_pie.c
index c84f75a18c..947e2a059f 100644
--- a/lib/sched/rte_pie.c
+++ b/lib/sched/rte_pie.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2020 Intel Corporation
  */
 
+#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 
diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c
index 4f5e4b4d49..9bf49a3bd0 100644
--- a/lib/security/rte_security.c
+++ b/lib/security/rte_security.c
@@ -4,6 +4,8 @@
  * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
  */
 
+#include <ctype.h>
+
 #include <rte_cryptodev.h>
 #include <rte_dev.h>
 #include <rte_telemetry.h>
diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index c6fd03a5ab..8345120413 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2020 Intel Corporation
  */
 
+#include <errno.h>
 #ifndef RTE_EXEC_ENV_WINDOWS
 #include <unistd.h>
 #include <pthread.h>
diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c
index e14ae3c4d4..2581c27413 100644
--- a/lib/telemetry/telemetry_data.c
+++ b/lib/telemetry/telemetry_data.c
@@ -2,6 +2,9 @@
  * Copyright(c) 2020 Intel Corporation
  */
 
+#include <errno.h>
+#include <stdlib.h>
+
 #undef RTE_USE_LIBBSD
 #include <rte_string_fns.h>
 
diff --git a/lib/telemetry/telemetry_legacy.c b/lib/telemetry/telemetry_legacy.c
index 8aba44d689..a1d074d884 100644
--- a/lib/telemetry/telemetry_legacy.c
+++ b/lib/telemetry/telemetry_legacy.c
@@ -1,7 +1,9 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2020 Intel Corporation
  */
+#include <ctype.h>
 
+#include <errno.h>
 #ifndef RTE_EXEC_ENV_WINDOWS
 #include <unistd.h>
 #include <sys/socket.h>
