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

ast.hh present but not compiled OSX installation #53

Open
ben-phillips1 opened this issue Jan 11, 2021 · 24 comments
Open

ast.hh present but not compiled OSX installation #53

ben-phillips1 opened this issue Jan 11, 2021 · 24 comments
Assignees

Comments

@ben-phillips1
Copy link

ben-phillips1 commented Jan 11, 2021

Hi- I'm having trouble installing on OSX 10.15.7.

Running installation steps in R, concluding with

install.packages("rminizinc", configure.args="--with-mzn=/path/to/libminizinc --with-bin=/path/to/bin")

runs fine but doesn't point to a LIBMINIZINC_PATH, and returns "".

Attempting to install through terminal with:

SUDO R CMD INSTALL rminizinc_0.0.3.tar.gz --configure-args="--with-mzn=/Users/khcd317/Documents/Lib/libminizinc --with-bin=/Users/khcd317/Documents/Lib/libminizinc"

Returns this section which I think is responsible for the failed installation:

configure: Custom libminizinc path provided! checking /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh usability... no checking /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh presence... yes configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: present but cannot be compiled configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: check for missing prerequisite headers? configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: see the Autoconf documentation configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: section "Present But Cannot Be Compiled" configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: proceeding with the compiler's result checking for /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh... no configure: header file ast.hh not found at custom path! configure: Solver binaries are present but libminizinc is not present or built!

Looking in the source code, I was originally having trouble with the installation finding libmzn.a: this seems to be fixed by inserting

file=${with_mzn}/libmzn.a

at line 3748 in the configure file. This line is in the corresponding chunk of code above starting at 3711. Does this seem right- was it really an omission or am I misunderstanding?

Any ideas where I might be going wrong would be very much appreciated. Please let me know if you need any more details and thanks a lot for any help.

@acharaakshit
Copy link
Owner

acharaakshit commented Jan 11, 2021

Hi Ben,

Thanks for reporting the issue!

I am checking for ast.hh by using AC_CHECK_HEADER() in my configure.ac file which in turn creates an auto-generated configure script for me accordingly.

According to the Autoconf website:

Macro: AC_CHECK_HEADER (header-file, [action-if-found], [action-if-not-found], [includes])

If the system header file header-file is compilable, execute shell commands action-if-found, otherwise execute action-if-not-found. If you just want to define a symbol if the header file is available, consider using AC_CHECK_HEADERS instead.

includes is decoded to determine the appropriate include directives. If omitted or empty, configure will check for both header existence (with the preprocessor) and usability (with the compiler), using AC_INCLUDES_DEFAULT for the compile test. If there is a discrepancy between the results, a warning is issued to the user, and the compiler results are favored (see Present But Cannot Be Compiled). In general, favoring the compiler results means that a header will be treated as not found even though the file exists, because you did not provide enough prerequisites.

I think it can be resolved by the following solutions:

  1. In configure.ac adding the code chunk given below
                        header_file=${MZN_HEADER_PATH}/ast.hh
			if [test -e "$header_file"]; then
                            AC_SUBST([MZN_PATH], 50)
                        else
                            AC_MSG_NOTICE([header file ast.hh not found at custom path!])
                        fi

instead of the code given below (present between lines 73-74)

AC_CHECK_HEADER("${MZN_HEADER_PATH}/ast.hh",
                        [AC_SUBST([MZN_PATH], 50)], [AC_MSG_NOTICE([header file ast.hh not found at custom path!])])

might resolve the error. Please run autoreconf to get the auto-generated configure script from configure.ac and
then try to install.

  1. This solution is provided on autoconf website. Here we will not leave the 4th argument of AC_CHECK_HEADER empty.

You can put the code given below instead of the code on lines 73-74

AC_CHECK_HEADER("${MZN_HEADER_PATH}/ast.hh",
                        [AC_SUBST([MZN_PATH], 50)], [AC_MSG_NOTICE([header file ast.hh not found at custom path!])],
                        [[#ifdef HAVE_AST_HH
                          #include </path/to/ast.hh>
                          #endif]])

Please let me know the results you get (I would have tried these myself but unfortunately I don't have access to an OSX system).

LIBMINIZINC_PATH is empty in these scenarios:

  1. libmzn.a is present but ast.hh (the header files) is not.
  2. libmzn.a is not present even if ast.hh is present.
  3. both libmzn.a and ast.hh are absent.

Now, when you did install.packages(...) , the LIBMINIZINC_PATH was empty because of the same issue as it
was with the R CMD INSTALL.

file=${with_mzn}/libmzn.a was missing in my configure script. Apologies for the mistake, this will be fixed in the
next release.

Thanks again!

@acharaakshit acharaakshit self-assigned this Jan 11, 2021
@ben-phillips1
Copy link
Author

Hi Akshit- thanks so much for your quick response and explanation.

I have tried both solutions but am still having trouble- I get the same error message during installation with both approaches unfortunately:

configure: Custom libminizinc path provided! checking /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh usability... no checking /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh presence... yes configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: present but cannot be compiled configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: check for missing prerequisite headers? configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: see the Autoconf documentation configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: section "Present But Cannot Be Compiled" configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: proceeding with the compiler's result checking for /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh... no configure: header file ast.hh not found at custom path! configure: Solver binaries are present but libminizinc is not present or built!

Whilst autoreconf updates the configure file I suspect that there is an issue here-

autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal --force autoreconf: configure.ac: tracing autoreconf: configure.ac: not using Libtool autoreconf: running: /usr/local/Cellar/autoconf/2.69/bin/autoconf --force configure.ac:33: error: possibly undefined macro: AC_SUBST If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. configure.ac:45: error: possibly undefined macro: AS_IF configure.ac:47: error: possibly undefined macro: AC_MSG_NOTICE configure.ac:57: error: possibly undefined macro: AC_CHECK_HEADER autoreconf: /usr/local/Cellar/autoconf/2.69/bin/autoconf failed with exit status: 1

Do you have any thoughts about what might be going on here? I think that the packages should be up to date but happy to take any suggestions! Thanks again for your help.

@acharaakshit
Copy link
Owner

acharaakshit commented Jan 12, 2021

Thanks for trying them out!

The configure script might not have been updated correctly as you are getting the same error (that you got previously) for both the solutions but we are not even using the AC_CHECK_HEADER macro in the first approach.

We need to make sure that there are no errors while running autoreconf.

To remove the undefined macro errors, you can try to install pkgconfig : sudo port install pkgconfig (you can have a look at this similar question)

After installing pkgconfig, try autoreconf -i from the package root folder.

Please let me know if this resolves the issue for you.

Thanks!

@ben-phillips1
Copy link
Author

Thanks again- I think pkgconfig installs fine as follows:

~ % sudo port install pkgconfig Password: ---> Computing dependencies for pkgconfig The following dependencies will be installed: libiconv Continue? [Y/n]: y ---> Fetching archive for libiconv ---> Attempting to fetch libiconv-1.16_1.darwin_19.x86_64.tbz2 from https://lil.fr.packages.macports.org/libiconv ---> Attempting to fetch libiconv-1.16_1.darwin_19.x86_64.tbz2.rmd160 from https://lil.fr.packages.macports.org/libiconv ---> Installing libiconv @1.16_1 ---> Activating libiconv @1.16_1 ---> Cleaning libiconv ---> Fetching archive for pkgconfig ---> Attempting to fetch pkgconfig-0.29.2_0.darwin_19.x86_64.tbz2 from https://lil.fr.packages.macports.org/pkgconfig ---> Attempting to fetch pkgconfig-0.29.2_0.darwin_19.x86_64.tbz2.rmd160 from https://lil.fr.packages.macports.org/pkgconfig ---> Installing pkgconfig @0.29.2_0 ---> Activating pkgconfig @0.29.2_0 ---> Cleaning pkgconfig ---> Scanning binaries for linking errors ---> No broken files found. ---> No broken ports found.

But still produces the same error when running autoconf.

% sudo autoreconf -fi configure.ac:34: error: possibly undefined macro: AC_SUBST If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. configure.ac:46: error: possibly undefined macro: AS_IF configure.ac:48: error: possibly undefined macro: AC_MSG_NOTICE configure.ac:58: error: possibly undefined macro: AC_CHECK_HEADER autoreconf: /usr/local/Cellar/autoconf/2.69/bin/autoconf failed with exit status: 1

There is a suggestion in that SO thread about adding ACLOCAL_AMFLAGS = -I m4 to the toplevel makefile.am. Could there be an analogous solution here? Thanks.

Bw,
Ben

@acharaakshit
Copy link
Owner

acharaakshit commented Jan 12, 2021

I think I found the problem:

It is a syntax error made by me. Apologies!

Please see the edited first approach (I had put AC_SUBST([MZN_PATH], 50)] instead of AC_SUBST([MZN_PATH], 50]))

Please let me know if this works for you! Also did you get any positive results by trying the approach 2?

Thanks!

@ben-phillips1
Copy link
Author

ben-phillips1 commented Jan 14, 2021

Thanks for the response and sorry my slow reply.

The situation is now: autoreconf seems to work fine with second option but installing through command line returns:

configure: Custom libminizinc path provided! configure: libmzn.a not found at custom path! configure: Solver binaries are present but libminizinc is not present or built! configure: creating ./config.status config.status: creating inst/minizinc/solvers/gecode.msc config.status: creating inst/minizinc/solvers/chuffed.msc config.status: creating inst/minizinc/solvers/findmus.msc config.status: creating inst/minizinc/solvers/gecode-gist.msc config.status: creating inst/minizinc/solvers/globalizer.msc config.status: creating src/Makevars config.status: creating src/config.h

But option 2 is still not working reconf as follows:

% sudo autoreconf -vi autoreconf: Entering directory .' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal autoreconf: configure.ac: tracing autoreconf: configure.ac: not using Libtool autoreconf: running: /usr/local/Cellar/autoconf/2.69/bin/autoconf configure.ac:33: error: possibly undefined macro: AC_SUBST If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. configure.ac:45: error: possibly undefined macro: AS_IF configure.ac:47: error: possibly undefined macro: AC_MSG_NOTICE configure.ac:57: error: possibly undefined macro: AC_CHECK_HEADER autoreconf: /usr/local/Cellar/autoconf/2.69/bin/autoconf failed with exit status: 1

and installing through command line returns:

configure: Custom libminizinc path provided! configure: libmzn.a not found at custom path! configure: Solver binaries are present but libminizinc is not present or built! configure: creating ./config.status config.status: creating inst/minizinc/solvers/gecode.msc config.status: creating inst/minizinc/solvers/chuffed.msc config.status: creating inst/minizinc/solvers/findmus.msc config.status: creating inst/minizinc/solvers/gecode-gist.msc config.status: creating inst/minizinc/solvers/globalizer.msc config.status: creating src/Makevars config.status: creating src/config.h

In both cases I am adding:

file=${with_mzn}/libmzn.a

To the configure file following autoreconf.

I would add I have been having similar issues on my linux machine (Ubuntu 20.04.1- though not dedicated much time to sorting it out) so perhaps I am making a silly mistake in a step somewhere if this is usually working completely fine? Thanks very much for any further suggestions!

Cheers,
Ben

@acharaakshit
Copy link
Owner

acharaakshit commented Jan 14, 2021

Thanks and no worries!

The message : configure: libmzn.a not found at custom path! is shown when ${with_mzn}/libmzn.a doesn't exist. Could there be a mistake in providing the custom path with --with-mzn?

I didn't face any errors on my linux system for option 2. I have attached my configure.ac for both options (I couldn't attach .ac files so please rename the attached files to configure.ac). Also you don't need to add file=${with_mzn}/libmzn.a to configure now as I have added it in the attached files. Please let me know if its not working for you.

It would be great if you can open an issue about the problems you are facing with Ubuntu. You can also drop me a mail if you think that there is a mistake from your end or if you need any other help with the package. I will be happy to help you out.

Please understand that the package has been recently published and is yet to be used by significant number of users.

Thanks again!

configure_option_1.txt
configure_option_2.txt

@ben-phillips1
Copy link
Author

Thanks for the config files- I think there is some progress with the second option- now after rebuilding and autoreconf, then attempting installation, we get this:

configure: Custom libminizinc path provided! checking for /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh... no configure: header file ast.hh not found at custom path! configure: Path to the solver binaries is not provided! configure: creating ./config.status config.status: creating src/Makevars config.status: creating src/config.h

Though ast.hh is definitely present in the folder it is looking in- by adding a custom flag to each of those warnings in the configure file I can see it is this chunk at 3747 where there is a problem:

`if eval test "x$"$as_ac_Header"" = x"yes"; then :
MZN_PATH=50

else
{ $as_echo "$as_me:${as_lineno-$LINENO}: header file ast.hh not found at custom path!" >&5
$as_echo "$as_me: header file ast.hh not found at custom path!" >&6;}
fi
`

Can you see how this would come about?

No trouble at all I completely understand- thanks so much for your help in trying to get this working for me.

Cheers,
Ben

@acharaakshit
Copy link
Owner

The reason for the message header file ast.hh not found at custom path! is only that the file is not present at the given location.

It's confusing that the error message is displayed even though the file is present.

The chunk of code that you have shared is an if-else statement where you can see that the message is printed only when the header file is not found. The same configure file works for me on my Linux system. Is this issue specific to OSX or are you facing the same issue on your Ubuntu system?

Can you please share the output you got after using the option 1 (using configure_option_1.txt)? I am not checking for header files using AC_CHECK_HEADER in this approach so this only checks if the file is present.

Once this is resolved, I will publish a new release of the package.

Thanks,
Akshit

@ben-phillips1
Copy link
Author

Hi Akshit- sorry again for the delay. Here is what I get with option 1:

configure: Custom libminizinc path provided! checking for /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh... no configure: header file ast.hh not found at custom path! configure: Solver binaries are present but libminizinc is not present or built! configure: creating ./config.status config.status: creating inst/minizinc/solvers/gecode.msc config.status: creating inst/minizinc/solvers/chuffed.msc config.status: creating inst/minizinc/solvers/findmus.msc config.status: creating inst/minizinc/solvers/gecode-gist.msc config.status: creating inst/minizinc/solvers/globalizer.msc config.status: creating src/Makevars config.status: creating src/config.h

I will run the same configure on my ubuntu and get back to you. Thanks again.

@acharaakshit
Copy link
Owner

Thanks for the output!

It means that the file has not been located at /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh . Can you please confirm that the ast.hh is present at the above location?

Sure, that'd be great.

Thanks,
Akshit

@ben-phillips1
Copy link
Author

Very mysterious- looks like it should be present:

khcd317@ukc02zx8rvmd6n minizinc % pwd /Users/khcd317/Documents/Lib/libminizinc/include/minizinc khcd317@ukc02zx8rvmd6n minizinc % ls MIPdomains.hh chain_compressor.hh gc.hh parser.hh solver_instance_defs.hh _thirdparty config.hh hash.hh passes solvers algorithms config.hh.in htmlprinter.hh pathfileprinter.hh statistics.hh ast.hh copy.hh interrupt.hh plugin.hh support ast.hpp eval_par.hh iter.hh prettyprinter.hh timer.hh astexception.hh exception.hh json_parser.hh process.hh type.hh astiterator.hh file_utils.hh model.hh solns2out.hh typecheck.hh astmap.hh flat_exp.hh optimize.hh solver.hh utils.hh aststring.hh flatten.hh optimize_constraints.hh solver_config.hh utils_savestream.hh astvec.hh flatten_internal.hh output.hh solver_instance.hh values.hh builtins.hh flattener.hh param_config.hh solver_instance_base.hh

@acharaakshit
Copy link
Owner

acharaakshit commented Jan 21, 2021

I have attached the configure_option_1.txt again. The if for checking the ast.hh was not closed by fi. Aplologies for the mistake, I couldn't just find it. Please let me know if this resolves your error.

I have also attached a shell script (please rename it to test.sh) for checking if it works. Can you please check its output?

test.txt

Thanks,
Akshit
configure_option_1.txt

@ben-phillips1
Copy link
Author

Thanks for this- had the same error with the new configure_option..

test shell works when I change line 3 to header_file=/Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh:

This should be what the configure.ac is pointing configure towards right?

Cheers,
Ben

@acharaakshit
Copy link
Owner

acharaakshit commented Jan 21, 2021

Thanks!

Yes, the configure.ac (which should be renamed from configure_option_1.txt) is pointing towards /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh.

 AC_MSG_NOTICE([Custom libminizinc path provided!])
 MZN_INCLUDE="-I${with_mzn}/include"
 MZN_HEADER_PATH="${with_mzn}/include/minizinc"
 MZN_LIBS="-L${with_mzn} -lmzn"
 MZN_LIB_PATH="${with_mzn}/libmzn.a"
 					
 file=${with_mzn}/libmzn.a

if [test -e "$file" ]; then
          AC_SUBST([LIB_PATH], "${with_mzn}/libmzn.a")
          header_file=${MZN_HEADER_PATH}/ast.hh
          if [test -e "$header_file" ]; then
                     AC_SUBST([MZN_PATH], 50])
          else
                     AC_MSG_NOTICE([header file ast.hh not found at custom path!])
           fi
