diff mbox

libselinux: fix compiler flags for linux + clang

Message ID 1478031804-13993-1-git-send-email-william.c.roberts@intel.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Roberts, William C Nov. 1, 2016, 8:23 p.m. UTC
From: William Roberts <william.c.roberts@intel.com>

As reported by Nicolas Iooss, the clang + linux build seems
broken:

 clang-3.9: warning: argument unused during compilation: '-undefined
dynamic_lookup'
  /usr/bin/ld: unrecognised option: -install_name
  clang-3.9: error: linker command failed with exit code 1 (use -v to
see invocation)

We already have those options set for Darwin, just drop them from the
clang side.

Signed-off-by: William Roberts <william.c.roberts@intel.com>
---
 libselinux/src/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

William Roberts Nov. 1, 2016, 8:30 p.m. UTC | #1
Nicolas,

Let us know if this works for you, I am unable to test it at the
moment on Linux.
I did test this on Mac, its OK.

On Tue, Nov 1, 2016 at 1:23 PM,  <william.c.roberts@intel.com> wrote:
> From: William Roberts <william.c.roberts@intel.com>
>
> As reported by Nicolas Iooss, the clang + linux build seems
> broken:
>
>  clang-3.9: warning: argument unused during compilation: '-undefined
> dynamic_lookup'
>   /usr/bin/ld: unrecognised option: -install_name
>   clang-3.9: error: linker command failed with exit code 1 (use -v to
> see invocation)
>
> We already have those options set for Darwin, just drop them from the
> clang side.
>
> Signed-off-by: William Roberts <william.c.roberts@intel.com>
> ---
>  libselinux/src/Makefile | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> index ae40f80..b92fe1c 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -73,13 +73,12 @@ override CFLAGS += -fipa-pure-const -Wlogical-op -Wpacked-bitfield-compat -Wsync
>         -Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wp,-D_FORTIFY_SOURCE=2
>  else
>  override CFLAGS += -Wunused-command-line-argument
> -override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
> -LD_SONAME_FLAGS=-install_name,$(LIBSO)
>  endif
>
>  ifeq ($(OS), Darwin)
>  override CFLAGS += -I/opt/local/include
>  override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
> +LD_SONAME_FLAGS=-install_name,$(LIBSO)
>  endif
>
>  PCRE_LDFLAGS ?= -lpcre
> --
> 2.7.4
>
> _______________________________________________
> Selinux mailing list
> Selinux@tycho.nsa.gov
> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
> To get help, send an email containing "help" to Selinux-request@tycho.nsa.gov.
Stephen Smalley Nov. 1, 2016, 8:32 p.m. UTC | #2
On 11/01/2016 04:23 PM, william.c.roberts@intel.com wrote:
> From: William Roberts <william.c.roberts@intel.com>
> 
> As reported by Nicolas Iooss, the clang + linux build seems
> broken:
> 
>  clang-3.9: warning: argument unused during compilation: '-undefined
> dynamic_lookup'
>   /usr/bin/ld: unrecognised option: -install_name
>   clang-3.9: error: linker command failed with exit code 1 (use -v to
> see invocation)
> 
> We already have those options set for Darwin, just drop them from the
> clang side.

Thanks, applied.

