Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: simark@simark.ca (Simon Marchi)
Subject: [lttng-dev] Babeltrace2 - compilation error with intel18
Date: Fri, 20 Mar 2020 23:12:33 -0400	[thread overview]
Message-ID: <4bc0ec69-7587-fe58-691f-5cb23a11cd43@simark.ca> (raw)
In-Reply-To: <CADtyBo44MW0=jBnrhh-aqfnrS8RtLAk9zbBZp3ktEhKACWPXdg@mail.gmail.com>

On 2020-03-20 6:32 p.m., Rocky Dunlap via lttng-dev wrote:
> Simon,
> 
> Thanks for this - so after I updated to gcc 9.2, the shared libraries command ran correctly and the build finished. All the tests pass and I was able to read in a CTF trace from a python script.??
> 
> The issue was that the system gcc was gcc 4.X.X, so too old.? So, I had to manually add the newer gcc to the path alongside the intel compiler.? I can try to option of setting LDSHARED, but at this point that seems even more confusing?than just using the system gcc, which apparently has no trouble linking intel object files into a shared library.? Maybe there are good reasons why this is the case and this is why distutils does not use the right compiler?

Glad you got it working.

> Ideally the build would just "work" with ./configure, make, make install since these kinds of compilation issues can quickly get over people's heads and cause them to abandon the library altogether.? I wonder if there is a way for the configure/make to set the LDSHARED automatically?so that is is transparent to the user.? Certainly we are not the first to run into this issue with distutils.

I don't know if there's a good reason for them not to use $CC
for linking.  What's funny is that on Darwin/macOS they do it:

https://github.com/python/cpython/blob/6723e933c4d90a408cf3818362a0e4de6d84c932/Lib/distutils/sysconfig.py#L201-L209

Note that I don't know if Intel's Python distribution is using the
same distutils package as CPython.  But since you hit the same bug,
it must be quite close, if not the same.

There's a bug here about re-using CC for LDSHARED on Linux:

  https://bugs.python.org/issue24935

There are patches here

  https://github.com/python/cpython/pull/14950
  https://github.com/python/cpython/pull/7914

There wasn't much progress, but at least nobody spoke against them.

But even with that fixed there are other problems.  As I mentioned in my
previous message, in some cases, the CFLAGS value built into Python (which
means there's no easy way for us to override it) contains some flags
incompatible with clang (this could happen with icc too).  When trying to
build with CC=clang-9 on Arch Linux, I get:

ccache clang ... -fno-semantic-interposition ... -c bt2/native_bt.c -o build/temp.linux-x86_64-3.8/bt2/native_bt.o
clang-9: error: unknown argument: '-fno-semantic-interposition'

Arch Linux got this idea of building with `-fno-semantic-interposition` from Fedora:

  https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup

So I guess we will face the same issue on Red Hat by the end of the decade.

So since distutils really wants to compile the Python native modules using all the same
flags as the Python interpreter was built with, I presume that they really assume that
you'll be using the exact same toolchain to build your module as was used to build the
interpreter.  Maybe we could just not pass CC/CFLAGS when building the Python module,
so it will simply be built with the same compiler/linker as Python was built with, and
we'll avoid all these problems...

Simon


  reply	other threads:[~2020-03-21  3:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 21:10 Rocky Dunlap
2020-03-20 21:47 ` Simon Marchi
2020-03-20 21:55   ` Rocky Dunlap
2020-03-20 22:20     ` Simon Marchi
2020-03-20 22:32       ` Rocky Dunlap
2020-03-21  3:12         ` Simon Marchi [this message]
2020-03-23 15:44           ` Simon Marchi
2020-03-23 16:05             ` Rocky Dunlap
2020-03-23 16:14               ` Simon Marchi
2020-03-23 16:56                 ` Rocky Dunlap
2020-03-23 17:24                   ` Simon Marchi
2020-03-23 17:37                     ` Rocky Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4bc0ec69-7587-fe58-691f-5cb23a11cd43@simark.ca \
    --to=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox