Skip to content

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

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

AndreyPavlenko
Copy link
Contributor

@AndreyPavlenko AndreyPavlenko commented Aug 19, 2024

The script fails when using relative paths and symbolic links.

Copy link
Contributor

@leshikus leshikus left a 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.

@@ -101,11 +102,13 @@ load_llvm() {
}

build_llvm() {
if ! [ -d "llvm-project" ]; then
local ext_dir="$PWD"
local llvm_dir="$ext_dir/llvm-project"
Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor Author

@AndreyPavlenko AndreyPavlenko Aug 19, 2024

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.

Copy link
Contributor

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

Copy link
Contributor Author

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/*

Copy link
Contributor Author

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.

@dchigarev
Copy link
Contributor

I wonder why these two relative directory changes work in your env [1] [2], shouldn't we also save external and graph-compiler-root paths in a variable then?

@AndreyPavlenko
Copy link
Contributor Author

I wonder why these two relative directory changes work in your env [1] [2], shouldn't we also save external and graph-compiler-root paths in a variable then?

Seems cd can properly resolve the relative paths:

~/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 git and even ls fail to resolve:

~/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

@AndreyPavlenko AndreyPavlenko changed the title Minor fixes to the IMEX build Do not use relative paths in the build script Aug 20, 2024
The script fails when using relative paths and symbolic links.
@AndreyPavlenko
Copy link
Contributor Author

Replaced the other relative paths.

@AndreyPavlenko AndreyPavlenko merged commit afed96c into intel:main Aug 20, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants