build error HEAD & clang

30 views
Skip to first unread message

Gary Ferland

unread,
Nov 21, 2021, 9:42:25 PM11/21/21
to cloudy-dev
We get lots of these when building master HEAD

clang: warning: argument unused during compilation: '-no-pie' [-Wunused-command-line-argument]

compiler is
Alien20:master:clang++ --version
Ubuntu clang version 12.0.0-3ubuntu1~21.04.2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

clang on llvm does not complain, and gcc does not either
Alien20:master:g++ --version
g++ (Ubuntu 10.3.0-1ubuntu1) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.

Gary J. Ferland

unread,
Nov 21, 2021, 10:16:24 PM11/21/21
to cloud...@googlegroups.com
from the gcc man page

       -no-pie
           Don't produce a dynamically linked position independent executable.

--
--
http://groups.google.com/group/cloudy-dev
---
You received this message because you are subscribed to the Google Groups "cloudy-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloudy-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloudy-dev/b8ddfece-a2d4-4c9b-9add-0b517aa30f4en%40googlegroups.com.


--
Gary J. Ferland
Physics, Univ of Kentucky
Lexington KY 40506 USA
Tel: 859 257-8795
https://pa.as.uky.edu/users/gary

Gary J. Ferland

unread,
Nov 21, 2021, 10:18:31 PM11/21/21
to cloud...@googlegroups.com
and it is not in the clang man page

Marios Chatzikos

unread,
Nov 21, 2021, 10:29:49 PM11/21/21
to cloud...@googlegroups.com

How can we have missed this?

https://clang.llvm.org/docs/ClangCommandLineReference.html#target-independent-compilation-options

It looks like it exists, but capitalized.

-fPIC, -fno-PIC
-fPIE, -fno-PIE
-faccess-control, -fno-access-control
-faddrsig, -fno-addrsig
Emit an address-significance table

Maybe try this?

