>

mingw 크로스 컴파일러와 함께 cmake를 사용하여 데비안에서 * .deb 파일을 만들려고합니다. dpkg-buildpackage 를 사용할 때 CMake의 컴파일러 테스트가 실패합니다 .

정상적으로 빌드하는 것이 좋습니다 :

mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr 
         -DCMAKE_VERBOSE_MAKEFILE=ON 
         -DCMAKE_BUILD_TYPE=None 
         -DCMAKE_INSTALL_SYSCONFDIR=/etc 
         -DCMAKE_INSTALL_LOCALSTATEDIR=/var
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /etc/alternatives/i686-w64-mingw32-gcc
-- Check for working C compiler: /etc/alternatives/i686-w64-mingw32-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /etc/alternatives/i686-w64-mingw32-g++
-- Check for working CXX compiler: /etc/alternatives/i686-w64-mingw32-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done

그러나 pyzwyz를 사용하여 이것을 빌드 할 때  구성하지 못했습니다 :

dpkg-buildpackage

전체 로그에서 흥미로운 부분은 다음과 같은 링크 중 실패입니다.

dpkg-buildpackage -uc -us
dpkg-buildpackage: info: source package foo
dpkg-buildpackage: info: source version 1.0
dpkg-buildpackage: info: source distribution stretch
dpkg-buildpackage: info: source changed by $USER
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build hw
 fakeroot debian/rules clean
dh clean --buildsystem=cmake --parallel 
   dh_testdir -O--buildsystem=cmake -O--parallel
   dh_auto_clean -O--buildsystem=cmake -O--parallel
   dh_clean -O--buildsystem=cmake -O--parallel
 dpkg-source -b hw
dpkg-source: info: using source format '3.0 (native)'
dpkg-source: info: building sim-honeywell-ease-control in sim-honeywell-ease-control_1.0.tar.xz
dpkg-source: info: building sim-honeywell-ease-control in sim-honeywell-ease-control_1.0.dsc
 debian/rules build
make: 'build' is up to date.
 fakeroot debian/rules binary
dh binary --buildsystem=cmake --parallel 
   dh_testdir -O--buildsystem=cmake -O--parallel
   dh_update_autotools_config -O--buildsystem=cmake -O--parallel
   dh_auto_configure -O--buildsystem=cmake -O--parallel
    cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /etc/alternatives/i686-w64-mingw32-gcc
-- Check for working C compiler: /etc/alternatives/i686-w64-mingw32-gcc -- broken
CMake Error at /usr/share/cmake-3.7/Modules/CMakeTestCCompiler.cmake:51 (message):
  The C compiler "/etc/alternatives/i686-w64-mingw32-gcc" is not able to
  compile a simple test program.

mingw 링커가 /etc/alternatives/i686-w64-mingw32-gcc -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wl,--whole-archive CMakeFiles/cmTC_fc912.dir/objects.a -Wl,--no-whole-archive -o cmTC_fc912.exe -Wl,--out-implib,libcmTC_fc912.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles/cmTC_fc912.dir/linklibs.rsp /usr/bin/i686-w64-mingw32-ld: unrecognized option '-z' 를 인식하지 못합니다  선택권. 내가 -z 때  CMakeCache.txt에서 dpkg-buildpakcage가 기본적으로 링커 플래그를 추가한다는 것을 알 수 있습니다.

diff

< CMAKE_EXE_LINKER_FLAGS:STRING=-Wl,-z,relro --- > CMAKE_EXE_LINKER_FLAGS:STRING= 를 예방하는 방법  이걸로?

FYI : 내 dpkg-buildpackage  파일은 다음과 같습니다 :

debian/rules

#!/usr/bin/make -f %: dh [email protected] --buildsystem=cmake --parallel
  • 답변 # 1

    relro 를 비활성화해야합니다  강화 구성;당신의 debian/rules 를 변경  

    #!/usr/bin/make -f
    export DEB_BUILD_MAINT_OPTIONS = hardening=-relro
    %:
            dh [email protected] --buildsystem=cmake --parallel
    
    

    와이즈 비즈보기  자세한 내용은 맨 페이지를 참조하십시오.

    (제외로, 당신이 compat 레벨 10 이상을 사용한다면, dpkg-buildflags 가 필요 없습니다  기본적으로 사용 설정되어 있기 때문에 많은 경우에 --parallel 를 떨어 뜨릴 수 있습니다   --buildsystem=cmake 이후  자동 감지합니다.)

    dh

  • 이전 ubuntu - iptables 구성을 영구적으로 저장
  • 다음 Dualboot win10/Linux Mint boots directly into win10 - Dualboot win10/Linux Mint가 win10으로 직접 부팅됩니다애벌레를 표시하지 않습니다