Mamoru TASAKA wrote on 2022/09/05 8:40:
Bruno Postle wrote on 2022/09/04 17:44:
Can someone give me hint as to what I'm doing wrong here, I have a C++
package that builds fine for f35 & f36 with x86_64 & aarch64, but
which fails on f37-x86_64 (the build is ok on f37-aarch64):

https://copr.fedorainfracloud.org/coprs/bpostle/IfcOpenShell/build/4771106/

[  0%] Building CXX object
CMakeFiles/IfcParse.dir/builddir/build/BUILD/IfcOpenShell-0.7.0/src/ifcparse/IfcCharacterDecoder.cpp.o
/usr/bin/g++ -DBOOST_ALL_NO_LIB -DBOOST_DATE_TIME_DYN_LINK
-DBOOST_DATE_TIME_NO_LIB -DBOOST_IOSTREAMS_DYN_LINK
-DBOOST_IOSTREAMS_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK
-DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK
-DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB
-DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DHAS_SCHEMA_2x3
-DHAS_SCHEMA_4 -DHAS_SCHEMA_4x1 -DHAS_SCHEMA_4x2 -DHAS_SCHEMA_4x3
-DHAS_SCHEMA_4x3_rc1 -DHAS_SCHEMA_4x3_rc2 -DHAS_SCHEMA_4x3_rc3
-DHAS_SCHEMA_4x3_rc4 -DIFC_SHARED_BUILD -DIfcParse_EXPORTS
-DSCHEMA_SEQ="(2x3)(4)(4x1)(4x2)(4x3_rc1)(4x3_rc2)(4x3_rc3)(4x3_rc4)(4x3)"
-DUSE_MMAP -DWITH_GLTF -DWITH_HDF5 -DWITH_IFCXML -DWITH_OPENCOLLADA
-I/usr/include/opencascade -I/usr/include/COLLADABaseUtils
-I/usr/include/COLLADAStreamWriter -I/usr/include/libxml2 -isystem
/usr/include -lxml2 -DNDEBUG -O3 -fPIC   -Wall -Wextra
-Wno-maybe-uninitialized -Wno-deprecated-copy -fPIC
-DIFC_PARSE_EXPORTS -std=gnu++14 -MD -MT
CMakeFiles/IfcParse.dir/builddir/build/BUILD/IfcOpenShell-0.7.0/src/ifcparse/IfcCharacterDecoder.cpp.o
-MF 
CMakeFiles/IfcParse.dir/builddir/build/BUILD/IfcOpenShell-0.7.0/src/ifcparse/IfcCharacterDecoder.cpp.o.d
-o 
CMakeFiles/IfcParse.dir/builddir/build/BUILD/IfcOpenShell-0.7.0/src/ifcparse/IfcCharacterDecoder.cpp.o
-c /builddir/build/BUILD/IfcOpenShell-0.7.0/src/ifcparse/IfcCharacterDecoder.cpp
In file included from /usr/include/c++/12/ext/string_conversions.h:41,
                  from /usr/include/c++/12/bits/basic_string.h:3960,
                  from /usr/include/c++/12/string:53,
                  from
/builddir/build/BUILD/IfcOpenShell-0.7.0/src/ifcparse/IfcCharacterDecoder.cpp:27:
/usr/include/c++/12/cstdlib:75:15: fatal error: stdlib.h: No such file
or directory
    75 | #include_next <stdlib.h>
       |               ^~~~~~~~~~



This command line contains "-isystem /usr/include", on other architectures this 
is not included,
this is the difference. But currently I cannot figure out where this "-isystem 
/usr/include" came from.


So now I managed to get build successful:
https://copr.fedorainfracloud.org/coprs/mtasaka/IfcOpenShell-test/build/4812428/

Short answer:
In your IfcOpenShell.spec on %cmake line, ```-DCMAKE_CXX_FLAGS=-lxml2``` is 
wrong.
At least this should be changed to ```-DCMAKE_CXX_FLAGS="-lxml2 
%build_cxxflags"``` or so.
( but actually "-lxml2" should not be written in CMAKE_CXX_FLAGS, because this 
is for
  "compilation" flag, not for "linkage" option ).

Some long story trying to explain:

