Bug 1305016 - libosinfo FTBFS on Mac OS X with Homebrew: ld: unknown option: --no-undefined [NEEDINFO]
libosinfo FTBFS on Mac OS X with Homebrew: ld: unknown option: --no-undefined
Status: CLOSED NEXTRELEASE
Product: Virtualization Tools
Classification: Community
Component: libosinfo (Show other bugs)
unspecified
x86_64 Mac OS
unspecified Severity unspecified
: ---
: ---
Assigned To: Zeeshan Ali
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-05 05:40 EST by You-Sheng Yang
Modified: 2016-09-19 21:43 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-05-11 09:14:16 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
fidencio: needinfo? (vicamo)


Attachments (Terms of Use)
example homebrew formula file (1.14 KB, text/plain)
2016-02-05 05:40 EST, You-Sheng Yang
no flags Details

  None (edit)
Description You-Sheng Yang 2016-02-05 05:40:56 EST
Created attachment 1121336 [details]
example homebrew formula file

Description of problem:
When porting libosinfo to Mac OS X with Homebrew, clang ld complains:

  ld: unknown option: --no-undefined
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Version-Release number of selected component (if applicable):
v0.3.0

How reproducible:
Always.

Steps to Reproduce:
1. add attached libosinfo.rb file to $(brew --prefix)/Library/Formula
2. try to install with `brew install libosinfo --with-vala --with-gobject-introspection --debug`

Actual results:
Full error messages are:

  ==> ./configure --prefix=/usr/local/Cellar/libosinfo/0.3.0 --localstatedir=/usr/local/var --mandir=/usr/local/Cellar/libosinfo/0.3.0/share/man --sysconfdir=/usr/local/etc --disable-udev --enable-tests --enable-introspection --enable-vala
  ==> make
  Last 15 lines from /Users/vicamo/Library/Logs/Homebrew/libosinfo/02.make:
    CC       libosinfo_1_0_la-osinfo_media.lo
    CC       libosinfo_1_0_la-osinfo_medialist.lo
    CC       libosinfo_1_0_la-osinfo_resources.lo
    CC       libosinfo_1_0_la-osinfo_resourceslist.lo
    CC       libosinfo_1_0_la-osinfo_tree.lo
    CC       libosinfo_1_0_la-osinfo_treelist.lo
    CC       libosinfo_1_0_la-osinfo_db.lo
    CC       libosinfo_1_0_la-osinfo_loader.lo
    CCLD     libosinfo-1.0.la
  ld: unknown option: --no-undefined
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make[3]: *** [libosinfo-1.0.la] Error 1
  make[2]: *** [all] Error 2
  make[1]: *** [all-recursive] Error 1
  make: *** [all] Error 2

Expected results:
libosinfo successfully installed.

Additional info:
Mac OS X 10.11.3, Xcode 7.2, Apple LLVM version 7.0.2 (clang-700.1.81)
Comment 1 Fabiano Fidêncio 2016-02-05 06:09:52 EST
(In reply to You-Sheng Yang from comment #0)
> Created attachment 1121336 [details]
> example homebrew formula file
> 
> Description of problem:
> When porting libosinfo to Mac OS X with Homebrew, clang ld complains:
> 
>   ld: unknown option: --no-undefined
>   clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> 
> Version-Release number of selected component (if applicable):
> v0.3.0
> 
> How reproducible:
> Always.
> 
> Steps to Reproduce:
> 1. add attached libosinfo.rb file to $(brew --prefix)/Library/Formula
> 2. try to install with `brew install libosinfo --with-vala
> --with-gobject-introspection --debug`
> 
> Actual results:
> Full error messages are:
> 
>   ==> ./configure --prefix=/usr/local/Cellar/libosinfo/0.3.0
> --localstatedir=/usr/local/var
> --mandir=/usr/local/Cellar/libosinfo/0.3.0/share/man
> --sysconfdir=/usr/local/etc --disable-udev --enable-tests
> --enable-introspection --enable-vala
>   ==> make
>   Last 15 lines from /Users/vicamo/Library/Logs/Homebrew/libosinfo/02.make:
>     CC       libosinfo_1_0_la-osinfo_media.lo
>     CC       libosinfo_1_0_la-osinfo_medialist.lo
>     CC       libosinfo_1_0_la-osinfo_resources.lo
>     CC       libosinfo_1_0_la-osinfo_resourceslist.lo
>     CC       libosinfo_1_0_la-osinfo_tree.lo
>     CC       libosinfo_1_0_la-osinfo_treelist.lo
>     CC       libosinfo_1_0_la-osinfo_db.lo
>     CC       libosinfo_1_0_la-osinfo_loader.lo
>     CCLD     libosinfo-1.0.la
>   ld: unknown option: --no-undefined
>   clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
>   make[3]: *** [libosinfo-1.0.la] Error 1
>   make[2]: *** [all] Error 2
>   make[1]: *** [all-recursive] Error 1
>   make: *** [all] Error 2
> 
> Expected results:
> libosinfo successfully installed.
> 
> Additional info:
> Mac OS X 10.11.3, Xcode 7.2, Apple LLVM version 7.0.2 (clang-700.1.81)

May I ask you for the whole configure log, please?

I do believe it's just a matter that Apple's linker equivalent to --no-undefined should be something like: "-undefined,error".
Can you test if it works for you? (I don't have access to a Mac for testing).
Comment 2 Fabiano Fidêncio 2016-02-05 06:40:26 EST
This is a simple patch that may solve the problem.
Let me know if it works for you.

ffidenci@cat ~/src/upstream/libosinfo $ git diff
diff --git a/configure.ac b/configure.ac
index dfd8598..13277dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,6 +97,10 @@ case "$host" in
     NO_UNDEFINED_LDFLAGS="-no-undefined"
     ;;
 
+  darwin*)
+    NO_UNDEFINED_LDFLAGS="-Wl,-undefined,error"
+    ;;
+
   *)
     NO_UNDEFINED_FLAGS="-Wl,--no-undefined"
     VERSION_SCRIPT_FLAGS=-Wl,--version-script=
Comment 3 Fabiano Fidêncio 2016-05-11 09:14:16 EDT
Okay, patch has been pushed (c4d379042f57f0512ba3fb5fea2109acc941b460) and will be part of 0.3.1 release.

Note You need to log in before you can comment on or make changes to this bug.