else 
           AC_MSG_NOTICE([libmzn.a not found at custom path!])
fi 

Here the ${MZN_HEADER_PATH} is ${with_mzn}/include/minizinc where ${mzn_path} is the --with-mzn argument entered by you that is /Users/khcd317/Documents/Lib/libminizinc. This makes the header_file = /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh.

The above script is a part of configure_option_1.txt.

Did you do autoreconf -i after changing the configure.ac now? It should work now I think.

Please let me know of the progress.

Thanks,
Akshit

@ben-phillips1
Copy link
Author

ben-phillips1 commented Jan 22, 2021

Hi Akshit- yes I am running autoreconf following moving the new configure file into the directory (renaming configure.ac). If I run with -v flag as well it looks like this-

khcd317@ukc02zx8rvmd6n rminizinc % sudo autoreconf -vi autoreconf: Entering directory .' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal autoreconf: configure.ac: tracing autoreconf: configure.ac: not using Libtool autoreconf: running: /usr/local/Cellar/autoconf/2.69/bin/autoconf autoreconf: configure.ac: not using Autoheader autoreconf: configure.ac: not using Automake autoreconf: Leaving directory .'

But still I get

configure: header file ast.hh not found at custom path! configure: Solver binaries are present but libminizinc is not present or built!

I am still running installation as follows:

