Bug 1305016

Summary: libosinfo FTBFS on Mac OS X with Homebrew: ld: unknown option: --no-undefined
Product: [Community] Virtualization Tools Reporter: You-Sheng Yang <vicamo>
Component: libosinfoAssignee: Zeeshan Ali <zeenix>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: berrange, cfergeau, fidencio, mclasen, vicamo
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Mac OS   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-11 13:14:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
example homebrew formula file none

Description You-Sheng Yang 2016-02-05 10:40:56 UTC
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 11:09:52 UTC
(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 11:40:26 UTC
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 13:14:16 UTC
Okay, patch has been pushed (c4d379042f57f0512ba3fb5fea2109acc941b460) and will be part of 0.3.1 release.

Comment 4 Red Hat Bugzilla 2023-09-14 03:17:22 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days