$ git diff capabilities.pl
diff --git a/source/capabilities.pl b/source/capabilities.pl
index 499a5ff..1a1cf27 100755
--- a/source/capabilities.pl
+++ b/source/capabilities.pl
@@ -62,7 +62,7 @@ if( "$^O" ne "cygwin" ) {
 unlink "tmp_cloudyconfig.out";
 # test if the -no-pie and -fno-pie flags are supported
 if( $compiler eq "clang" || $os =~ /Darwin/ ) {
-    $npflags = "-fno-pie";
+    $npflags = "-fno-PIE";
 }
 else  {
     $npflags = "-no-pie -fno-pie";

Gary J. Ferland

unread,
Nov 21, 2021, 10:31:59 PM11/21/21
to cloud...@googlegroups.com
i wonder if they became case-sensitive?

Marios Chatzikos

unread,
Nov 21, 2021, 10:39:52 PM11/21/21
to cloud...@googlegroups.com

It looks like it.  The Perl script has the flag in lower case, referring probably to an earlier version.

Does it work?

If it does, we need to add logic to the script to discriminate the compiler version.

Gary J. Ferland

unread,
Nov 21, 2021, 10:41:57 PM11/21/21
to cloud...@googlegroups.com
I wonder if we need the flag?  it was ignored on current ubuntu with no detrimental effects

the guild did work fine

Marios Chatzikos

unread,
Nov 21, 2021, 10:48:05 PM11/21/21
to cloud...@googlegroups.com

I would think we do.  It amounts to the difference between building a static vs a dynamic library.  It is possible no-pie (static) is the default...

Gary J. Ferland

unread,
Nov 21, 2021, 10:55:12 PM11/21/21
to cloud...@googlegroups.com
how do we check this?  see if one of the codes in tsuite / programs can link?

Marios Chatzikos

unread,
Nov 21, 2021, 10:59:16 PM11/21/21
to cloud...@googlegroups.com

Compilation ought to do this, so we know it works.  That said, it might be better to be explicit than go with the default.

The flag is there for a reason.  I'd look into compiler versions.

Gary J. Ferland

unread,
Nov 21, 2021, 11:00:41 PM11/21/21
to cloud...@googlegroups.com
this history of the flag must be in svn.  it might have a useful log message

Marios Chatzikos

unread,
Nov 21, 2021, 11:34:00 PM11/21/21
to cloud...@googlegroups.com

The main ones I could find -- other commits were probably on the backtrace branch.  Not terribly helpful, but still.

$ svn log -r 12423
------------------------------------------------------------------------
r12423 | peter | 2018-11-27 17:50:21 -0500 (Tue, 27 Nov 2018) | 5 lines

source/Makefile:
source/capabilities.pl:
  - Improve code for disabling position independent executables. The -no-pie flag
    is only supported from g++ 6 onwards, so do not break older compilers.

$ svn log -r 12453
------------------------------------------------------------------------
r12453 | peter | 2018-12-09 18:24:21 -0500 (Sun, 09 Dec 2018) | 12 lines

This is the second merge from the backtrace branch. It implements "fixing"
missing or empty save files from a certain grid point (due to a crash of some
sort) by creating a stub version of the file from another successful grid
point. This is done by replacing all digits from the successful file with
zeroes.

Support for backtraces is improved on Macs. In the case of an FP exception or
segfault, the address of the location where the signal was generated is now
correctly substituted in the call stack. The Homebrew g++ compiler will now
produce a correct backtrace in debug mode (but still nothing in optimized
mode).

Marios Chatzikos

unread,
Nov 22, 2021, 10:11:08 AM11/22/21
to cloud...@googlegroups.com

Actually, the simplest thing to do might be to just add the capitalized string, instead of going down the compiler version road.  The Makefile needs to be adjusted, too.

$ git diff capabilities.pl Makefile
diff --git a/source/Makefile b/source/Makefile
index 237da7d..96bc9e2 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -57,7 +57,7 @@ CAPABILITIES := $(shell $(SRCDIR)/capabilities.pl $(CXX))
 PRECOMPILE := $(filter precompile,$(CAPABILITIES))
 VECTORIZE := $(filter vectorize,$(CAPABILITIES))
 NOPIE := $(filter -no-pie,$(CAPABILITIES))
-FNOPIE := $(filter -fno-pie,$(CAPABILITIES))
+FNOPIE := $(filter -fno-pie -fno-PIE,$(CAPABILITIES))
 NATIVE := $(filter native,$(CAPABILITIES))
 DYNAMIC := $(filter dynamic,$(CAPABILITIES))
 DEMANGLE := $(filter demangle%,$(CAPABILITIES))
diff --git a/source/capabilities.pl b/source/capabilities.pl
index 499a5ff..d15afb0 100755


--- a/source/capabilities.pl
+++ b/source/capabilities.pl
@@ -62,7 +62,7 @@ if( "$^O" ne "cygwin" ) {
 unlink "tmp_cloudyconfig.out";
 # test if the -no-pie and -fno-pie flags are supported
 if( $compiler eq "clang" || $os =~ /Darwin/ ) {
-    $npflags = "-fno-pie";

+    $npflags = "-fno-pie -fno-PIE";


 }
 else  {
     $npflags = "-no-pie -fno-pie";

This did not generate warnings for me with clang on my very old Mac.  Give it a shot?

Gary J. Ferland

unread,
Nov 22, 2021, 10:48:13 AM11/22/21
to cloud...@googlegroups.com
could you please post the changed files and I will give them a try.

Marios Chatzikos

unread,
Nov 22, 2021, 1:03:13 PM11/22/21
to cloud...@googlegroups.com
Makefile
capabilities.pl

Gary Ferland

unread,
Dec 28, 2021, 9:46:41 PM12/28/21
to cloudy-dev
with the update to macos 12.1 there are now no warnings with the the command line tools llvm or gcc 10. 
Reply all
Reply to author
Forward
0 new messages