khcd317@ukc02zx8rvmd6n Lib % SUDO R CMD INSTALL rminizinc_0.0.3.tar.gz --configure-args="--with-mzn=/Users/khcd317/Documents/Lib/libminizinc --with-bin=/Users/khcd317/Documents/Lib/libminizinc"

It's very odd-- the test.sh script is still running fine.

Cheers,
Ben

@acharaakshit
Copy link
Owner

Thanks Ben,

autoreconf output shows that you have some missing dependencies. Can you do brew install autoconf automake libtool and see if you still get the same output for autoreconf -v.

I have attached a configure_option_1.txt after removing a syntax error which was not appearing on running autoreconf and ./configure on my system. I read the code and found that there's an error. AC_SUBST([MZN_PATH], 50]) has now been changed to AC_SUBST([MZN_PATH], 50).

                    AC_MSG_NOTICE([Custom libminizinc path provided!])
                    MZN_INCLUDE="-I${with_mzn}/include"
                    MZN_HEADER_PATH="${with_mzn}/include/minizinc"
                    MZN_LIBS="-L${with_mzn} -lmzn"
                    MZN_LIB_PATH="${with_mzn}/libmzn.a"
                    
                    file=${with_mzn}/libmzn.a
                    header_file=${MZN_HEADER_PATH}/ast.hh

                    if [test -e "$file" ]; then
                        AC_SUBST([LIB_PATH], "${with_mzn}/libmzn.a")
                    if [test -e "$header_file" ]; then
                        AC_SUBST([MZN_PATH], 50)
                    else
                            AC_MSG_NOTICE([header file ast.hh not found at custom path!])
                    fi
                    else 
                        AC_MSG_NOTICE([libmzn.a not found at custom path!])
                    fi 

