Error building vtltape.c on RHEL8.1

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Error building vtltape.c on RHEL8.1

rohr22
Hi. I tried to build the latest 1.6.2 mhvtl code from https://github.com/markh794/mhvtl on a RHEL8.1 ppc64le machine. However, I got this error:

# make
make -C usr MHVTL_HOME_PATH=/opt/vtl MHVTL_CONFIG_PATH=/etc/mhvtl SYSTEMD_GENERATOR_DIR=/lib/systemd/system-generators
make[1]: Entering directory '/tmp/mhvtl/mhvtl-master/usr'
cc -Wall -Wshadow -g -O2 -D_LARGEFILE64_SOURCE  -I../kernel -I../ccan -DMHVTL_VERSION=\"1.6.2\" -D_GNU_SOURCE -DMHVTL_DEBUG -DMHVTL_HOME_PATH=\"/opt/vtl\" -DMHVTL_CONFIG_PATH=\"/etc/mhvtl\"   -c -o vtltape.o vtltape.c
vtltape.c: In function ‘main’:
vtltape.c:3044:6: error: hwcap ‘sse4.2’ is an invalid argument to builtin ‘__builtin_cpu_supports’
  if (__builtin_cpu_supports("sse4.2")) {
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [<builtin>: vtltape.o] Error 1
make[1]: Leaving directory '/tmp/mhvtl/mhvtl-master/usr'
make: *** [Makefile:56: usr] Error 2

I have this version of cc:
# cc --version
cc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Reply | Threaded
Open this post in threaded view
|

Re: Error building vtltape.c on RHEL8.1

rohr22
I got the code to compile by not calling the function __builtin_cpu_supports:

# diff -Naur 1.6.2/mhvtl-master/./usr/vtltape.c  mhvtl-master/usr/
--- 1.6.2/mhvtl-master/./usr/vtltape.c 2019-10-30 22:01:27.000000000 -0500
+++ mhvtl-master/usr/vtltape.c 2020-01-15 13:01:47.861592559 -0600
@@ -3041,11 +3041,14 @@
  ctl.channel, ctl.id, ctl.lun);
  MHVTL_DBG(1, "Size of buffer is %d", lu_ssc.bufsize);
+   /*
  if (__builtin_cpu_supports("sse4.2")) {
  MHVTL_DBG(1, "crc32c using Intel sse4.2 hardware optimization");
  } else {
  MHVTL_DBG(1, "crc32c not using Intel sse4.2 optimization");
  }
+   */
+ MHVTL_DBG(1, "crc32c not using Intel sse4.2 optimization");
  oom_adjust();

# diff -Naur 1.6.2/mhvtl-master/usr/dump_tape.c  mhvtl-master/usr/
--- 1.6.2/mhvtl-master/usr/dump_tape.c 2019-10-30 22:01:27.000000000 -0500
+++ mhvtl-master/usr/dump_tape.c 2020-01-15 13:02:40.929376960 -0600
@@ -444,11 +444,13 @@
  if (argc < 2)
  usage("Not enough arguments");
