#1 Fix clang build
Merged 4 months ago by zbyszek. Opened 3 years ago by tbaeder.
rpms/ tbaeder/infinipath-psm master  into  rawhide

@@ -1,12 +0,0 @@ 

- diff --git a/buildflags.mak b/buildflags.mak.old

- index 34fdf1c..2c229cb 100644

- --- a/buildflags.mak

- +++ b/buildflags.mak.old

- @@ -94,5 +94,6 @@ ifeq (1,${PSM_USE_SYS_UUID})

-  endif

-  

-  CFLAGS += $(BASECFLAGS) $(if $(filter $(CC),gcc),-Wno-strict-aliasing) \

- -	$(if $(PSM_VALGRIND:0=),-DPSM_VALGRIND,-DNVALGRIND)

- +	$(if $(PSM_VALGRIND:0=),-DPSM_VALGRIND,-DNVALGRIND) \

- +	-Wno-maybe-uninitialized -Wno-implicit-function-declaration

-  

@@ -0,0 +1,44 @@ 

+ diff -ruN infinipath-psm-3.3-26_g604758e_open.orig/ipath/ipath_proto.c infinipath-psm-3.3-26_g604758e_open/ipath/ipath_proto.c

+ --- infinipath-psm-3.3-26_g604758e_open.orig/ipath/ipath_proto.c	2020-12-09 09:34:06.556378925 +0100

+ +++ infinipath-psm-3.3-26_g604758e_open/ipath/ipath_proto.c	2020-12-09 10:03:27.225580369 +0100

+ @@ -37,11 +37,8 @@

+  // level infinipath protocol code.

+  

+  #include <sys/poll.h>

+ -#if __GNUC__ <= 6

+  #include <sys/types.h>

+ -#else

+  #include <sys/sysmacros.h>

+ -#endif

+  #include <sys/stat.h>

+  #include <stdint.h>

+  #include <stdlib.h>

+ diff -ruN infinipath-psm-3.3-26_g604758e_open.orig/ipath/ipath_time.c infinipath-psm-3.3-26_g604758e_open/ipath/ipath_time.c

+ --- infinipath-psm-3.3-26_g604758e_open.orig/ipath/ipath_time.c	2019-02-12 05:02:37.000000000 +0100

+ +++ infinipath-psm-3.3-26_g604758e_open/ipath/ipath_time.c	2020-12-09 09:34:41.897301872 +0100

+ @@ -279,7 +279,7 @@

+  #endif

+  

+      /* If there's no change (within a small range), just return the old one */

+ -    if (abs(new_pico_per_cycle - old_pico_per_cycle) < 5)

+ +    if (new_pico_per_cycle - old_pico_per_cycle < 5)

+  	return old_pico_per_cycle;

+  

+      if (ipath_timebase_isvalid(new_pico_per_cycle)) {

+ diff -ruN infinipath-psm-3.3-26_g604758e_open.orig/ptl_ips/ptl.c infinipath-psm-3.3-26_g604758e_open/ptl_ips/ptl.c

+ --- infinipath-psm-3.3-26_g604758e_open.orig/ptl_ips/ptl.c	2019-02-12 05:02:38.000000000 +0100

+ +++ infinipath-psm-3.3-26_g604758e_open/ptl_ips/ptl.c	2020-12-09 09:43:19.585179426 +0100

+ @@ -536,13 +536,6 @@

+  

+  PSMI_INLINE(

+  void

+ -ips_lock_shared_context (struct ptl_shared *recvshc))

+ -{

+ -    pthread_spin_lock(recvshc->context_lock);

+ -}

+ -

+ -PSMI_INLINE(

+ -void

+  ips_unlock_shared_context (struct ptl_shared *recvshc))

+  {

+      pthread_spin_unlock(recvshc->context_lock);

file modified
+7 -3
@@ -15,16 +15,20 @@ 

  Source0:        %{name}-%{version}-%{git_version}.tar.gz

  Source1:        ipath.rules

  Patch1:         0001-fix-a-compilation-issue.patch

- Patch2:         adjust-base-cflags.patch

  Patch3:         remove-executable-permissions-for-header-files.patch

  Patch4:         0001-Include-sysmacros.h.patch

  Patch5:         0001-Extend-buffer-for-uvalue-and-pvalue.patch

  Patch6:         extend-fdesc-array.patch

  Patch7:         psm-multiple-definition.patch

  Patch8:         infinipath-psm-gcc11.patch

+ Patch9:         fix-clang-build.patch

  

  Requires:       udev

+ %if "%{toolchain}" == "clang"

+ BuildRequires:  clang

+ %else

  BuildRequires:  gcc

+ %endif

  BuildRequires:  libuuid-devel

  BuildRequires:  systemd-rpm-macros

  BuildRequires: make
@@ -48,13 +52,13 @@ 

  %prep

  %setup -q -n %{name}-%{version}-%{git_version}

  %patch1 -p1

- %patch2 -p1

  %patch3 -p1

  %patch4 -p1

  %patch5 -p1

  %patch6 -p0

  %patch7 -p1

  %patch8 -p1

+ %patch9 -p1

  find libuuid -type f -not -name 'psm_uuid.[c|h]' -not -name Makefile -delete

  

  %build
@@ -64,7 +68,7 @@ 

  %define _lto_cflags %{nil}

  

  %{set_build_flags}

- %make_build PSM_USE_SYS_UUID=1 %{MAKEARG} CC=gcc

+ %make_build PSM_USE_SYS_UUID=1 %{MAKEARG}

  

  %install

  %make_install %{MAKEARG}

These commits make it possible to build the infinipath-psm package with clang (or other non-gcc compilers). The patch file included is at least partly upstream in the form of PRs which are not getting merged.

The PR looks good for me. I suggest add following lines into the last commit:

diff --git a/infinipath-psm.spec b/infinipath-psm.spec
index a567b32..8ba1f21 100644
--- a/infinipath-psm.spec
+++ b/infinipath-psm.spec
@@ -24,7 +24,11 @@ Patch8:         infinipath-psm-gcc11.patch
 Patch9:         fix-clang-build.patch

 Requires:       udev
+%if "%{toolchain}" == "clang"
+BuildRequires:  clang
+%else
 BuildRequires:  gcc
+%endif
 BuildRequires:  libuuid-devel
 BuildRequires:  systemd-rpm-macros
 Obsoletes:      infinipath-libs <= %{version}-%{release}

Thanks

3 new commits added

  • Add a patch to fix the clang build
  • Remove adjust-base-cflags patch
  • spec: Remove unnecessarily setting CC=gcc
3 years ago

rebased onto 72723c1

4 months ago

Pull-Request has been merged by zbyszek

4 months ago