google / fhir-examples

Usage Examples for github.com/google/fhir
Apache License 2.0
107 stars 31 forks source link

Error when running example 3: /usr/bin/zip: Argument list too long #6

Open sttawm opened 4 years ago

sttawm commented 4 years ago

When running generate_protos.sh proto/google/fhir_examples/myprofile:myprofile, I get:

ERROR: /private/var/tmp/_bazel_sttawm/af784bd1a9c84e41a49e63c2d22f20ae/external/com_google_fhir/spec/BUILD:28:13: Executing genrule @com_google_fhir//spec:_genrule_fhir_stu3_package failed (Exit 1) bash failed: error executing command /bin/bash bazel-out/darwin-fastbuild/bin/external/com_google_fhir/spec/_genrule_fhir_stu3_package.genrule_script.sh

Use --sandbox_debug to see verbose messages from the sandbox
bazel-out/darwin-fastbuild/bin/external/com_google_fhir/spec/_genrule_fhir_stu3_package.genrule_script.sh: line 2: /usr/bin/zip: Argument list too long

Maybe passing a directory to zip would fix it?

I'm on a mac (ios 10.15) which gives:

sttawm$ bazel --version
bazel 3.3.0-homebrew
sttawm$ zip -v
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
This is Zip 3.0 (July 5th 2008), by Info-ZIP.
Currently maintained by E. Gordon.  Please send bug reports to
the authors using the web page at www.info-zip.org; see README for details.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip,
as of above date; see http://www.info-zip.org/ for other sites.

Compiled with gcc 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc-selector-opts) for Unix (Mac OS X) on Apr 17 2020.

Zip special compilation options:
    USE_EF_UT_TIME       (store Universal Time)
    SYMLINK_SUPPORT      (symbolic links supported)
    LARGE_FILE_SUPPORT   (can read and write large files on file system)
    ZIP64_SUPPORT        (use Zip64 to store large files in archives)
    STORE_UNIX_UIDs_GIDs (store UID/GID sizes/values using new extra field)
    UIDGID_16BIT         (old Unix 16-bit UID/GID extra field also used)
    [encryption, version 2.91 of 05 Jan 2007] (modified for Zip 3)

Encryption notice:
    The encryption code of this program is not copyrighted and is
    put in the public domain.  It was originally written in Europe
    and, to the best of our knowledge, can be freely distributed
    in both source and object forms from any country, including
    the USA under License Exception TSU of the U.S. Export
    Administration Regulations (section 740.13(e)) of 6 June 2002.

Zip environment options:
             ZIP:  [none]
          ZIPOPT:  [none]
sttawm commented 4 years ago

I'm not sure how to define (and generate protos for) profiles and extensions without hitting this error.

The error seems the result of a bazel rule (?) that generates a command / shell-script with too many arguments.

Any idea where this command is being generated?

The full command is in bazel-out/darwin-fastbuild/bin/external/com_google_fhir/spec/_genrule_fhir_stu3_package.genrule_script.sh

The beginning of it looks like this (minus new-line formatting):

source external/bazel_tools/tools/genrule/genrule-setup.sh; 
zip --quiet -j bazel-out/darwin-fastbuild/bin/external/com_google_fhir/spec/fhir_stu3_package.zip \
external/com_google_fhir/spec/fhir_stu3_package_info.prototxt \
external/com_google_fhir/spec/hl7.fhir.core/3.0.1/modified/StructureDefinition-StructureDefinition.json \
external/com_google_fhir/spec/hl7.fhir.core/3.0.1/modified/StructureDefinition-cqif-condition.json \
external/com_google_fhir/spec/hl7.fhir.core/3.0.1/modified/StructureDefinition-cqif-cqlExpression.json \
external/com_google_fhir/spec/hl7.fhir.core/3.0.1/modified/StructureDefinition-cqif-fhirPathExpression.json 
... etc.