question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running build not from root directory

See original GitHub issue

I’ve written some conanfile. It loads a file, check it, unzip and remove:

class IconvConan(ConanFile):
    name = "iconv"
    version = "1.14"
    generators = "cmake"
    settings = "os", "arch", "compiler", "build_type"
    folder_name = "lib" + name + "-" + version

        zip_name = self.folder_name + ".tar.gz"
        download("http://ftp.gnu.org/pub/gnu/libiconv/" + zip_name, zip_name)
        check_md5(zip_name, "e34509b1623cec449dfeb73d7ce9c6c6")
        unzip(zip_name)
        os.unlink(zip_name)

You can see it unzipping it in separate directory folder_name. When I want to build, I should configure the library in that directory.

    def build(self):
        env = ConfigureEnvironment(self.deps_cpp_info, self.settings)

        self.run(env.command_line + " ./configure --disable-shared --with-pic", cwd=self.folder_name)
        self.run(env.command_line + " make", cwd=self.folder_name)

Everything’s fine but windows because ConfigureEnvironment creates bat file which I should execute. Finally I get the error:

iconv/1.14@sbis/stable: WARN: Build folder C:\Users\ma.rybakov\.conan\data\iconv\1.14\sbis\stable\build\367de09a2d03464b27a9f07e2d4bb18479455580
ERROR: iconv: Error 1 while executing call _conan_env.bat ./configure --disable-shared --with-pic

What should I do?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
memshardedcommented, Nov 25, 2016

You are right, I should have used the initial && too! Don’t know why my code works! Damn Win command line syntax! LOL

A small suggestion, you can pass a conanfile to ConfigureEnvironment():

env = ConfigureEnvironment(self)

Shorter, and it also handles some extra cases.

1reaction
opilarcommented, Nov 25, 2016

I’ve failed with:

self.run(env.command_line + " && cd %s &&  ./configure --disable-shared --with-pic" % self.folder_name)

but you helped me. First && is unnecessary. Thanks a lot!

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to build go outside of source directory? - Stack Overflow
The simplest way is to cd into your module directory ( cd /app ) to run your go build command. (there probably is...
Read more >
Allow user to specify root folder for artifacts (#1057) - GitLab
Specify a root directory. Paths/excludes will then match relative to that root. # File on disk is located in <build_dir>/root/dir/file.txt ...
Read more >
How to reference a project root directory in an npm script
To execute another command that need to be done in root as for example for gulp! To illustrate here an example "tas:adminApp:build": "cd...
Read more >
No opportunity to set relative path to build folder on web service
Everything seems to be fine, redirection logics does work (server is running), but on render tries to find the build folder inside the...
Read more >
Build an Image - Specify Dockerfile Location · Codefresh | Docs
You could also change the Docker build context by editing the working_directory property. By default it is looking at the root folder of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found