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

ld: warning: /usr/lib/libpthread.dylib, ignoring unexpected dylib file #7933

Open
vicuna opened this Issue Feb 27, 2019 · 4 comments

Comments

Projects
None yet
1 participant
@vicuna
Copy link
Collaborator

vicuna commented Feb 27, 2019

Original bug ID: 7933
Reporter: @rauanmayemir
Status: confirmed (set by @nojb on 2019-02-27T19:34:51Z)
Resolution: open
Priority: low
Severity: minor
Platform: Darwin
OS: macOS
OS Version: 10.14.2
Version: 4.07.1
Category: compiler driver
Monitored by: @nojb @gasche

Bug description

This could happen whenever you compile with '-complete-output-obj' and have lwt in your deps, ultimately using threads.

Steps to reproduce

I thought this could only happen with some built-in libs, but I have a suspicion that having any relevant .dylib in the -Lpath will trigger this warning.

E.g: https://github.com/briskml/zarith/blob/d472f6c0588666177c54823298b17f8d5ecc2648/esy.json#L9

Here I'm feeding Zarith LDFLAGS with gmp -Lpath from a non-standard path. Having done that, I'll get the following warning as well:

ld: warning: gmp_path/lib/libgmp.dylib, ignoring unexpected dylib file
@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 27, 2019

Comment author: @nojb

Can you come up with a small reproduction case and run the compiler command that causes the error with -verbose?

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 27, 2019

Comment author: @rauanmayemir

Here's the full dune build output with -verbose flag.

    ocamlopt bin/.app.eobjs/native/app.{cmx,o}
+ clang -arch x86_64 -Wno-trigraphs -c -o 'bin/.app.eobjs/native/app.o' '/var/folders/zm/5rq5p3x148q1x2_zfpsd8kgr0000gn/T/camlasm732d06.s'
    ocamlopt bin/app.exe.o
+ clang -arch x86_64 -Wno-trigraphs -c -o '/var/folders/zm/5rq5p3x148q1x2_zfpsd8kgr0000gn/T/camlstartup5b30d6.o' '/var/folders/zm/5rq5p3x148q1x2_zfpsd8kgr0000gn/T/camlstartup61da89.s'
+ ld -r -arch x86_64 -o 'bin/app.exe.o' '-L/prefix/i/ocaml-4.7.1004-e5a2754f/lib/ocaml/threads' '-L/prefix/i/opam__s__camomile-opam__c__1.0.1-ef002573/lib/camomile' '-L/prefix/i/opam__s__camomile-opam__c__1.0.1-ef002573/lib/camomile/default_config' '-L/prefix/i/opam__s__camomile-opam__c__1.0.1-ef002573/lib/camomile/dyn' '-L/prefix/i/opam__s__camomile-opam__c__1.0.1-ef002573/lib/camomile/lib_default' '-L/prefix/i/opam__s__camomile-opam__c__1.0.1-ef002573/lib/camomile/library' '-L/prefix/i/opam__s__lambda_term-opam__c__1.13-2f9bb7e0/lib/lambda-term' '-L/prefix/i/opam__s__lwt-opam__c__4.1.0-8c8bef97/lib/lwt' '-L/prefix/i/opam__s__lwt-opam__c__4.1.0-8c8bef97/lib/lwt/unix' '-L/prefix/i/opam__s__lwt__log-opam__c__1.1.0-0260838d/lib/lwt_log' '-L/prefix/i/opam__s__lwt__log-opam__c__1.1.0-0260838d/lib/lwt_log/core' '-L/prefix/i/opam__s__lwt__react-opam__c__1.1.1-9a0d4a75/lib/lwt_react' '-L/prefix/i/opam__s__ocamlfind-opam__c__1.8.0-6a4a7e6d/lib/bytes' '-L/prefix/i/opam__s__react-opam__c__1.2.1-a06e95f6/lib/react' '-L/prefix/i/opam__s__result-opam__c__1.3-d355e89a/lib/result' '-L/prefix/i/opam__s__zed-opam__c__1.6-a1ebbec1/lib/zed' '-Llib' '-L/prefix/i/ocaml-4.7.1004-e5a2754f/lib/ocaml' '/var/folders/zm/5rq5p3x148q1x2_zfpsd8kgr0000gn/T/camlstartup5b30d6.o' 'bin/.app.eobjs/native/app.o' 'lib/lib.a' '/prefix/i/opam__s__lambda_term-opam__c__1.13-2f9bb7e0/lib/lambda-term/lambda_term.a' '/prefix/i/opam__s__lwt__log-opam__c__1.1.0-0260838d/lib/lwt_log/lwt_log.a' '/prefix/i/opam__s__lwt__log-opam__c__1.1.0-0260838d/lib/lwt_log/core/lwt_log_core.a' '/prefix/i/opam__s__zed-opam__c__1.6-a1ebbec1/lib/zed/zed.a' '/prefix/i/opam__s__camomile-opam__c__1.0.1-ef002573/lib/camomile/camomile_yuge.a' '/prefix/i/opam__s__camomile-opam__c__1.0.1-ef002573/lib/camomile/dyn/camomileLibraryDyn.a' '/prefix/i/opam__s__camomile-opam__c__1.0.1-ef002573/lib/camomile/lib_default/camomileLibraryDefault.a' '/prefix/i/opam__s__camomile-opam__c__1.0.1-ef002573/lib/camomile/library/camomileLibrary.a' '/prefix/i/opam__s__camomile-opam__c__1.0.1-ef002573/lib/camomile/default_config/camomileDefaultConfig.a' '/prefix/i/opam__s__lwt__react-opam__c__1.1.1-9a0d4a75/lib/lwt_react/lwt_react.a' '/prefix/i/opam__s__react-opam__c__1.2.1-a06e95f6/lib/react/react.a' '/prefix/i/opam__s__lwt-opam__c__4.1.0-8c8bef97/lib/lwt/unix/lwt_unix.a' '/prefix/i/ocaml-4.7.1004-e5a2754f/lib/ocaml/threads/threads.a' '/prefix/i/ocaml-4.7.1004-e5a2754f/lib/ocaml/bigarray.a' '/prefix/i/ocaml-4.7.1004-e5a2754f/lib/ocaml/unix.a' '/prefix/i/opam__s__lwt-opam__c__4.1.0-8c8bef97/lib/lwt/lwt.a' '/prefix/i/opam__s__result-opam__c__1.3-d355e89a/lib/result/result.a' '/prefix/i/ocaml-4.7.1004-e5a2754f/lib/ocaml/stdlib.a' '-llambda_term_stubs' '-llwt_unix_stubs' '-lpthread' '-lthreadsnat' '-lpthread' '-lbigarray' '-lunix' '/prefix/i/ocaml-4.7.1004-e5a2754f/lib/ocaml/libasmrun.a'
ld: warning: /usr/lib/libpthread.dylib, ignoring unexpected dylib file

I also created a repro case with instructions here: https://github.com/rauanmayemir/repro7933

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 27, 2019

Comment author: @nojb

It may be that we are passing shared libraries to the linker when "partially" linking ("ld -r"). We may have been relying on ld to silently ignore these arguments before.

Those flags probably come from C options embedded in OCaml archives, so not sure what we can do if this is the case.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 27, 2019

Comment author: @nojb

I was able to reproduce. Here's a smaller repro case:

$ touch foo.ml
$ ocamlopt -o foo -output-complete-obj unix.cmxa -I +threads threads.cmxa foo.ml
ld: warning: /usr/lib/libpthread.dylib, ignoring unexpected dylib file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.