+   /*
  if (__builtin_cpu_supports("sse4.2")) {
  printf("crc32c using Intel sse4.2 hardware optimization\n");
  } else {
  printf("crc32c not using Intel sse4.2 optimization\n");
  }
+   */
  while (argc > 1) {
  if (argv[1][0] == '-') {
Reply | Threaded
Open this post in threaded view
|

Re: Error building vtltape.c on RHEL8.1

Mark Harvey
Administrator
Any chance of reporting the version of gcc ?

Otherwise I’ll try spin up an 8.1 in next couple of days 

Sent from my iPhone

On 16 Jan 2020, at 06:23, rohr22 [via mhVTL - A Linux Virtual Tape Library] <[hidden email]> wrote:

 I got the code to compile by not calling the function __builtin_cpu_supports:

# diff -Naur 1.6.2/mhvtl-master/./usr/vtltape.c  mhvtl-master/usr/
--- 1.6.2/mhvtl-master/./usr/vtltape.c 2019-10-30 22:01:27.000000000 -0500
+++ mhvtl-master/usr/vtltape.c 2020-01-15 13:01:47.861592559 -0600
@@ -3041,11 +3041,14 @@
  ctl.channel, ctl.id, ctl.lun);
  MHVTL_DBG(1, "Size of buffer is %d", lu_ssc.bufsize);
+   /*
  if (__builtin_cpu_supports("sse4.2")) {
  MHVTL_DBG(1, "crc32c using Intel sse4.2 hardware optimization");
  } else {
  MHVTL_DBG(1, "crc32c not using Intel sse4.2 optimization");
  }
+   */
+ MHVTL_DBG(1, "crc32c not using Intel sse4.2 optimization");
  oom_adjust();

# diff -Naur 1.6.2/mhvtl-master/usr/dump_tape.c  mhvtl-master/usr/
--- 1.6.2/mhvtl-master/usr/dump_tape.c 2019-10-30 22:01:27.000000000 -0500
+++ mhvtl-master/usr/dump_tape.c 2020-01-15 13:02:40.929376960 -0600
@@ -444,11 +444,13 @@
  if (argc < 2)
  usage("Not enough arguments");
+   /*
  if (__builtin_cpu_supports("sse4.2")) {
  printf("crc32c using Intel sse4.2 hardware optimization\n");
  } else {
  printf("crc32c not using Intel sse4.2 optimization\n");
  }
+   */
  while (argc > 1) {
  if (argv[1][0] == '-') {



If you reply to this email, your message will be added to the discussion below:
http://mhvtl-a-linux-virtual-tape-library.966029.n3.nabble.com/Error-building-vtltape-c-on-RHEL8-1-tp4026274p4026275.html
To start a new topic under mhVTL - A Linux Virtual Tape Library, email [hidden email]
To unsubscribe from mhVTL - A Linux Virtual Tape Library, click here.
NAML
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Error building vtltape.c on RHEL8.1

Mark Harvey
Administrator
In reply to this post by rohr22
This is what you get when reading emails on a small screen...

Sorry - I missed the 'ppc64le' machine piece...

I confirmed it still compiles on a CentOS 8.1 & x86_64 combo anyway :)

Thanks for the bug report. I'll look into how to conditionally compile..
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Error building vtltape.c on PPC / RHEL8.1

Mark Harvey
Administrator
Any chance of testing this patch ?

It simply excludes the '__builtin_cpu_supports()' unless the CPU is a 64bit x86...

diff --git a/usr/dump_tape.c b/usr/dump_tape.c
index 124ce1c..039e921 100644
--- a/usr/dump_tape.c
+++ b/usr/dump_tape.c
@@ -444,11 +444,13 @@ int main(int argc, char *argv[])
 	if (argc < 2)
 		usage("Not enough arguments");
 
+#ifdef __x86_64__
 	if (__builtin_cpu_supports("sse4.2")) {
 		printf("crc32c using Intel sse4.2 hardware optimization\n");
 	} else {
 		printf("crc32c not using Intel sse4.2 optimization\n");
 	}
+#endif
 
 	while (argc > 1) {
 		if (argv[1][0] == '-') {
diff --git a/usr/vtltape.c b/usr/vtltape.c
index 419c66e..40c9af0 100644
--- a/usr/vtltape.c
+++ b/usr/vtltape.c
@@ -3056,11 +3083,13 @@ int main(int argc, char *argv[])
 					ctl.channel, ctl.id, ctl.lun);
 	MHVTL_DBG(1, "Size of buffer is %d", lu_ssc.bufsize);
 
+#ifdef __x86_64__
 	if (__builtin_cpu_supports("sse4.2")) {
 		MHVTL_DBG(1, "crc32c using Intel sse4.2 hardware optimization");
 	} else {
 		MHVTL_DBG(1, "crc32c not using Intel sse4.2 optimization");
 	}
+#endif
 
 	oom_adjust();


I won't have access to a PPC environment until next week at earliest.
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Error building vtltape.c on PPC / RHEL8.1

rohr22
Hi, Mark.

I tested out the two patches and they work just fine.

Thank you,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: Error building vtltape.c on PPC / RHEL8.1

Mark Harvey
Administrator
I’ll push the change out today. Thanks for the bug report and testing the fix

Sent from my iPhone

On 17 Jan 2020, at 00:09, rohr22 [via mhVTL - A Linux Virtual Tape Library] <[hidden email]> wrote:

 Hi, Mark.

I tested out the two patches and they work just fine.

Thank you,
Peter


If you reply to this email, your message will be added to the discussion below:
http://mhvtl-a-linux-virtual-tape-library.966029.n3.nabble.com/Error-building-vtltape-c-on-RHEL8-1-tp4026274p4026279.html
To start a new topic under mhVTL - A Linux Virtual Tape Library, email [hidden email]
To unsubscribe from mhVTL - A Linux Virtual Tape Library, click here.
NAML
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Error building vtltape.c on PPC / RHEL8.1

Mark Harvey
Administrator
In reply to this post by rohr22
Just to confirm - the patch should now be in github

commit 26a60b9ba78f61e7788df4ce3313e7db6cd908ea
Author: Mark Harvey <markh794@gmail.com>
Date:   Thu Jan 16 13:43:00 2020 +1100

    Exclude __builtin_cpu_supports() on non x86_64 CPU types
    
    Reported via : http://mhvtl-a-linux-virtual-tape-library.966029.n3.nabble.com/Error-building-vtltape-c-on-RHEL8-1-tp4026274p4026278.html
    
Regards from Australia
Mark Harvey