> 
> Signed-off-by: William Roberts <william.c.roberts@intel.com>
> ---
>  libselinux/src/Makefile | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> index ae40f80..b92fe1c 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -73,13 +73,12 @@ override CFLAGS += -fipa-pure-const -Wlogical-op -Wpacked-bitfield-compat -Wsync
>  	-Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wp,-D_FORTIFY_SOURCE=2
>  else
>  override CFLAGS += -Wunused-command-line-argument
> -override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
> -LD_SONAME_FLAGS=-install_name,$(LIBSO)
>  endif
>  
>  ifeq ($(OS), Darwin)
>  override CFLAGS += -I/opt/local/include
>  override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
> +LD_SONAME_FLAGS=-install_name,$(LIBSO)
>  endif
>  
>  PCRE_LDFLAGS ?= -lpcre
>
William Roberts Nov. 1, 2016, 8:32 p.m. UTC | #3
On Tue, Nov 1, 2016 at 1:32 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On 11/01/2016 04:23 PM, william.c.roberts@intel.com wrote:
>> From: William Roberts <william.c.roberts@intel.com>
>>
>> As reported by Nicolas Iooss, the clang + linux build seems
>> broken:
>>
>>  clang-3.9: warning: argument unused during compilation: '-undefined
>> dynamic_lookup'
>>   /usr/bin/ld: unrecognised option: -install_name
>>   clang-3.9: error: linker command failed with exit code 1 (use -v to
>> see invocation)
>>
>> We already have those options set for Darwin, just drop them from the
>> clang side.
>
> Thanks, applied.

Did you check this with clang-3.9 locally and reproduce the error?

>
>>
>> Signed-off-by: William Roberts <william.c.roberts@intel.com>
>> ---
>>  libselinux/src/Makefile | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
>> index ae40f80..b92fe1c 100644
>> --- a/libselinux/src/Makefile
>> +++ b/libselinux/src/Makefile
>> @@ -73,13 +73,12 @@ override CFLAGS += -fipa-pure-const -Wlogical-op -Wpacked-bitfield-compat -Wsync
>>       -Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wp,-D_FORTIFY_SOURCE=2
>>  else
>>  override CFLAGS += -Wunused-command-line-argument
>> -override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
>> -LD_SONAME_FLAGS=-install_name,$(LIBSO)
>>  endif
>>
>>  ifeq ($(OS), Darwin)
>>  override CFLAGS += -I/opt/local/include
>>  override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
>> +LD_SONAME_FLAGS=-install_name,$(LIBSO)
>>  endif
>>
>>  PCRE_LDFLAGS ?= -lpcre
>>
>
> _______________________________________________
> Selinux mailing list
> Selinux@tycho.nsa.gov
> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
> To get help, send an email containing "help" to Selinux-request@tycho.nsa.gov.
William Roberts Nov. 1, 2016, 8:54 p.m. UTC | #4
On Tue, Nov 1, 2016 at 1:55 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On 11/01/2016 04:32 PM, William Roberts wrote:
>> On Tue, Nov 1, 2016 at 1:32 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
>>> On 11/01/2016 04:23 PM, william.c.roberts@intel.com wrote:
>>>> From: William Roberts <william.c.roberts@intel.com>
>>>>
>>>> As reported by Nicolas Iooss, the clang + linux build seems
>>>> broken:
>>>>
>>>>  clang-3.9: warning: argument unused during compilation: '-undefined
>>>> dynamic_lookup'
>>>>   /usr/bin/ld: unrecognised option: -install_name
>>>>   clang-3.9: error: linker command failed with exit code 1 (use -v to
>>>> see invocation)
>>>>
>>>> We already have those options set for Darwin, just drop them from the
>>>> clang side.
>>>
>>> Thanks, applied.
>>
>> Did you check this with clang-3.9 locally and reproduce the error?
>
> Yes.  I think casting to void* will clear it.

That's what I was leaning towards myself.
Stephen Smalley Nov. 1, 2016, 8:55 p.m. UTC | #5
On 11/01/2016 04:32 PM, William Roberts wrote:
> On Tue, Nov 1, 2016 at 1:32 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
>> On 11/01/2016 04:23 PM, william.c.roberts@intel.com wrote:
>>> From: William Roberts <william.c.roberts@intel.com>
>>>
>>> As reported by Nicolas Iooss, the clang + linux build seems
>>> broken:
>>>
>>>  clang-3.9: warning: argument unused during compilation: '-undefined
>>> dynamic_lookup'
>>>   /usr/bin/ld: unrecognised option: -install_name
>>>   clang-3.9: error: linker command failed with exit code 1 (use -v to
>>> see invocation)
>>>
>>> We already have those options set for Darwin, just drop them from the
>>> clang side.
>>
>> Thanks, applied.
> 
> Did you check this with clang-3.9 locally and reproduce the error?

