Coder Social home page Coder Social logo

Linking Error Windows VS 2019 about ptex HOT 5 CLOSED

wdas avatar wdas commented on June 14, 2024
Linking Error Windows VS 2019

from ptex.

Comments (5)

davvid avatar davvid commented on June 14, 2024

Hi @jonassorgenfrei this seems like a symbol visibility issue to me.

I don't have a Windows machine to verify, so we'll need your help to track down the correct fix.

My understanding from the error message is that the linker does not see the half table symbols. My explanation for why that might be is that on Windows symbol visibility is hidden by default.

In PtexHalf.h try adding PTEXAPI on the line right above struct PtexHalf { (~line 87) and try rebuilding the ptex library. In theory that should make the PtexHalf symbols visible.

You may note that around line 160-121 some symbols (including the half tables members) were already marked visible, so it is kinda surprising that this is needed, but hopefully that's the root cause and fixes it.

Including PtexHalfTables.h is not advised -- those symbols are intended to be provided by the ptex library itself and you may later get errors about multiply-defined symbols if we went down that route.

Let me know whether adding the PTEXAPI visibility macro fixes this issue for you.

from ptex.

jonassorgenfrei avatar jonassorgenfrei commented on June 14, 2024

Hey @davvid,
I tried building it again with the PTEXAPI Marco above the PtexHalf struct.
Unfortunatley this didn't fix the problem.

I then accidentally rebuild the Ptex_static project and was able to build halftest afterwards.
I figured out that when building the static libraries and linking against them everything works like a charm,
But building the dynamic libraries seems to produces the problem, may be its just a problem with Windows or Visual Studio (2019 and -17) As if the content of the Ptex.dll couldn't be found.
Shall halftest link against the dynamic or the static libraries? They were build at the same location with the same name, overwritting each other.

from ptex.

davvid avatar davvid commented on June 14, 2024

Looking at the build scripts, it's setup to build either static or dynamic.

We default to the following:

    PTEX_BUILD_STATIC_LIBS=ON
    PTEX_BUILD_SHARED_LIBS=ON

For Windows, I suspect that building the static library will work better. Does it work if you tweak the default (defined in CMakeLists.txt) for PTEX_BUILD_SHARED_LIBS to OFF and rebuild from scratch?

If tweaking that default works then a patch to change the default for Windows might be a good idea.

BTW, I'm a little surprised that it built both and overwrote one. It's using an else if in src/tests/CMakeLists.txt so it should only consider one of the two variants. Nonetheless, hopefully tweaking that default should be sufficient. Let me know how that goes.

from ptex.

jonassorgenfrei avatar jonassorgenfrei commented on June 14, 2024

Yeah switching PTEX_BUILD_SHARED_LIBS to off worked perfectly.

Well I think building both comes from the src/ptex CMakeLists; there is no switch between Static and Shared and both have the same output name (line 22 and 35).
The CmakeLists in src/test seems to only link the already build static or shared library.

from ptex.

davvid avatar davvid commented on June 14, 2024

@jonassorgenfrei please test the windows-static-libs branch in my fork -- it should DTRT by default now. Let us know how that goes.

from ptex.

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.