Skip to content

OSX: must run make twice to build json dependency #6

Closed

Description

@dsummersl

When I build this on OSX, I get the following error the first time I run make:

cc  -m64 -I/usr/local/Cellar/pcre/8.33/include -Wall -Wextra -Wdeclaration-after-statement -g -gdwarf-2 -fno-omit-frame-pointer   -o tests/bser.t tests/tests_bser_t-bser.o tests_bser_t-bser.o -L. -lwmanjson -ltap -L/usr/local/Cellar/pcre/8.33/lib -lpcre
ld: library not found for -lwmanjson
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The second time I execute the make command, the library builds.

Any ideas why it wouldn't work the first time around?

Activity

  1. wez commented on Jun 8, 2013

    @wez
    Contributor

    Sounds like a dependency problem. Are you running make -j?

  2. dsummersl commented on Jun 8, 2013

    @dsummersl
    Author

    No, I'm just using make (no -j).

    First time around, I see:

    ...
    ...
    mv -f thirdparty/jansson/.deps/libwmanjson_a-utf.Tpo thirdparty/jansson/.deps/libwmanjson_a-utf.Po
    cc -DHAVE_CONFIG_H -I.  -Ithirdparty/jansson -D_REENTRANT  -m64 -I/usr/local/Cellar/pcre/8.33/include -Wall -Wextra -Wdeclaration-after-statement -g -gdwarf-2 -fno-omit-frame-pointer -MT thirdparty/libtap_a-tap.o -MD -MP -MF thirdparty/.deps/libtap_a-tap.Tpo -c -o thirdparty/libtap_a-tap.o `test -f 'thirdparty/tap.c' || echo './'`thirdparty/tap.c
    mv -f thirdparty/.deps/libtap_a-tap.Tpo thirdparty/.deps/libtap_a-tap.Po
    mv -f thirdparty/jansson/.deps/libwmanjson_a-value.Tpo thirdparty/jansson/.deps/libwmanjson_a-value.Po
    ...
    ...
    cc  -m64 -I/usr/local/Cellar/pcre/8.33/include -Wall -Wextra -Wdeclaration-after-statement -g -gdwarf-2 -fno-omit-frame-pointer   -o tests/log.t tests/tests_log_t-log.o tests_log_t-log.o -L. -lwmanjson -ltap -L/usr/local/Cellar/pcre/8.33/lib -lpcre
    ld: library not found for -lwmanjson
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [tests/log.t] Error 1
    make[1]: *** Waiting for unfinished jobs....
    mv -f tests/.deps/tests_argv_t-argv.Tpo tests/.deps/tests_argv_t-argv.Po
    make: *** [all] Error 2
    

    (which fails at the line I mentioned earlier).

    Second time around I see:

    rm -f libwmanjson.a
    ar cru libwmanjson.a thirdparty/jansson/libwmanjson_a-dump.o thirdparty/jansson/libwmanjson_a-error.o thirdparty/jansson/libwmanjson_a-hashtable.o thirdparty/jansson/libwmanjson_a-load.o thirdparty/jansson/libwmanjson_a-memory.o thirdparty/jansson/libwmanjson_a-pack_unpack.o thirdparty/jansson/libwmanjson_a-strbuffer.o thirdparty/jansson/libwmanjson_a-strconv.o thirdparty/jansson/libwmanjson_a-utf.o thirdparty/jansson/libwmanjson_a-value.o 
    rm -f libtap.a
    ar cru libtap.a thirdparty/libtap_a-tap.o 
    ranlib libwmanjson.a
    ranlib libtap.a
    cc  -m64 -I/usr/local/Cellar/pcre/8.33/include -Wall -Wextra -Wdeclaration-after-statement -g -gdwarf-2 -fno-omit-frame-pointer   -o watchman watchman-argv.o watchman-opt.o watchman-cfg.o watchman-log.o watchman-json.o watchman-bser.o watchman-hash.o watchman-ht.o cmds/watchman-find.o cmds/watchman-info.o cmds/watchman-log.o cmds/watchman-query.o cmds/watchman-since.o cmds/watchman-subscribe.o cmds/watchman-trigger.o cmds/watchman-watch.o query/watchman-base.o query/watchman-parse.o query/watchman-init.o query/watchman-eval.o query/watchman-type.o query/watchman-suffix.o query/watchman-match.o query/watchman-pcre.o query/watchman-name.o query/watchman-fieldlist.o query/watchman-since.o query/watchman-empty.o watchman-listener.o watchman-clientmode.o watchman-main.o watchman-root.o watchman-rules.o watchman-state.o watchman-string.o -L. -lwmanjson -L/usr/local/Cellar/pcre/8.33/lib -lpcre
    cc  -m64 -I/usr/local/Cellar/pcre/8.33/include -Wall -Wextra -Wdeclaration-after-statement -g -gdwarf-2 -fno-omit-frame-pointer   -o tests/argv.t tests/tests_argv_t-argv.o tests_argv_t-argv.o -L. -lwmanjson -ltap -L/usr/local/Cellar/pcre/8.33/lib -lpcre
    cc  -m64 -I/usr/local/Cellar/pcre/8.33/include -Wall -Wextra -Wdeclaration-after-statement -g -gdwarf-2 -fno-omit-frame-pointer   -o tests/log.t tests/tests_log_t-log.o tests_log_t-log.o -L. -lwmanjson -ltap -L/usr/local/Cellar/pcre/8.33/lib -lpcre
    cc  -m64 -I/usr/local/Cellar/pcre/8.33/include -Wall -Wextra -Wdeclaration-after-statement -g -gdwarf-2 -fno-omit-frame-pointer   -o tests/bser.t tests/tests_bser_t-bser.o tests_bser_t-bser.o -L. -lwmanjson -ltap -L/usr/local/Cellar/pcre/8.33/lib -lpcre
    

    It looks like the wmanjson library isn't compiled into an archive the first time
    around.

  3. wez commented on Jun 8, 2013

    @wez
    Contributor

    Try with this diff:

    diff --git a/Makefile.am b/Makefile.am
    index aa481f8..d632fa5 100644
    --- a/Makefile.am
    +++ b/Makefile.am
    @@ -4,7 +4,7 @@ doc_DATA = README.markdown
     docdir = ${prefix}/share/doc/watchman-$(VERSION)
    
     THIRDPARTY_CPPFLAGS = -I$(top_srcdir)/thirdparty/jansson -I$(top_builddir)/thirdparty/jansson
    -JSON_LIB = -L. -lwmanjson
    +JSON_LIB = -L. libwmanjson.a
    
     watchman_CPPFLAGS = $(THIRDPARTY_CPPFLAGS) @IRONMANCFLAGS@
     watchman_LDADD = $(JSON_LIB)
    @@ -72,7 +72,7 @@ libwmanjson_a_SOURCES = \
     # bundled testing library
     libtap_a_CPPFLAGS = $(THIRDPARTY_CPPFLAGS)
     libtap_a_SOURCES = thirdparty/tap.c
    -TAP_LIB = -ltap
    +TAP_LIB = libtap.a
    
     # unit tests
     TESTS = tests/argv.t tests/log.t tests/bser.t
    
  4. dsummersl commented on Jun 9, 2013

    @dsummersl
    Author

    A slight mod to the patch (for v2.5.1 that I'm using) works fine, thanks! BTW I'm submitting a push for homebrew and I'll include this patch with it for v2.5.1 (Homebrew/legacy-homebrew#20349). Will this patch be included for future releases?

  5. wez commented on Jun 9, 2013

    @wez
    Contributor

    Yep, pushed d335591 and tagged it as 2.6; you can update your recipe to point to that; thanks for reporting this, and thanks for getting it into homebrew.

  6. added a commit that references this issue on Oct 28, 2013
  7. added a commit that references this issue on Aug 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions