Skip to content
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

Required build directory is not made by fmake #283

Open
drj11 opened this issue Nov 16, 2020 · 4 comments
Open

Required build directory is not made by fmake #283

drj11 opened this issue Nov 16, 2020 · 4 comments

Comments

@drj11
Copy link

drj11 commented Nov 16, 2020

[even later edit: it all works in pmake, which makes this more annoying than relevant]

Summary made after I understood the problem some more:

The machinery introduced in mkdir.mk to avoid making directories that already existed (introduced in 630694b827d489425ede498d4a21f0306c39eee8) appears to break an initial build if using FreeBSD make (fmake).


I'm on Ubuntu 16.04 using fmake (FreeBSD make) from aptpackagefreebsd-duildutils`:

$ CC=clang fmake -r
"share/mk/mkdir.mk", line 36: warning: duplicate script for target "build/lib" ignored
"share/mk/mkdir.mk", line 36: warning: duplicate script for target "build/lib" ignored
clang -o build/src/adt/alloc.o -I include -ansi -pedantic -O3 -DNDEBUG  -c src/adt/alloc.c
error: unable to open output file 'build/src/adt/alloc.o': 'No such file or
      directory'
1 error generated.
*** [build/src/adt/alloc.o] Error code 1

Stop in /home/ac1xdrj/prj/libfsm.

I'm going to fiddle around making directories until it works.

Incidentally, the same toolchain built kgt just fine

@drj11
Copy link
Author

drj11 commented Nov 16, 2020

(mostly notes for me now)

The output of fmake -r -V DIR suggests that DIR is being set correctly:

$ CC=clang fmake -r -V DIR
"share/mk/mkdir.mk", line 36: warning: duplicate script for target "build/lib" ignored
"share/mk/mkdir.mk", line 36: warning: duplicate script for target "build/lib" ignored
build/include/fsm build/include/re build/include build/src/adt build/src/print build/src/libfsm/cost build/src/libfsm/pred build/src/libfsm/print build/src/libfsm/walk build/src/libfsm/vm build/src/libfsm build/src/libre/class build/src/libre/dialect/glob build/src/libre/dialect/like build/src/libre/dialect/literal build/src/libre/dialect/native build/src/libre/dialect/pcre build/src/libre/dialect/sql build/src/libre/dialect build/src/libre/print build/src/libre build/src/fsm build/src/re build/src/retest build/src/lx/print build/tests/dump-lx build/src/lx build/src build/tests/capture build/tests/complement build/tests/intersect-ccuc build/tests/intersect build/tests/ir build/tests/eclosure build/tests/subtract-cuc build/tests/subtract build/tests/determinise build/tests/glush build/tests/glob build/tests/like build/tests/literal build/tests/minimise-rdrd build/tests/minimise build/tests/native build/tests/pcre-pcregrep build/tests/pcre build/tests/pcre-classes build/tests/pcre-anchor build/tests/pcre-flags build/tests/pcre-repeat build/tests/pred build/tests/reverse build/tests/trim build/tests/union build/tests/set build/tests/stateset build/tests/sql build/tests/hashset build/tests/queue build/tests/aho_corasick build/tests build/pc build/lib build/lib build/lib build/bin

@drj11
Copy link
Author

drj11 commented Nov 16, 2020

I see that my trees for libfsm (which does not) and kgt (which works) reference different kmkf SHAs:

For libfsm

ac1xdrj@owl:~/prj/libfsm$ git submodule status
 f1bea106c89d5e39fe2be3ef52f8140d00b0608a share/git/kmkf (f1bea10)

For kgt

ac1xdrj@owl:~/prj/kgt$ git submodule status
 024867d34c7d8741d5f481e525f81845fe153823 share/git/kmkf (024867d)

And the mkdir.mk contained in kmkf is different. In fact the diff is:

ac1xdrj@owl:~/prj$ diff {kgt,libfsm}/share/git/kmkf/share/mk/mkdir.mk
10c10,29
< mkdir:: ${DIR}
---
> mkdir::
> 
> # Double-colon targets are always considered out of date,
> # so even though these directories are up to date, they
> # would always be recreated. Note there's no need to
> # re-create an out of date directory anyway.
> #
> # So we avoid that situation here by only depending on
> # directories which do not currently exist.
> 
> .for dir in ${BUILD} ${DIR}
> .if !exists(${dir})
> mkdir:: ${dir}
> .endif
> .endfor
> 
> # mkdir -p is used for ${BUILD} because that's used-specified
> # and we don't know what directories might exist above that.
> # Whereas for directories beneath it, we ought to account for
> # them all and so purposefully do not use -p.

(that is, the broken one has this extra loop instead of just the plain mkdir:: ${DIR} rule)

That seems suspicious.

@drj11
Copy link
Author

drj11 commented Nov 17, 2020

well, I can workaround this changing the commit of the submodule:

cd share/git/kmkf/ 
git checkout 0248 # short for 024867d34c7d8741d5f481e525f81845fe153823

Is it possible that exists is buggy in FreeBSD make?

(it breaks on the linker step now, but if that is a problem, it clearly belongs in a different issue)

@drj11 drj11 changed the title Required build directory is not made by make Required build directory is not made by fmake Nov 23, 2020
@katef
Copy link
Owner

katef commented Feb 19, 2021

I believe this is addressed by: katef/kmkf@596fea3
(which is now present on libfsm's main)

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

No branches or pull requests

2 participants