Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`NOB_GO_REBUILD_URSELF` fails if not run from the same folder where its source code is located

Open
#156 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c
Domain
build-system

Research direction

Inspect nob.h at nob__go_rebuild_urself and compare its path handling with the reproducer in nob.c. Run the shown command from a subdirectory, then verify that NOB_GO_REBUILD_URSELF can locate nob.c and complete its rebuild behavior when launched outside the source directory.

Written by the indexing model from the issue text.

Description

Repro

$ cat nob.c
#define NOB_IMPLEMENTATION
#define NOB_STRIP_PREFIX
#include "nob.h"

int main(int argc, char **argv)
{
    NOB_GO_REBUILD_URSELF(argc, argv);
    return 0;
}
$ cc -o nob nob.c
$ mkdir foo && cd foo
$ ../nob
[ERROR] could not stat nob.c: No such file or directory

Workaround

--- nob.c	2025-10-30 08:20:33.984305999 +0700
+++ nob.fixed.c	2025-10-30 08:20:59.128496254 +0700
@@ -4,6 +4,7 @@

 int main(int argc, char **argv)
 {
+    if (!set_current_dir(temp_dir_name(temp_running_executable_path()))) return 1;
+    argv[0] = temp_sprintf("./%s", temp_file_name(argv[0]));
     NOB_GO_REBUILD_URSELF(argc, argv);
     return 0;
 }

Potential solution

Maybe NOB_GO_REBUILD_URSELF() should imply the above Workaround (that is should be just included in nob__go_rebuild_urself). But I'm not sure about any potential pitfalls of this solution.

Dominant language
C++
Stars
3.3k
Forks
215
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tsoding/nob.h

All issues in tsoding/nob.h

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.