-
Notifications
You must be signed in to change notification settings - Fork 17
Do not use relative paths in the build script #261
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not using variables in scripts when they are not supposed to be changed. Yet this is a minor issue.
scripts/compile.sh
Outdated
@@ -101,11 +102,13 @@ load_llvm() { | |||
} | |||
|
|||
build_llvm() { | |||
if ! [ -d "llvm-project" ]; then | |||
local ext_dir="$PWD" | |||
local llvm_dir="$ext_dir/llvm-project" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the point of introducing the variable? this does not affect execution IMHO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any variable may hold some invalid value at some point while constant is always a constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the point of introducing the variable? this does not affect execution IMHO
To save the directory path before cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any variable may hold some invalid value at some point while constant is always a constant
Sorry, didn't get the point. Could you please explain?
These local variables are used to temporary save the paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use the paths; I cannot see how adding variables adds a value to the script; it adds a few lines and a chance to have less transparent problems later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With relative paths the following code fails, because lvm-project is a link in my env.
cd ../llvm-project
git apply ../mlir-extensions/build_tools/patches/*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
llvm-project and mlir-extensions are physically located in different folders:
ls -la externals/
...
llvm-project -> /home/andrey/work/llvm-project
mlir-extensions
When running git apply ../mlir-extensions/build_tools/patches/*
from the llvm-project
folder, the relative path is not valid.
Seems ~/work/graph-compiler/externals/llvm-project$ pwd
/home/andrey/work/graph-compiler/externals/llvm-project
~/work/graph-compiler/externals/llvm-project$ pwd -P
/home/andrey/work/llvm-project
~/work/graph-compiler/externals/llvm-project$ cd ../mlir-extensions/build_tools/patches/
~/work/graph-compiler/externals/mlir-extensions/build_tools/patches$ pwd -P
/home/andrey/work/graph-compiler/externals/mlir-extensions/build_tools/patches But ~/work/graph-compiler/externals/llvm-project$ git apply ../mlir-extensions/build_tools/patches/*
error: can't open patch '../mlir-extensions/build_tools/patches/*': No such file or directory
~/work/graph-compiler/externals/llvm-project$ ls ../mlir-extensions/build_tools/patches/
ls: cannot access '../mlir-extensions/build_tools/patches/': No such file or directory |
5eb5aa1
to
4164d87
Compare
The script fails when using relative paths and symbolic links.
4164d87
to
68bddee
Compare
Replaced the other relative paths. |
The script fails when using relative paths and symbolic links.