Nvc++ make/cmake build equivalent -stdpar / makefile automake

I have a plethora of software source that I would like to try this out on;

The series have pretty much all of the same setup. There is no “int main ()” to start off the program.

It’s usually built using a bash command "./install.sh"

#!/bin/bash
./autogen.sh || echo done
SSD2="-msse2"
CFLAGS="$SSD2" ./configure --with-curl

make -j$(nproc)

strip -s vodecpro

THE NEXT FILE IS_
autogen.sh

#!/bin/sh
set -e
aclocal
autoheader
automake --foreign --copy
autoconf

THE NEXT FILE IS_
makefile

SUBDIRS		= arch_arm/lib/encoders asm/lib/encoders x86_64/lib/encoders arch_x86/lib/encoders

ALL_INCLUDES	= @PTHREAD_FLAGS@ -fno-strict-aliasing  -I.

bin_PROGRAMS	= vodecpro

dist_man_MANS	= vodecpro.1

vodecpro_SOURCES = \
....
....
....
....
disable_flags =

if USE_ASM
   vodecpro_SOURCES += asm/lib/encoders
if ARCH_x86
   vodecpro_SOURCES += arch_x86/lib/encoders
endif
if ARCH_x86_64
   vodecpro_SOURCES += x86_64/lib/encoders
endif
if ARCH_ARM
   vodecpro_SOURCES += arch_arm/lib/encoders
endif
else
   disable_flags += -x
endif

if WINDOWS_PC
   vodecpro_SOURCES += ffmpeg/probe.c
endif

vodecpro_LDFLAGS	= @LDFLAGS@
vodecpro_LDADD	= @LIBCURL@ @PTHREAD_LIBS@ @AWS_LIB@ -lssl -lgmp
vodecpro_CPPFLAGS = @LIBCURL_CPPFLAGS@ $(ALL_INCLUDES)
vodecpro_CFLAGS   = $(disable_flags)

if WINDOWS_PC
vodecpro_CFLAGS += --stack
endif

if WINDOWS_PC
# use to profile an object
# gprof_cflags = -pG -g3
# vodecpro_LDFLAGS += -pg
# vodecpro_CFLAGS += -fno-inline-functions -static

# copy/paste from generated Makefile
common_ccflags = $(EECODERS) $(ALL_INCLUDES) $(vodecpro_CPPFLAGS) $(CPPFLAGS) $(vodecpro_CFLAGS) $(CFLAGS)

#EXTRA CFLAGS
vodecpro-ffmpeg.c:ffmpeg.c
	@echo "CUSTOM ${@}: ${filter %.o,${^}} ${filter %.c,${^}}"
	$(CC) $(common_ccflags) -g -O3 $(gprof_cflags) -MT $@ -M4D -MR -c -o


endif

if anyone could help me with this, I am not familiar with compiling with NVC++

I would like to compile these options, but if these are not compatible, let me know. The goal is to learn. I have read the documentation for the past 3 days now, and I can’t get anywhere. If they or someone just has an example file on how you actually compile with nvc++ as opposed to the generic bash that won’t help anyone, that would be great.

Hi Andrew,

Apologies but I’m not 100% clear on your question. I believe you’re asking how to get your build to use the NVHPC Compilers?

The specifics of your build may differ but typically one would set “CC=nvc” and “CXX=nvc++” in your environment before running configure so the configure script know which compiler to create the Makefile for.

Though, you’ll not want to use the “-mssse2” flag since that’s a GNU compiler flag. I don’t know what specific flags you should use for the build, but we typically recommend using “-fast”.

Something like:

export CC=nvc
export CXX=nvc++
export CFLAGS="-fast"
 ./configure --with-curl

Hope this helps,
Mat

I just noticed your header about wanting to use “-stdpar”. Though in the generated Makefile, I’m not seeing any C++, just a rule to make a C file.

Presuming you’re build follows norms and does include C++ source files which use C++17 standard language parallelism, you’ll want to set “CXXFLAGS=”-fast -stdpar"" in your environment as well before running configure.

Hey! We made it a lot further than we did before, but now it’s saying

configure: error: cannot run C compiled programs.
If you meant to cross compile, use `–host’.

I’ve tried putting --host in many places, not sure where it wants me to put it.

You’ll want to look in the generated log file (config.log) to see what the actual error is and why it’s not able to use ‘nvc’ as the C compiler. Most likely an unrecognize flag is being used.