From owner-freebsd-hackers@freebsd.org Fri Dec 8 16:28:21 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A66D3E87D9A for ; Fri, 8 Dec 2017 16:28:21 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x229.google.com (mail-lf0-x229.google.com [IPv6:2a00:1450:4010:c07::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 26FC6793F7; Fri, 8 Dec 2017 16:28:21 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x229.google.com with SMTP id f20so12464798lfe.3; Fri, 08 Dec 2017 08:28:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=CquSOIFnexwqi7o3m3ONO6FRwCEUK/VzpzI6rpNUTN4=; b=exC6yCq34vfwQpFb0lb4jMEwwO0euAHy93IiVMdBJurKYIFFMzn+2WqiUWWsondGhU oaXtBTJGsHCh4Notvc8HjRTO2PUoOCtesXBdOENpYZ0YzWPACk/w63n0B/Qb/+UY722g w/qXCTyJK0NTWSP577nhsRNPDpgIPHAP45tLVHFhBDHIxGv4kFKxv6Ta78C6hR6EaFAr zBX+gHUtdThPUm/GmC41INVu6WoCO/loc4lmGZYa9Xg4JoLcC4QX0eN2p3z0P/vwWsT9 pYifX9bCsdZG2N0y/M2GJrETmoAhVwIIuafqMqLBpSAJhkPyuQalgFm/PC4/lxqaz4wb cZGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=CquSOIFnexwqi7o3m3ONO6FRwCEUK/VzpzI6rpNUTN4=; b=JxxijXz6NP8zsjftLsEROyp/TBrp4TlBOwnEgGl1zLB2WeGjTTVY8XEm9lXbKRb0Vh Kxjd2Rsu+MmrOsSIjMjihMtSgqaj2X5wvdZW6S2MEprMh1xXYYpVPl7QEqPP5TCJVUx1 otuISQJPoQuYyfzpFP25PcSq4mI4BOeiwWuU8T2zjo17e4V7Pq4r7DHZevDQpOJVxPId Nk0I352+hx4pCM0UPgYPnfNp9NDrpbkfK+AItqz2K1lzDGQxFOB+O7cmtPU43j088WS1 0C/GfYU5D7XKuRhtxDjJNPNA70r9mNadBG2b36mQfr7CqTlOWHMT8qSvy+bh4GU4grYC cByg== X-Gm-Message-State: AJaThX5eM0KZDexg0+3dQwoZP16J55V2frXqbkBAX8bJxDHzIclHhvpM 5bUwqQuSmpL6uzmeCAmE4emTCzKECt9/FNLrMs4= X-Google-Smtp-Source: AGs4zMZK2wqJbBsgJu6ickGHyxlux3W3mflV12l2ptdFb3GlMd18fLRbvQZ8QAzageBfG9SOTvWJOQBUYmDD7QSfhqo= X-Received: by 10.46.20.4 with SMTP id u4mr16402116ljd.38.1512750497772; Fri, 08 Dec 2017 08:28:17 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.76.19 with HTTP; Fri, 8 Dec 2017 08:28:16 -0800 (PST) In-Reply-To: References: From: Alan Somers Date: Fri, 8 Dec 2017 09:28:16 -0700 X-Google-Sender-Auth: nyzuFr_LiDwiDfkZkqOgSL3arZ4 Message-ID: Subject: Re: Different behavior when running `make` To: Shivansh Rai Cc: "freebsd-hackers@freebsd.org" Content-Type: multipart/mixed; boundary="f403045fb7760dda62055fd6ac80" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Dec 2017 16:28:21 -0000 --f403045fb7760dda62055fd6ac80 Content-Type: text/plain; charset="UTF-8" On Fri, Dec 8, 2017 at 8:01 AM, Shivansh Rai wrote: > Hello all, > > I'm currently working on a tool for automating generation of smoketests for > all the utilities in the base system [1]. Until now I was testing things on > a very old branch from around August (git sha 92d8705), and after updating > my branch (git sha 7ea30ed) I'm starting to notice a different behavior. > > The tool is located at `~/freebsd/tools/tools/smoketestsuite` [2] in my > system. > Executing `make` inside [2] produces the following output - > ``` > [Creating objdir > /usr/obj/usr/home/zeebsd/freebsd/amd64.amd64/tools/ > tools/smoketestsuite...] > c++ -I/usr/local/include -std=c++11 -c logging.cpp > c++: error: no such file or directory: 'logging.cpp' > c++: error: no input files > *** Error code 1 > ``` > > The interesting thing to be noted is the first line of the above trace > where a new directory under `/usr/obj` is created (I've noticed this for > the first time, after I updated my branch). > > The location > `/usr/obj/usr/home/zeebsd/freebsd/amd64.amd64/tools/tools/smoketestsuite` > [3] is empty, and it seems that `make` tries to look up `logging.cpp` (and > all other files) in [3] instead of [2]. This is evident from the fact that > if I manually populate [3] will all the relevant files, everything works > fine. > Also, all the side-effects which `make` introduces (new files, new binaries > etc.) are populated at [3] instead of [2]. > > If the tool is kept at a location outside the src tree (not under > `~/freebsd`), everything works fine (and the temporary directory under > `/usr/obj` is not created for those locations when `make` is executed). So > the problem seems to be in the way `make` is running inside the src tree. > > I've attached the system call trace for the failing execution. > It'd be extremely helpful if someone could please shed light on what seems > to be the problem here, and what should be the right workflow. > > [1]: For some more reference, the tool is currently available at ` > https://github.com/shivansh/smoketestsuite/' (svn branch) (D12249). > [2]: `~/freebsd/tools/tools/smoketestsuite` > [3]: > `/usr/obj/usr/home/zeebsd/freebsd/amd64.amd64/tools/tools/smoketestsuite` > > Thanks in advance! > With best regards, > Shivansh Rai > make is failing because it's implicitly cd'ing to ${MAKEOBJDIRPREFIX}/${.CURDIR} before running any commands. I don't know if that's at all contingent on the build being started from within a FreeBSD source tree, but the easiest solution is to work with the build system rather than against it. I've attached a working version. The scripts don't all work, however. They still contain assumptions about pwd, for example at scripts/fetch_utils.sh:32. -Alan --f403045fb7760dda62055fd6ac80 Content-Type: application/octet-stream; name=Makefile Content-Disposition: attachment; filename=Makefile Content-Transfer-Encoding: base64 X-Attachment-Id: f_jay4krr61 IyAkRnJlZUJTRCQKIwojIE1ha2VmaWxlIGZvciBidWlsZGluZyB0aGUgdGVzdCBnZW5lcmF0aW9u IHRvb2wKClBST0dfQ1hYPQlnZW5lcmF0ZV90ZXN0cwpMT0NBTEJBU0U9CS91c3IvbG9jYWwKTUFO PQpDWFhGTEFHUys9CS1JJHtMT0NBTEJBU0V9L2luY2x1ZGUgLXN0ZD1jKysxMQpMREZMQUdTKz0J LUwke0xPQ0FMQkFTRX0vbGliIC1sYm9vc3RfZmlsZXN5c3RlbSAtbGJvb3N0X3N5c3RlbQpTUkNT PQlsb2dnaW5nLmNwcCBcCgl1dGlscy5jcHAgXAoJcmVhZF9hbm5vdGF0aW9ucy5jcHAgXAoJZ2Vu ZXJhdGVfbGljZW5zZS5jcHAgXAoJYWRkX3Rlc3RjYXNlLmNwcCBcCglmZXRjaF9ncm9mZi5jcHAg XAoJZ2VuZXJhdGVfdGVzdC5jcHAKCi5QSE9OWTogY2xlYW4gXAoJZmV0Y2hfZ3JvZmYgXAoJZmV0 Y2hfdXRpbHMgXAoJcnVuCgpmZXRjaF9ncm9mZjoKCXNoICR7LkNVUkRJUn0vc2NyaXB0cy9mZXRj aF9ncm9mZi5zaAoKZmV0Y2hfdXRpbHM6CglzaCAkey5DVVJESVJ9L3NjcmlwdHMvZmV0Y2hfdXRp bHMuc2gKCnJ1bjoKCUBlY2hvIEdlbmVyYXRpbmcgYW5ub3RhdGlvbnMuLi4KCXNoICR7LkNVUkRJ Un0vc2NyaXB0cy9nZW5lcmF0ZV9hbm5vdC5zaAoJQGVjaG8gR2VuZXJhdGluZyB0ZXN0IGZpbGVz Li4uCgkuL2dlbmVyYXRlX3Rlc3RzCgouaW5jbHVkZSA8YnNkLnByb2cubWs+Cg== --f403045fb7760dda62055fd6ac80--