First of all f36 buildroot uses cmake-3.22.2, while f37 buildroot uses 
cmake-3.24.1, so
cmake behavior can differ between f36 and f37.

Then looking at build-live.log.gz, on aarch64:
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done

, while on x86_64 (this is both f37 and f36):
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed

and looking at redhat-linux-build/CMakeFiles/CMakeError.log (on x86_64), it 
says:
====================================================================
      1 Detecting CXX compiler ABI info failed to compile with the following 
output:
      6 Building CXX object CMakeFiles/cmTC_ce4df.dir/CMakeCXXCompilerABI.cpp.o
      7 /usr/bin/g++   -lxml2    -v -o 
CMakeFiles/cmTC_ce4df.dir/CMakeCXXCompilerABI.cpp.o -c 
/usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp
     45 Linking CXX executable cmTC_ce4df
     46 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ce4df.dir/link.txt 
--verbose=1
     47 /usr/bin/g++ -lxml2  -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now 
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld 
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 
-specs=/usr/lib/rpm/redhat/redhat-package-notes -v -rdynamic 
CMakeFiles/cmTC_ce4df.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_ce4df
     65 /usr/bin/ld: CMakeFiles/cmTC_ce4df.dir/CMakeCXXCompilerABI.cpp.o: 
relocation R_X86_64_32S against `.rodata' can not be used when making a PIE 
object; recompile with -fPIE
     66 /usr/bin/ld: failed to set dynamic section sizes: bad value
     67 collect2: error: ld returned 1 exit status
====================================================================
So here on linkage "-spec=/usr/lib/rpm/redhat/redhat-hardened-ld" is specified 
which uses -pie, while on compilation
the "correspoinding" option (-fpie or so, which is usually passed with 
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1) is not
passed, because IfcOpenShell.spec says "-DCMAKE_CXX_FLAGS=-lxml2" which 
overrides Fedora %build_cxxflags ,
and on x86_64 this causes relocation error (on aarch64 it seems to not cause 
error, by chance?).

When changing to ```-DCMAKE_CXX_FLAGS="-lxml2 %build_cxxflags"```, this 
succeeds and then
====================================================================
    317 Detecting CXX compiler ABI info compiled with the following output:
    323 /usr/bin/g++   -lxml2 -O2 -flto=auto -ffat-lto-objects -fexceptions -g 
-grecord-gcc-switches -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 
-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 
-fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  
-mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection 
-fcf-protection    -v -o CMakeFiles/cmTC_63c6b.dir/CMakeCXXCompilerABI.cpp.o -c 
/usr/share/cmake/Modules/CMakeCXXCompilerABI.cpp
    366 Linking CXX executable cmTC_63c6b
    367 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_63c6b.dir/link.txt 
--verbose=1
    368 /usr/bin/g++ -lxml2 -O2 -flto=auto -ffat-lto-objects -fexceptions -g 
-grecord-gcc-switches -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 
-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 
-fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  
-mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection 
-fcf-protection  -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now 
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld 
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 
-specs=/usr/lib/rpm/redhat/redhat-package-notes -v -rdynamic 
CMakeFiles/cmTC_63c6b.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_63c6b
    463 Parsed CXX implicit include dir info from above output: rv=done
    464   found start of include info
    465   found start of implicit include info
    466     add: 
[/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12]
    467     add: 
[/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/x86_64-redhat-linux]
    468     add: 
[/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/backward]
    469     add: [/usr/lib/gcc/x86_64-redhat-linux/12/include]
    470     add: [/usr/local/include]
    471     add: [/usr/include]
    472   end of search list found
====================================================================

So on successful "Detecting CXX compiler ABI info", cmake detects "implicit include 
directories".
And, from here this is my **guess**, that when cmake fails to detect implicit 
include directories,
cmake on f37 seems to add "-isystem /usr/include", perhaps.

P.S.
Changing to ```-DCMAKE_CXX_FLAGS="-lxml2 %build_cxxflags"``` makes total build 
time much longer -
perhaps because of -flto and -g . Now aarch64 build time gets 10 hours - as 
copr default timeout is
5 hours, you have to specify timeout option explicitly.


Regards,
Mamoru


_______________________________________________
devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to