Code Monkey home page Code Monkey logo

Comments (10)

svigerske avatar svigerske commented on July 24, 2024 2

SCIP_EXPORT seems to get defined wrongly. It should be defined to __declspec(dllexport) when using MSVC, but somehow you get the GCC/clang variant __attribute__((__visibility__("default"))).

The place where SCIP_EXPORT gets defined depends a bit on your SCIP installation. You might want to look into that.

from scip.

svigerske avatar svigerske commented on July 24, 2024 1

You can try whether changing the content to

#ifndef SCIP_EXPORT
#define SCIP_EXPORT __declspec(dllimport)
#endif

works better, assuming your want to link to a SCIP DLL later.

from scip.

SanPen avatar SanPen commented on July 24, 2024

Hi!,

I see SCIP_EXPORT being exported in def.h

I'm including #include "scip/scip.h"

¿Do you have an idea of what can be going on?

As far as I know I have not messed with SCIP_EXPORT.

from scip.

svigerske avatar svigerske commented on July 24, 2024

It gets defined in def.h if it hasn't been defined already. Maybe you could just look at the code after the C preprocessor has been running (there should be some flag for MSVC to output this; it's -E with gcc). That should show more clearly where SCIP_EXPORT gets defined to which value.

My guess is that you have an installation of SCIP that was build via cmake on Linux. In the case, there is a scip/scip_export.h somewhere which defines SCIP_EXPORT to be __attribute__((visibility("default"))), which will not work with MS compilers. But there is not enough information given here to say for sure what is happening.

from scip.

SanPen avatar SanPen commented on July 24, 2024

Indeed I have the file scip/scip_export.h.

So this file should not be there for windows?

THe content of the file is:


#ifndef SCIP_EXPORT_H
#define SCIP_EXPORT_H

#ifdef SCIP_STATIC_DEFINE
#  define SCIP_EXPORT
#  define SCIP_NO_EXPORT
#else
#  ifndef SCIP_EXPORT
#    ifdef libscip_EXPORTS
        /* We are building this library */
#      define SCIP_EXPORT __attribute__((visibility("default")))
#    else
        /* We are using this library */
#      define SCIP_EXPORT __attribute__((visibility("default")))
#    endif
#  endif

#  ifndef SCIP_NO_EXPORT
#    define SCIP_NO_EXPORT __attribute__((visibility("hidden")))
#  endif
#endif

#ifndef SCIP_DEPRECATED
#  define SCIP_DEPRECATED __attribute__ ((__deprecated__))
#endif

#ifndef SCIP_DEPRECATED_EXPORT
#  define SCIP_DEPRECATED_EXPORT SCIP_EXPORT SCIP_DEPRECATED
#endif

#ifndef SCIP_DEPRECATED_NO_EXPORT
#  define SCIP_DEPRECATED_NO_EXPORT SCIP_NO_EXPORT SCIP_DEPRECATED
#endif

#if 0 /* DEFINE_NO_DEPRECATED */
#  ifndef SCIP_NO_DEPRECATED
#    define SCIP_NO_DEPRECATED
#  endif
#endif

#endif /* SCIP_EXPORT_H */

Do you believe that it is ok to modify this to handle the OS config?

from scip.

SanPen avatar SanPen commented on July 24, 2024

That gets fixed, but I get the same issue with SCIP_DEPRECATED.

What should be the windows version for that one?

Thanks

from scip.

SanPen avatar SanPen commented on July 24, 2024

Well this is scip_export.hnow:


#ifndef SCIP_EXPORT_H
#define SCIP_EXPORT_H

#ifdef SCIP_STATIC_DEFINE
//#  define SCIP_EXPORT

#       if defined(_WIN32) || defined(_WIN64)
#           define SCIP_EXPORT __declspec(dllexport)
#       elif defined(__APPLE__) || defined(LINUX) || defined(linux)
#           define SCIP_EXPORT __attribute__((visibility("default")))
#       endif

#  define SCIP_NO_EXPORT
#else
#  ifndef SCIP_EXPORT
#    ifdef libscip_EXPORTS
        /* We are building this library */
#       if defined(_WIN32) || defined(_WIN64)
#           define SCIP_EXPORT __declspec(dllexport)
#       elif defined(__APPLE__) || defined(LINUX) || defined(linux)
#           define SCIP_EXPORT __attribute__((visibility("default")))
#       endif
#    else
        /* We are using this library */

