Coder Social home page Coder Social logo

Comments (7)

markus-metzger avatar markus-metzger commented on June 12, 2024

It shouldn't generate any archive with BUILD_SHARED_LIBS=ON. And it shouldn't generate any archive on Windows, at all. I'm using

set_target_properties(libipt PROPERTIES
  PREFIX ""
  PUBLIC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/include/intel-pt.h
  VERSION   ${PT_VERSION}
  SOVERSION ${PT_VERSION_MAJOR}
)

to remove the standard lib prefix and I call the library libipt so it comes out the same way on Linux and Windows.

It works fine in my standard environment:

W:\ipt\bugs\issue-99>cmake -G Ninja -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=install w:/ipt/git
-- The C compiler identification is MSVC 19.35.32215.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found UnixCommands: C:/Program Files/Git/usr/bin/bash.exe
-- Configuring done
-- Generating done
-- Build files have been written to: W:/ipt/bugs/issue-99

W:\ipt\bugs\issue-99>cmake --build .
[27/27] Linking C shared library bin\libipt.dll

W:\ipt\bugs\issue-99>cmake --install .
-- Install configuration: "Debug"
-- Installing: W:/ipt/bugs/issue-99/install/lib/libipt.lib
-- Installing: W:/ipt/bugs/issue-99/install/bin/libipt.dll
-- Installing: W:/ipt/bugs/issue-99/install/include/intel-pt.h

And with BUILD_SHARED_LIBS=OFF I get the expected Windows .lib.

W:\ipt\bugs\issue-99>cmake -G Ninja -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=install w:/ipt/git
-- The C compiler identification is MSVC 19.35.32215.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found UnixCommands: C:/Program Files/Git/usr/bin/bash.exe
-- Configuring done
-- Generating done
-- Build files have been written to: W:/ipt/bugs/issue-99

W:\ipt\bugs\issue-99>cmake --build .
[27/27] Linking C static library lib\libipt.lib

W:\ipt\bugs\issue-99>cmake --install .
-- Install configuration: "Debug"
-- Installing: W:/ipt/bugs/issue-99/install/lib/libipt.lib
-- Installing: W:/ipt/bugs/issue-99/install/include/intel-pt.h

Something must confuse cmake in your environment. It uses .dll and .lib suffixes so it should know that it is building for Windows. But then, it tries to create an archive (or just uses the .a suffix) and it ignores the PREFIX "" target property. Since we end up with liblibipt.dll.a it seems to mix Windows and Linux naming conventions.

It almost looks like the lib and .a were added later on to the name constructed by the libipt cmakefiles.

from libipt.

lazka avatar lazka commented on June 12, 2024

.dll.a is an import library and not an archive in case of non-msvc compilers.

Setting IMPORT_PREFIX "" seems to work here for me. Removing PREFIX "" and setting OUTPUT_NAME "ipt" also works here.
I don't know how that later affects builds/naming with other compilers and other platforms though.

from libipt.

markus-metzger avatar markus-metzger commented on June 12, 2024

Removing PREFIX "" and setting OUTPUT_NAME "ipt" results in ipt.dll when building with MSVC. Setting IMPORT_PREFIX "" seems to work.

from libipt.

markus-metzger avatar markus-metzger commented on June 12, 2024

@GitMensch can you confirm that setting IMPORT_PREFIX "" fixes the issue?

from libipt.

GitMensch avatar GitMensch commented on June 12, 2024

from libipt.

GitMensch avatar GitMensch commented on June 12, 2024

See https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-libipt/001-fix-import-lib-naming.patch (and yes, dropping the need for that patch would be very good).

from libipt.

GitMensch avatar GitMensch commented on June 12, 2024

Thanks, I'll update the MSYS2 build to the new release and drop the not needed patch there.

To be usable for my primary interest GDB will need adjustments, but at least people can use libipt on this environment now.

from libipt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.