I have also attached the configure script (please rename from configure.txt to configure) so that you can put in in the package directly and see if there are some issues with autoreconf in generating the correct configure script on your system.

Thank you for continuously being interested! Please let me know if this resolved your issue!

configure_option_1.txt
configure.txt

@ben-phillips1
Copy link
Author

ben-phillips1 commented Jan 22, 2021

No problem and thanks a lot- I'm happy to try and help and sorry there isn't an obvious solution:

The configure script you provided still returns the following:

checking for /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh... no configure: header file ast.hh not found at custom path! configure: Solver binaries are present but libminizinc is not present or built!

So I think it shouldn't be a problem with autoreconf- regardless I tried reinstalling- I still get the same messages

khcd317@ukc02zx8rvmd6n rminizinc % sudo autoreconf -vi Password: autoreconf: Entering directory .' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal autoreconf: configure.ac: tracing autoreconf: configure.ac: not using Libtool autoreconf: running: /usr/local/Cellar/autoconf/2.69/bin/autoconf autoreconf: configure.ac: not using Autoheader autoreconf: configure.ac: not using Automake autoreconf: Leaving directory .'

but it has some suggestions when I reinstall:

`If you need to have openssl@1.1 first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

==> readline
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BSD libedit.

For compilers to find readline you may need to set:
export LDFLAGS="-L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/readline/include"

For pkg-config to find readline you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"`