#       if defined(_WIN32) || defined(_WIN64)
#           define SCIP_EXPORT __declspec(dllexport)
#       elif defined(__APPLE__) || defined(LINUX) || defined(linux)
#           define SCIP_EXPORT __attribute__((visibility("default")))
#       endif

#    endif
#  endif

#ifndef SCIP_EXPORT
#   if defined(_WIN32) || defined(_WIN64)
#      define SCIP_EXPORT __declspec(dllimport)
#   elif defined(__APPLE__) || defined(LINUX) || defined(linux)
#      define SCIP_EXPORT __attribute__((visibility("default")))
#   endif
#endif

#  ifndef SCIP_NO_EXPORT
#    define SCIP_NO_EXPORT __attribute__((visibility("hidden")))
#  endif
#endif

#ifndef SCIP_DEPRECATED
#   if defined(_WIN32) || defined(_WIN64)
#      define SCIP_DEPRECATED __declspec(deprecated)
#   elif defined(__APPLE__) || defined(LINUX) || defined(linux)
#      define SCIP_DEPRECATED __attribute__ ((__deprecated__))
#   endif
#endif

#ifndef SCIP_DEPRECATED_EXPORT
#  define SCIP_DEPRECATED_EXPORT SCIP_EXPORT SCIP_DEPRECATED
#endif

#ifndef SCIP_DEPRECATED_NO_EXPORT
#  define SCIP_DEPRECATED_NO_EXPORT SCIP_NO_EXPORT SCIP_DEPRECATED
#endif

#if 0 /* DEFINE_NO_DEPRECATED */
#  ifndef SCIP_NO_DEPRECATED
#    define SCIP_NO_DEPRECATED
#  endif
#endif

#endif /* SCIP_EXPORT_H */

It works as horrific it may be...

from scip.

matbesancon avatar matbesancon commented on July 24, 2024

@svigerske is that a change we should also do upstream?

from scip.

svigerske avatar svigerske commented on July 24, 2024

No, this looks like a user doing something wrong, but not telling enough to find the source of the problem. I gave my guess and instructions to investigate, but that seemed to have been ignored. Since the user found a workaround, this can be closed.

The scip_export.h is autogenerated during the build if using cmake. So you won't need one that works for both worlds (MSVC and GCC). Also, the scip_export.h in https://www.scipopt.org/download.php?fname=SCIPOptSuite-8.0.4-win64-VS15.exe looks correct:

#ifndef SCIP_EXPORT_H
#define SCIP_EXPORT_H

#ifdef SCIP_STATIC_DEFINE
#  define SCIP_EXPORT
#  define SCIP_NO_EXPORT
#else
#  ifndef SCIP_EXPORT
#    ifdef libscip_EXPORTS
        /* We are building this library */
#      define SCIP_EXPORT __declspec(dllexport)
#    else
        /* We are using this library */
#      define SCIP_EXPORT __declspec(dllimport)
#    endif
#  endif

#  ifndef SCIP_NO_EXPORT
#    define SCIP_NO_EXPORT 
#  endif
#endif

#ifndef SCIP_DEPRECATED
#  define SCIP_DEPRECATED __declspec(deprecated)
#endif

#ifndef SCIP_DEPRECATED_EXPORT
#  define SCIP_DEPRECATED_EXPORT SCIP_EXPORT SCIP_DEPRECATED
#endif

#ifndef SCIP_DEPRECATED_NO_EXPORT
#  define SCIP_DEPRECATED_NO_EXPORT SCIP_NO_EXPORT SCIP_DEPRECATED
#endif

#if 0 /* DEFINE_NO_DEPRECATED */
#  ifndef SCIP_NO_DEPRECATED
#    define SCIP_NO_DEPRECATED
#  endif
#endif

#endif /* SCIP_EXPORT_H */

(MSVC-style __declspec instead of GCC-style __attribute__)

from scip.

SanPen avatar SanPen commented on July 24, 2024

Just to provide a bit of context.

What I am doing is to copy the headers in a folder called ThridParty/solvers/scip/8.0.3 because later I dynamically search and load the .dll/.so file. This is being done with other libraries with zero issues.

Why?

Because I want to be able to compile binaries with all the functionality without having to rely on the machine. I know a common practice is to use cmake to download the dependencies. But that has not worked great in the past and I need to provide a compilable source code to several environments with minimal dependencies (cmake, gcc/msvc and that's it)

I see from the comments, that what I should have is two sets of scip header; one for windows and one for unix. I really believe this is overkill, given that the only difference is a file.

Just my 2 cents.

from scip.

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.