On Tue, 17 Aug 2021, 11:35 Isuru Fernando, <isu...@gmail.com> wrote:

> Ah, you are using the system python that was built with gcc, but you want
> to build sage with clang/clang++.
>
> In python, setting CC will override the compiler used for building
> extension modules, but
> it will not override the linker used for building an extension module.
>
> What happens here is a file is compiled with `-fopenmp` with clang
> (meaning it needs to be linked with libomp from LLVM),
> but linked with `-fopenmp` with gcc (meaning it links to libgomp from GNU).
>
> To fix this, you'll have to set env variable LDSHARED="clang -pthread
> -shared"
>

Thanks, great catch - perhaps we should have this in docs or wiki.


> Isuru Fernando
>
> On Tue, Aug 17, 2021 at 1:52 PM Kazuyoshi Furutaka <
> furutaka.kazuyo...@gmail.com> wrote:
>
>>
>>
>> 2021年8月17日(火) 17:05 Isuru Fernando <isu...@gmail.com>:
>>
>>> Did you rebuild python? You might have to do "make distclean".
>>>
>>> Isuru
>>>
>>>
>> I believe I didn't.
>>
>> excerpt from the config.log...
>>
>>>
>>>    4360 ## -------------------------------------------------------- ##
>>>    4361 ## Checking whether SageMath should install SPKG python3... ##
>>>    4362 ## -------------------------------------------------------- ##
>>>    4363 configure:33651: checking whether any of bzip2 xz libffi is
>>> installed as or will be installed as SPKG
>>>    4364 configure:33660: result: no
>>>    4365 configure:33664: checking for python3 >= 3.7.0, < 3.10.0 with
>>> modules sqlite3, ctypes, math, hashlib, crypt, socket, zlib, distutils.core
>>>    4366 configure:34331: result:
>>>    4367 configure:34355: checking ... whether /usr/bin/python3 is good
>>>    4368 CC=clang CXX=clang++ -std=gnu++11 conftest_venv/bin/python3
>>> conftest.py --verbose build --build-base=conftest.dir
>>>    4369 running build
>>>    4370 running build_ext
>>>    4371 building 'config_check_distutils' extension
>>>    4372 creating conftest.dir
>>>    4373 creating conftest.dir/temp.linux-x86_64-3.9
>>>    4374 clang -Wno-unused-result -Wsign-compare
>>> -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g
>>> -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOU
>>>    4374 RCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64
>>> -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection
>>> -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O
>>>    4374 2 -fexceptions -g -grecord-gcc-switches -pipe -Wall
>>> -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
>>> -fstack-protector-strong -m64 -mtune=generic -fasyn
>>>    4374 chronous-unwind-tables -fstack-clash-protection -fcf-protection
>>> -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe
>>> -Wall -Werror=format-security -Wp,-D_
>>>    4374 FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
>>> -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables
>>> -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC
>>>    4374  -fwrapv -Dlinux -I/usr/include -fPIC
>>> -I/home/furutaka/work/sage/sage-9.4.rc2-git-clang2/conftest_venv/include
>>> -I/usr/include/python3.9 -c conftest.c -o conftest.dir/temp.linux-
>>>    4374 x86_64-3.9/conftest.o
>>>    4375 creating conftest.dir/lib.linux-x86_64-3.9
>>>    4376 gcc -pthread -shared -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -g
>>> -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -g -Dlinux -I/usr/include
>>> conftest.dir/temp.linux-x86_64-3.9/conftest.o -
>>>    4376 L/usr/lib64 -o conftest.dir/lib.linux-x86_64-3.9/
>>> config_check_distutils.cpython-39-x86_64-linux-gnu.so
>>>    4377 CC=clang CXX=clang++ -std=gnu++11 conftest_venv/bin/python3
>>> conftest.py --verbose build --build-base=conftest.dir
>>>    4378 running build
>>>    4379 running build_ext
>>>    4380 building 'config_check_distutils_cxx' extension
>>>    4381 creating conftest.dir
>>>    4382 creating conftest.dir/temp.linux-x86_64-3.9
>>>    4383 clang -Wno-unused-result -Wsign-compare
>>> -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g
>>> -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOU
>>>    4383 RCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64
>>> -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection
>>> -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O
>>>    4383 2 -fexceptions -g -grecord-gcc-switches -pipe -Wall
>>> -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
>>> -fstack-protector-strong -m64 -mtune=generic -fasyn
>>>    4383 chronous-unwind-tables -fstack-clash-protection -fcf-protection
>>> -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe
>>> -Wall -Werror=format-security -Wp,-D_
>>>    4383 FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
>>> -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables
>>> -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC
>>>    4383  -fwrapv -Dlinux -I/usr/include -fPIC
>>> -I/home/furutaka/work/sage/sage-9.4.rc2-git-clang2/conftest_venv/include
>>> -I/usr/include/python3.9 -c conftest.cpp -o conftest.dir/temp.linu
>>>    4383 x-x86_64-3.9/conftest.o -std=c++11
>>>    4384 creating conftest.dir/lib.linux-x86_64-3.9
>>>    4385 clang++ -pthread -shared -Wl,-z,relro -Wl,--as-needed -Wl,-z,now
>>> -g -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -g -Dlinux -I/usr/include
>>> conftest.dir/temp.linux-x86_64-3.9/conftest   4385 .o -L/usr/lib64 -o
>>> conftest.dir/lib.linux-x86_64-3.9/
>>> config_check_distutils_cxx.cpython-39-x86_64-linux-gnu.so
>>>    4386 configure:34909: result: yes
>>>    4387 configure:34911: checking for python3 >= 3.7.0, < 3.10.0 with
>>> modules sqlite3, ctypes, math, hashlib, crypt, socket, zlib, distutils.core
>>>    4388 configure:34977: result: /usr/bin/python3
>>>    4389 configure:34994: will use system package and not install SPKG
>>> python3
>>
>>
>> What I did was:
>>
>>    1. `git checkout -b <a_tagged_version>`
>>    2. rsync to a separate directory for building,
>>    3. `make configure`
>>    4. `CC=clang CXX=clang++ ./configure`
>>    5. `./config.status recheck && ./config.status`
>>    6. `script -c make make.log`
>>
>>
>> By the way I forgot to mention but it's on a linux running fedora-34
>> (x86_64).
>>
>> Kazuyoshi
>> --
>> Kazuyoshi Furutaka
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sage-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to sage-devel+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sage-devel/CANjERveCGS%2Bcqv9yBpDXsAatUw7qBUt3WU4JSqbUEvG2_d%2Bt-A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/sage-devel/CANjERveCGS%2Bcqv9yBpDXsAatUw7qBUt3WU4JSqbUEvG2_d%2Bt-A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/CA%2B01voMt4--cAM%2BUKSQaVz2GGPMb3w%3D_tfnY-pfdJ4AiNZmzQA%40mail.gmail.com
> <https://groups.google.com/d/msgid/sage-devel/CA%2B01voMt4--cAM%2BUKSQaVz2GGPMb3w%3D_tfnY-pfdJ4AiNZmzQA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAAWYfq2_ctWFZJVzG3cjYhW5arCM6j5qmCrrVRCmyKKF-m-Pyw%40mail.gmail.com.

Reply via email to