Apache OpenOffice (AOO) Bugzilla – Issue 116349
certain SOURCE_ROOT patterns break the build on Windows/cygwin
Last modified: 2012-03-03 11:11:14 UTC
If your SOURCE_ROOT points to a location so that the cygwin-notation of the path is actually a sub string of its Windows-notation (with \ replaced by /), then the GNU make build system breaks. To reproduce: - Use a CWS located at, say, C:\cws\mycws - mount C:\cws to /cws - export SOURCE_ROOT=c:/cws/mycws - cd /cws/mycws/DEV300/ooo/tools - make -r => the build breaks with an error message talking about a path "C:C:/cws/mycws/..." The problem here is that some makefile magic attemps to replace cygwin path notations with their respective Windows-compliant counterpart. This is done by substituting "/cws/mycws" with "C:/cws/mycws", which unfortunately also hits if the string already contains C:/cws/mycws.
cl: The problem is definitly in file solenv/gbuild/platform/windows.mk in define gb_Helper_abbreviate_dirs_native My source_root is e:/cws/cws_name and cygpath -m gives "E:/cws/cws_name" watch the capital E here. So everywhere $(1) contains "e:/cws/cws_name" it will not be replaced by R since gb_Helper_REPODIR_NATIVE is "E:/cws/cws_name" and subst works case sensitive. But subst will find $(REPODIR) which is /cws/cws_name in "e:/cws/cws_name" and replace it with $R so we get "e:$R/". Raising priority as this makes the build system unusable on windows systems.
As a quick fix I tried to set my source_root to "E:/cws/cws_name" which does not fix the issue entirely.
this # Helper class lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1)))))))))))))))))))))))))) gb_Helper_SRCDIR_NATIVE := $(call lc,$(shell cygpath -m $(SRCDIR))) gb_Helper_WORKDIR_NATIVE := $(call lc,$(shell cygpath -m $(WORKDIR))) gb_Helper_OUTDIR_NATIVE := $(call lc,$(shell cygpath -m $(OUTDIR))) gb_Helper_REPODIR_NATIVE := $(call lc,$(shell cygpath -m $(REPODIR))) define gb_Helper_abbreviate_dirs_native R=$(gb_Helper_REPODIR_NATIVE) && $(subst $(REPODIR),$$R,$(subst $(gb_Helper_REPODIR_NATIVE),$$R,$1 )) endef Kind of fixes it for me but I still get some -IE:/cws/cws_name/ooo/solenv/inc
The root cause are the replacements at gb_Helper_abbreviate_dirs_native: > http://hg.services.openoffice.org/DEV300/file/6a873085545b/solenv/gbuild/platform/windows.mk#l202 and that with your setup have $(WORKDIR) being a substring of $(gb_Helper_WORKDIR_NATIVE) etc. Probable solution: Replace (from innermost/first): - gb_Helper_WORKDIR_NATIVE (cannot be a substring of WORKDIR) - gb_Helper_OUTDIR_NATIVE (cannot be a substring of OUTDIR) - gb_Helper_SRCDIR_NATIVE (cannot be a substring of SRCDIR) - WORKDIR - OUTDIR - SRCDIR - REPODIR on line 202 instead of the current substitutions.
Thanks to ause, this works at least for tools lc = $(patsubst A:%,a:%,$(patsubst B:%,b:%,$(patsubst C:%,c:%,$(patsubst D:%,d:%,$(patsubst E:%,e:%,$(patsubst F:%,f:%,$(patsubst G:%,g:%,$(patsubst H:%,h:%,$(patsubst I:%,i:%,$(patsubst J:%,j:%,$(patsubst K:%,k:%,$(patsubst L:%,l:%,$(patsubst M:%,m:%,$(patsubst N:%,n:%,$(patsubst O:%,o:%,$(patsubst P:%,p:%,$(patsubst Q:%,q:%,$(patsubst R:%,r:%,$(patsubst S:%,s:%,$(patsubst T:%,t:%,$(patsubst U:%,u:%,$(patsubst V:%,v:%,$(patsubst W:%,w:%,$(patsubst X:%,x:%,$(patsubst Y:%,y:%,$(patsubst Z:%,z:%,$1)))))))))))))))))))))))))) gb_Helper_SRCDIR_NATIVE := $(call lc,$(shell cygpath -m $(SRCDIR))) gb_Helper_WORKDIR_NATIVE := $(call lc,$(shell cygpath -m $(WORKDIR))) gb_Helper_OUTDIR_NATIVE := $(call lc,$(shell cygpath -m $(OUTDIR))) gb_Helper_REPODIR_NATIVE := $(call lc,$(shell cygpath -m $(REPODIR))) $(info $(gb_Helper_REPODIR_NATIVE)) define gb_Helper_abbreviate_dirs_native R=$(gb_Helper_REPODIR_NATIVE) && $(subst $(REPODIR),$$R,$(subst $(gb_Helper_REPODIR_NATIVE),$$R,$1 )) endef
please use: gb_Helper_SRCDIR_NATIVE := $(shell cygpath -m $(SRCDIR) |$(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')) ... instead.
this still works but has a much shorter command line, like the original version # Helper class lc = $(patsubst A:%,a:%,$(patsubst B:%,b:%,$(patsubst C:%,c:%,$(patsubst D:%,d:%,$(patsubst E:%,e:%,$(patsubst F:%,f:%,$(patsubst G:%,g:%,$(patsubst H:%,h:%,$(patsubst I:%,i:%,$(patsubst J:%,j:%,$(patsubst K:%,k:%,$(patsubst L:%,l:%,$(patsubst M:%,m:%,$(patsubst N:%,n:%,$(patsubst O:%,o:%,$(patsubst P:%,p:%,$(patsubst Q:%,q:%,$(patsubst R:%,r:%,$(patsubst S:%,s:%,$(patsubst T:%,t:%,$(patsubst U:%,u:%,$(patsubst V:%,v:%,$(patsubst W:%,w:%,$(patsubst X:%,x:%,$(patsubst Y:%,y:%,$(patsubst Z:%,z:%,$1)))))))))))))))))))))))))) gb_Helper_SRCDIR_NATIVE := $(call lc,$(shell cygpath -m $(SRCDIR))) gb_Helper_WORKDIR_NATIVE := $(call lc,$(shell cygpath -m $(WORKDIR))) gb_Helper_OUTDIR_NATIVE := $(call lc,$(shell cygpath -m $(OUTDIR))) gb_Helper_REPODIR_NATIVE := $(call lc,$(shell cygpath -m $(REPODIR))) define gb_Helper_abbreviate_dirs_native R=$(gb_Helper_REPODIR_NATIVE) && $(subst $(REPODIR)/,$$R/,$(subst $(gb_Helper_REPODIR_NATIVE)/,$$R/,O=$(gb_Helper_OUTDIR_NATIVE) && W=$(gb_Helper_WORKDIR_NATIVE) && S=$(gb_Helper_SRCDIR_NATIVE))) && \ $(subst $(REPODIR)/,$$R/,$(subst $(SRCDIR)/,$$S/,$(subst $(OUTDIR)/,$$O/,$(subst $(WORKDIR)/,$$W/,$(subst $(gb_Helper_REPODIR_NATIVE)/,$$R/,$(subst $(gb_Helper_SRCDIR_NATIVE)/,$$S/,$(subst $(gb_Helper_OUTDIR_NATIVE)/,$$O/,$(subst $(gb_Helper_WORKDIR_NATIVE)/,$$W/,($1))))))))) endef
thanks björn. So Frank & Ause, can you please review if the following works in your environment? # Helper class gb_Helper_SRCDIR_NATIVE := $(shell cygpath -m $(SRCDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }') gb_Helper_WORKDIR_NATIVE := $(shell cygpath -m $(WORKDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }') gb_Helper_OUTDIR_NATIVE := $(shell cygpath -m $(OUTDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }') gb_Helper_REPODIR_NATIVE := $(shell cygpath -m $(REPODIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }') define gb_Helper_abbreviate_dirs_native R=$(gb_Helper_REPODIR_NATIVE) && $(subst $(REPODIR)/,$$R/,$(subst $(gb_Helper_REPODIR_NATIVE)/,$$R/,O=$(gb_Helper_OUTDIR_NATIVE) && W=$(gb_Helper_WORKDIR_NATIVE) && S=$(gb_Helper_SRCDIR_NATIVE))) && \ $(subst $(REPODIR)/,$$R/,$(subst $(SRCDIR)/,$$S/,$(subst $(OUTDIR)/,$$O/,$(subst $(WORKDIR)/,$$W/,$(subst $(gb_Helper_REPODIR_NATIVE)/,$$R/,$(subst $(gb_Helper_SRCDIR_NATIVE)/,$$S/,$(subst $(gb_Helper_OUTDIR_NATIVE)/,$$O/,$(subst $(gb_Helper_WORKDIR_NATIVE)/,$$W/,($1))))))))) endef
fs->cl: If you attach this as patch file, so it doesn't have the line breaks, and I know where to apply it exactly, I am willing to give it a try.
Created attachment 75590 [details] My proposed fix for this issue
there is a typo at the end of the patch that ends up all test quick: probably should be $(1) instead of ($1)
cl->hjs: please integrate after testing
added in gnumake3 http://hg.services.openoffice.org/cws/gnumake3/rev/f495584800da
@fs: please verify