Yes.  I think casting to void* will clear it.
William Roberts Nov. 1, 2016, 8:57 p.m. UTC | #6
On Tue, Nov 1, 2016 at 1:59 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On 11/01/2016 04:54 PM, William Roberts wrote:
>> On Tue, Nov 1, 2016 at 1:55 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
>>> On 11/01/2016 04:32 PM, William Roberts wrote:
>>>> On Tue, Nov 1, 2016 at 1:32 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
>>>>> On 11/01/2016 04:23 PM, william.c.roberts@intel.com wrote:
>>>>>> From: William Roberts <william.c.roberts@intel.com>
>>>>>>
>>>>>> As reported by Nicolas Iooss, the clang + linux build seems
>>>>>> broken:
>>>>>>
>>>>>>  clang-3.9: warning: argument unused during compilation: '-undefined
>>>>>> dynamic_lookup'
>>>>>>   /usr/bin/ld: unrecognised option: -install_name
>>>>>>   clang-3.9: error: linker command failed with exit code 1 (use -v to
>>>>>> see invocation)
>>>>>>
>>>>>> We already have those options set for Darwin, just drop them from the
>>>>>> clang side.
>>>>>
>>>>> Thanks, applied.
>>>>
>>>> Did you check this with clang-3.9 locally and reproduce the error?
>>>
>>> Yes.  I think casting to void* will clear it.
>>
>> That's what I was leaning towards myself.
>
> Actually, if you just switch the parameter type for buf in both
> functions to void*, everything is fine.
>
That's actually exactly what I have locally that I am testing.
Stephen Smalley Nov. 1, 2016, 8:59 p.m. UTC | #7
On 11/01/2016 04:54 PM, William Roberts wrote:
> On Tue, Nov 1, 2016 at 1:55 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
>> On 11/01/2016 04:32 PM, William Roberts wrote:
>>> On Tue, Nov 1, 2016 at 1:32 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
>>>> On 11/01/2016 04:23 PM, william.c.roberts@intel.com wrote:
>>>>> From: William Roberts <william.c.roberts@intel.com>
>>>>>
>>>>> As reported by Nicolas Iooss, the clang + linux build seems
>>>>> broken:
>>>>>
>>>>>  clang-3.9: warning: argument unused during compilation: '-undefined
>>>>> dynamic_lookup'
>>>>>   /usr/bin/ld: unrecognised option: -install_name
>>>>>   clang-3.9: error: linker command failed with exit code 1 (use -v to
>>>>> see invocation)
>>>>>
>>>>> We already have those options set for Darwin, just drop them from the
>>>>> clang side.
>>>>
>>>> Thanks, applied.
>>>
>>> Did you check this with clang-3.9 locally and reproduce the error?
>>
>> Yes.  I think casting to void* will clear it.
> 
> That's what I was leaning towards myself.

Actually, if you just switch the parameter type for buf in both
functions to void*, everything is fine.
diff mbox

Patch

diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index ae40f80..b92fe1c 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -73,13 +73,12 @@  override CFLAGS += -fipa-pure-const -Wlogical-op -Wpacked-bitfield-compat -Wsync
 	-Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wp,-D_FORTIFY_SOURCE=2
 else
 override CFLAGS += -Wunused-command-line-argument
-override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
-LD_SONAME_FLAGS=-install_name,$(LIBSO)
 endif
 
 ifeq ($(OS), Darwin)
 override CFLAGS += -I/opt/local/include
 override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
+LD_SONAME_FLAGS=-install_name,$(LIBSO)
 endif
 
 PCRE_LDFLAGS ?= -lpcre