In order to prevent conflicts with Apple's own libtool we have prepended a "g" so, you have instead: glibtool and glibtoolize.

Thanks a lot for the continued support: when I have some time I was also revisit ubuntu.

Cheers,
Ben

@acharaakshit
Copy link
Owner

Thanks a lot Ben,

I will look more closely and see if there are any issues in the scripts. It is very confusing that the file has not been found by the script. It will be interesting to see if the same script works on your Ubuntu system.

Thanks,
Akshit

@ben-phillips1
Copy link
Author

Thanks again- spent a bit of time on linux and started from scratch and managed to install properly, so good news there. Please let me know if you come up with any progress on mac.

Cheers,
Ben

@acharaakshit
Copy link
Owner

acharaakshit commented Jan 22, 2021

Thanks Ben,

Can you please let me know it worked using the standard install.packages("rminizinc", configure.args="--with-mzn=/path/to/libminizinc --with-bin=/path/to/bin") on Ubuntu?

I have updated the version on CRAN (added file=${with_mzn}/libmzn.a in configure.ac).

I am testing the package on OSX using Travis CI and the steps to are as follows:

        - cd /usr/local/lib;
        - sudo git clone https://github.com/MiniZinc/libminizinc.git; 
        - cd libminizinc/;
        - sudo sed -i '' '3i\'$'\n''set(CMAKE_POSITION_INDEPENDENT_CODE ON)' CMakeLists.txt;
        - sudo -E cmake CMakeLists.txt;
        - sudo make;
        - sudo make install;

Here, the difference is just that libminizinc is stored in the default location i.e /usr/local/lib and no custom location should be provided. install.packages("rminizinc", configure.args="--with-bin=/path/to/bin") should be used.

This works fine and passes the tests on Travis. If this works for you then we will be able to find out if the issue is with the code implemented when --with-mzn is passed as an argument.

Thanks,
Akshit

@ben-phillips1
Copy link
Author

Can you please let me know it worked using the standard install.packages("rminizinc", configure.args="--with-mzn=/path/to/libminizinc --with-bin=/path/to/bin") on Ubuntu?

Yes, this was the standard install through r console.

Thanks for the new advice for OSX- I will try and then update you.

Cheers,
Ben

@acharaakshit
Copy link
Owner

Thanks a lot!

I also tried to install the package on someone's OSX system and was able to install successfully without any issues.

The installation logs:

install.packages("rminizinc", configure.args="--with-mzn=/path/libminizinc-2.5.2 --with-bin=/path/MiniZincIDE-2.5.3-bundle-linux-x86_64/bin")
Installing package into ‘/usr/local/lib/R/4.0/site-library’
(as ‘lib’ is unspecified)

Selection: 1
trying URL 'https://cloud.r-project.org/src/contrib/rminizinc_0.0.4.tar.gz'
Content type 'application/x-gzip' length 415646 bytes (405 KB)
==================================================
downloaded 405 KB

* installing *source* package ‘rminizinc’ ...
** package ‘rminizinc’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ -std=gnu++11 accepts -g... yes
checking how to run the C++ preprocessor... clang++ -std=gnu++11 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
configure: Custom libminizinc path provided!
checking /path/libminizinc-2.5.2/include/minizinc/ast.hh usability... yes
checking /path/libminizinc-2.5.2/include/minizinc/ast.hh presence... yes
checking for /path/libminizinc-2.5.2/include/minizinc/ast.hh... yes
configure: creating ./config.status
config.status: creating inst/minizinc/solvers/gecode.msc
config.status: creating inst/minizinc/solvers/chuffed.msc
config.status: creating inst/minizinc/solvers/findmus.msc
config.status: creating inst/minizinc/solvers/gecode-gist.msc
config.status: creating inst/minizinc/solvers/globalizer.msc
config.status: creating src/Makevars
config.status: creating src/config.h

  --------------------------------------------------
  Configuration for rminizinc 0.0.4

    cppflags: -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include  -I/path/libminizinc-2.5.2/include
    ld flags:      -L/path/libminizinc-2.5.2 -lmzn
    header file folder path:	/path/libminizinc-2.5.2/include/minizinc
    libmzn path:      /path/libminizinc-2.5.2/libmzn.a
    project directory:    /private/var/folders/80/xnsh5vws7tq6lt3d40nm217r0000gn/T/RtmpfwZbPl/R.INSTALLac6135808c25/rminizinc
    build platform:		MAC_OR_UNIX-LIKE
    solver binaries: 	/path/MiniZincIDE-2.5.3-bundle-linux-x86_64/bin

  --------------------------------------------------

** libs
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.0.3_2/lib/R/include" -DNDEBUG -I. -I/path/libminizinc-2.5.2/include -DSTRICT_R_HEADERS -I'/usr/local/lib/R/4.0/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include   -fPIC  -g -O2  -c RcppExports.cpp -o RcppExports.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.0.3_2/lib/R/include" -DNDEBUG -I. -I/path/libminizinc-2.5.2/include -DSTRICT_R_HEADERS -I'/usr/local/lib/R/4.0/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include   -fPIC  -g -O2  -c mzn_parse.cpp -o mzn_parse.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.0.3_2/lib/R/include" -DNDEBUG -I. -I/path/libminizinc-2.5.2/include -DSTRICT_R_HEADERS -I'/usr/local/lib/R/4.0/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include   -fPIC  -g -O2  -c mzn_eval.cpp -o mzn_eval.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.0.3_2/lib/R/include" -DNDEBUG -I. -I/path/libminizinc-2.5.2/include -DSTRICT_R_HEADERS -I'/usr/local/lib/R/4.0/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include   -fPIC  -g -O2  -c sol_parse.cpp -o sol_parse.o
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/4.0.3_2/lib/R/include" -DNDEBUG -I. -I/path/libminizinc-2.5.2/include -DSTRICT_R_HEADERS -I'/usr/local/lib/R/4.0/site-library/Rcpp/include' -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include   -fPIC  -g -O2  -c helper_parse.cpp -o helper_parse.o
clang++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/4.0.3_2/lib/R/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/xz/lib -L/usr/local/lib -o rminizinc.so RcppExports.o mzn_parse.o mzn_eval.o sol_parse.o helper_parse.o -L/path/libminizinc-2.5.2 -lmzn -L/usr/local/Cellar/r/4.0.3_2/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
if test -e "/usr/bin/strip" & test -e "/bin/uname" & [[ `uname` == "Linux" ]] ; \
        then /usr/bin/strip --strip-debug rminizinc.so; fi
/usr/local/Cellar/r/4.0.3_2/lib/R/bin/Rscript -e "LIBMINIZINC_PATH <- '-L/path/libminizinc-2.5.2 -lmzn'; save(LIBMINIZINC_PATH, file='../data/config.RData')"
/usr/local/Cellar/r/4.0.3_2/lib/R/bin/Rscript -e "PROJECT_DIRECTORY <- '/private/var/folders/80/xnsh5vws7tq6lt3d40nm217r0000gn/T/RtmpfwZbPl/R.INSTALLac6135808c25/rminizinc'; save(PROJECT_DIRECTORY, file='../data/proot.RData')"
/usr/local/Cellar/r/4.0.3_2/lib/R/bin/Rscript -e "SOLVER_BIN <- '/path/MiniZincIDE-2.5.3-bundle-linux-x86_64/bin'; save(SOLVER_BIN, file='../data/slvbin.RData')"
installing to /usr/local/lib/R/4.0/site-library/00LOCK-rminizinc/00new/rminizinc/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (rminizinc)

The downloaded source packages are in
	‘/private/var/folders/80/xnsh5vws7tq6lt3d40nm217r0000gn/T/RtmpDniaiW/downloaded_packages’
> 

The compiler details:

$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin20.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

The OS details:

$ system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: macOS 11.1 (20C69)
      Kernel Version: Darwin 20.2.0

In your initial attempt to install:

configure: Custom libminizinc path provided! checking /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh usability... no  
checking /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh presence... yes       
configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: present but cannot be compiled   configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: check for missing prerequisite  headers?   
configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: see the Autoconf documentation  
configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: section "Present But Cannot Be Compiled" 
configure: WARNING: /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh: proceeding with the compiler's result    checking for /Users/khcd317/Documents/Lib/libminizinc/include/minizinc/ast.hh... no

I have found several SO questions with the same issue like 1, 2, etc. I think this is a compiler specific issue. Can you please check if your compiler is working correctly?

Please keep me updated with the progress!

Thanks,
Akshit

@ben-phillips1
Copy link
Author

Hi Akshit- so sorry it took so long to come back on this.

Basically, I can't find any problem with the compiler- normal basic tests are all working OK.

There was some issue with xcode command line tools which was solved by following the steps here https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md#The-acid-test

and it doesn't change the output when attempting to reinstall.

Do you have any ideas for more specific compiler tests to run to check if this is the issue? Otherwise, if this is just an issue that seems to be specific to me please don't worry any further- I am now working with rminizinc on Ubuntu.

Thanks again for all your help.
Ben

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

2 participants