Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install ruby-minisat gem locally on OS X #2

Closed
alvinkatojr opened this issue Aug 27, 2015 · 12 comments
Closed

Can't install ruby-minisat gem locally on OS X #2

alvinkatojr opened this issue Aug 27, 2015 · 12 comments

Comments

@alvinkatojr
Copy link

I get the following error when trying to install the gem. The error points to the Solver.h file. Where am I missing it?
screen shot 2015-08-27 at 11 31 16 pm

@alvinkatojr alvinkatojr changed the title Can't install gem locally Can't install ruby-minisat gem locally on OS X Aug 27, 2015
@nurettin
Copy link

I can't install, either.

$ brew install gcc
$ brew install minisat # no errors until here
$ gem install ruby-minisat --no-ri --no-rdoc -V

checking for main() in -lminisat... no
checking for main() in -lstdc++... yes

Doesn't find installed minisat for some reason.

@mame
Copy link
Owner

mame commented Aug 29, 2015

Thank you for the report.

@alvinkatojr

Looks minisat's unfixed issue. Please use gcc instead of clang.

@nurettin

Did it really fail? -lminisat... no is not a bug itself.
The homebrew formula of minisat seems to install only the executable of minisat, but not library and header files. So it is not surprising that ruby-minisat cannot find the library.
For such a case, the source code of minisat is bundled. When ruby-minisat cannot find the system-installed library, it will attempt to compile and use the bundled one.

@alvinkatojr
Copy link
Author

Hi @mame unfortunately I still get the same error even after installing and using gcc. Is there something am missing or not reading correctly?

@mame
Copy link
Owner

mame commented Aug 29, 2015

I'm not famliar with os x, but If you got exactly the same error, you are using clang. The style of error log is clang's, not gcc's.

On my Ubuntu box, g++ succeeded to compile minisat as follows:

$ g++ --version
g++ (Ubuntu 4.9.2-10ubuntu13) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ -I.. -c Solver.cc   

and clang failed the same way as you.

$ clang --version
Ubuntu clang version 3.6.0-2ubuntu1 (tags/RELEASE_360/final) (based on LLVM 3.6.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

$ clang -I.. -c Solver.cc     
In file included from Solver.cc:23:
In file included from ../mtl/Sort.h:24:
../mtl/Vec.h:99:97: warning: '&&' within '||' [-Wlogical-op-parentheses]                                                                                                  
    if (add > INT_MAX - cap || ((data = (T*)::realloc(data, (cap += add) * sizeof(T))) == NULL) && errno == ENOMEM)                                                       
                            ~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~                                                        
../mtl/Vec.h:99:97: note: place parentheses around the '&&' expression to silence this warning                                                                            
    if (add > INT_MAX - cap || ((data = (T*)::realloc(data, (cap += add) * sizeof(T))) == NULL) && errno == ENOMEM)                                                       
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~                                                        
In file included from Solver.cc:24:                                                                                                                                       
In file included from ../core/Solver.h:27:                                                                                                                                
../utils/Options.h:63:44: warning: '&&' within '||' [-Wlogical-op-parentheses]
            return test1 < 0 || test1 == 0 && strcmp(x->type_name, y->type_name) < 0;
                             ~~ ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../utils/Options.h:63:44: note: place parentheses around the '&&' expression to silence this warning
            return test1 < 0 || test1 == 0 && strcmp(x->type_name, y->type_name) < 0;
                                           ^
                                (                                                   )
In file included from Solver.cc:24:
In file included from ../core/Solver.h:28:
../core/SolverTypes.h:50:16: error: friend declaration specifying a default argument must be a definition
    friend Lit mkLit(Var var, bool sign = false);
               ^
../core/SolverTypes.h:58:14: error: friend declaration specifying a default argument must be the only declaration
inline  Lit  mkLit     (Var var, bool sign) { Lit p; p.x = var + var + (int)sign; return p; }
             ^
../core/SolverTypes.h:50:16: note: previous declaration is here
    friend Lit mkLit(Var var, bool sign = false);
               ^
Solver.cc:117:20: error: use of undeclared identifier 'mkLit'
    watches  .init(mkLit(v, false));
                   ^
Solver.cc:118:20: error: use of undeclared identifier 'mkLit'
    watches  .init(mkLit(v, true ));
                   ^
Solver.cc:212:57: warning: '&&' within '||' [-Wlogical-op-parentheses]
            if (phase_saving > 1 || (phase_saving == 1) && c > trail_lim.last())
                                 ~~ ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Solver.cc:212:57: note: place parentheses around the '&&' expression to silence this warning
            if (phase_saving > 1 || (phase_saving == 1) && c > trail_lim.last())
                                                        ^
                                    (                                          )
Solver.cc:243:44: error: use of undeclared identifier 'mkLit'
    return next == var_Undef ? lit_Undef : mkLit(next, rnd_pol ? drand(random_seed) < 0.5 : polarity[next]);
                                           ^
Solver.cc:660:36: warning: '&&' within '||' [-Wlogical-op-parentheses]
            if (nof_conflicts >= 0 && conflictC >= nof_conflicts || !withinBudget()){
                ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
Solver.cc:660:36: note: place parentheses around the '&&' expression to silence this warning
            if (nof_conflicts >= 0 && conflictC >= nof_conflicts || !withinBudget()){
                                   ^
                (                                               )
Solver.cc:884:21: error: use of undeclared identifier 'mkLit'
            Lit p = mkLit(v, s);
                    ^
4 warnings and 6 errors generated.

@alvinkatojr
Copy link
Author

I see. So is there a way to specify the compiling option for a ruby gem when doing a gem install? Looking up options and can't seem to find any sadly.

@mame
Copy link
Owner

mame commented Aug 29, 2015

ruby-minisat uses CONFIG["CXX"] of rbconfig.rb, which is the C++ compiler that was available when Ruby was built. Unfortunately there is no way to choose the compiler manually. I didn't expect it was needed.

So if you need ruby-minisat soon, please rebuild and reinstall ruby. I think ./configure CXX=g++ will work (but I didn't experience it). And then retry gem install ruby-minisat.

Now I think it would be good for ruby-minisat to have the way to specify the compiler. But sorry I have no time to fix it soon.

@alvinkatojr
Copy link
Author

Okay. Thanks for the pointers. I will look for a work around and if it fails then I will install ruby again and see if it works.

@RomanCPodolski
Copy link

+1 for fix

@mame
Copy link
Owner

mame commented Nov 3, 2015

This issue should be fixed in the upstream of minisat. I have no thought of patching the bundled source of minisat. All I can do is allow you to choose the C compiler.

@kylekyle
Copy link

This is still a problem on OS X.

@mame
Copy link
Owner

mame commented Oct 25, 2019

I've now released ruby-minisat 2.2.0.1 with #3 merged. I guess it builds on macOS. If not, let me know. Sorry for leaving this issue untouched.

@mame mame closed this as completed Oct 25, 2019
@alvinkatojr
Copy link
Author

Excellent, it works! Thank you for all your efforts in fixing and responding to this issue @mame. Highly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants