Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make.js: trim excess whitespaces from CFLAGS and LDFLAGS #1251

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yojoe
Copy link

@yojoe yojoe commented Apr 21, 2023

Excess whitespaces in the CFLAGS and LDFLAGS variables cause gcc compilation errors like aarch64-unknown-linux-gnu-gcc: error: No such file or directory. This is hard to debug and happens because the .split(' ') function will create empty gcc arguments, if there are any excess whitespaces in the CFLAGS and LDFLAGS environment variables. This can happen when cross-compiling using a 3rd party toolchain, which manipulates/sets the CFLAGS/LDFLAGS variables and accidentally/carelessly puts to many whitespaces in these flags. We better trim any whitespaces from the beginning and end of CFLAGS/LDFLAGS strings and match consecutive whitespaces within the strings via a regex instead, to avoid these nasty and hard to spot compilation errors.

Excess whitespaces in the CFLAGS and LDFLAGS variables cause `gcc` compilation errors like `aarch64-unknown-linux-gnu-gcc: error: No such file or directory`. This is hard to debug and happens because the `.split(' ')` function will create empty `gcc` arguments, if there are any excess whitespaces in the CFLAGS and LDFLAGS environment variables. This can happen when cross-compiling using a 3rd party toolchain, which manipulates/sets the CFLAGS/LDFLAGS variables and accidentally/carelessly puts to many whitespaces in these flags. We better `trim` any whitespaces from the beginning and end of CFLAGS/LDFLAGS strings and match consecutive whitespaces within the strings via a regex instead, to avoid these nasty and hard to spot compilation errors.
@webbdays
Copy link

Can i work on this?
this code base is new to me.
Please guide me to place in code where we parse the flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants