Skip to content

cmd/go: go install -buildmode=shared with no directory name generates bad shared library name #12236

@avdva

Description

@avdva

Go v 1.5. Fedora 22 x86_64

  1. Compile and install the package named "worker":
    go install -buildmode=shared -linkshared
  2. Try to compile another package, which imports "worker":
    go build -linkshared
    go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 gcc: error: missing argument to ‘-l’
    Output with the '-x' option:
    /home/user/dev/go/pkg/tool/linux_amd64/link -o $WORK/godev/proj/_obj/exe/a.out -L $WORK -L /home/user/dev/godev/pkg/linux_amd64_dynlink -installsuffix dynlink -extld=gcc -buildmode=exe -buildid=98b4ec39a65525d2ee4614652117b2ad4dfdeb26 -linkshared -w $WORK/godev/proj.a /home/user/dev/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 gcc: error: missing argument to ‘-l
    The same command with '-x --compiler=gccgo' option produces the following:
    /usr/bin/gccgo -o $WORK/godev/testgo/_obj/exe/a.out $WORK/godev/testgo/_obj/_go_.o -Wl,-( -m64 -Wl,-) -L/home/user/dev/godev/pkg/gccgo_linux_amd64_fPIC/shlibs -Wl, -rpath=/home/user/dev/godev/pkg/gccgo_linux_amd64_fPIC/shlibs -l -Wl,-E -fPIC
    The output is:
    /usr/bin/ld: cannot find -l-Wl,-E collect2: error: ld returned 1 exit status
    It compiles well without -linkshared. Is there an error, or I just misuse these options?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions