sw icon indicating copy to clipboard operation
sw copied to clipboard

set(SW_BUILD_SHARED_LIBS 1) is causing error

Open Moldoteck opened this issue 4 years ago • 8 comments

Describe the bug I am building an application with opencv libs. if i put set(SW_BUILD_SHARED_LIBS 0), everything compiles as expected if i put set(SW_BUILD_SHARED_LIBS 1), it gives the following error:


-- sw: processing dependencies
Exception in file D:/dev/cppan2/client2/src/sw/driver/module.cpp:120, function operator (): error in module (C:/Users/UserName/.sw/storage/tmp/cfg/172341/loc.sw.self.3735d6-0.0.25.dll): Exception in file D:/dev/primitives/src/filesystem/src/filesystem.cpp:568, function fopen_checked: Cannot open file: C:\Users\UserName\.sw\storage\pkg\05\cc\ed33\obj\bld\172151\bd\boostdesc_bgm_bi.i, mode = wb, errno = 13: Permission denied
sw command: C:/Program Files (x86)/sw/sw.exe -shared -platform x64 -compiler msvc-19.24 -d D:/work/project-Desktop_x86_windows_msvc2019_pe_64bit-Debug/.sw/cmake -config d,msr,rwdi,r integrate -cmake-deps D:/work/project-Desktop_x86_windows_msvc2019_pe_64bit-Debug/.sw/cmake/sw.txt -cmake-file-version 4
CMake Error at C:/Users/UserName/.sw/storage/etc/sw/static/SWConfig.cmake:232 (message):
  sw: non-zero exit code: 1
Call Stack (most recent call first):
  CMakeLists.txt:83 (sw_execute)

Expected behavior It should behave just like with static libs

To Reproduce Steps to reproduce the behavior:

set(SW_BUILD_SHARED_LIBS 1)
set(OPENCVCORE
    org.sw.demo.intel.opencv.core-4.2.0
)
set(OPENCVIMGPROC
    org.sw.demo.intel.opencv.imgproc
)
set(OPENCVDNN
    org.sw.demo.intel.opencv.dnn
)
set(OPENCVIMGCODECS
    org.sw.demo.intel.opencv.imgcodecs
)
set(OPENCVHIGHGUI
    org.sw.demo.intel.opencv.highgui
)
set(FREETYPE
    org.sw.demo.intel.opencv.contrib.freetype
)

find_package(SW REQUIRED)
sw_add_package(${OPENCVCORE})
sw_add_package(${OPENCVIMGPROC})
sw_add_package(${OPENCVDNN})
sw_add_package(${OPENCVIMGCODECS})
sw_add_package(${OPENCVHIGHGUI})
sw_add_package(${FREETYPE})
sw_execute()


add_library(lib1 ".....cpp ....h")
target_link_libraries (lib1 PUBLIC ${OPENCVCORE} ${OPENCVIMGPROC} ${FREETYPE} )
target_link_libraries (lib1 PUBLIC ${OPENCVIMGCODECS} SPDLogFramework)

Information:

  • sw.client.sw version 1.0.0
  • Windows 10 x64
  • msvc-19.24

Moldoteck avatar Aug 19 '20 10:08 Moldoteck

Try to remove any versions from there. You have org.sw.demo.intel.opencv.core-4.2.0 and some other libs without versions. Maybe sw takes old core 4.2.0 and all other libs from opencv 4.4.0. See versions: https://software-network.org/org.sw.demo.intel.opencv.core/versions

egorpugin avatar Aug 19 '20 11:08 egorpugin

You are right. This was the problem

Moldoteck avatar Aug 19 '20 12:08 Moldoteck

Also: Preprocessing/Compilation takes more time than expected (both of cases). It is stuck at sw: processing dependencies several minutes(2-3) for an i7-8750H 2.20GHz. Also it is stuck at sw: building dependencies several minutes(2-3) (linking). Is this a normal behavior?

Moldoteck avatar Aug 19 '20 12:08 Moldoteck

Do you see same numbers after re-running those commands?

egorpugin avatar Aug 19 '20 12:08 egorpugin

If just re-run, then no. But if i make a small change in one of my cmake files it will take long time again

Moldoteck avatar Aug 19 '20 12:08 Moldoteck

Ok, I'll check, don't close the ticket.

egorpugin avatar Aug 19 '20 12:08 egorpugin

Thank you

Moldoteck avatar Aug 19 '20 12:08 Moldoteck

The problem is that something may be changed between cmake calls. Like sw dependency was removed or something else, so I'm not sure how to handle this better and prefer to keep it as is for now.

egorpugin avatar Aug 19 '20 16:08 egorpugin