1

I'm trying to install ImageMagick from source. To do this I'm using the instructions here. It works until the make command is executed. It says that it can't find the makefile "cmd": "/usr/bin/make", "msg": "make: *** No targets specified and no makefile found. Stop." I tried different targets such as 'all' and 'install', and no target. In the directory are 2 files Makefile.am, and Makefile.in.

This is the text from the Ansible playbook I set up for this:

- name: register directory name var
  shell: ls -d /path/ImageMagick-*
  register: dir_path

- name: configure imagemagick make
  command: "{{ dir_path.stdout }}/configure"

- name: Build default target
  make:
    chdir: "{{ dir_path.stdout }}"

- name: Run 'install' target
  make:
    chdir: "{{ dir_path.stdout }}"
    target: install

The problem seems to be in the configure step but it appears to have completed successfully, or else it should have displayed an error message, I suppose? Here is the output from Ansible as a paste: https://pastebin.com/MJjnQeRB

If I run ./configure and then make on the command line, it works. So this seems to be an Ansible problem. How can I make it work?

Matts
  • 1,301
  • 11
  • 30
  • What does the `configure` step end up doing? It should create your `Makefile` if it completes correctly. – tripleee Sep 26 '19 at 06:21
  • It seemed to complete successfully ""ImageMagick 7.0.8-66 is configured as follows. Please verify that this", "configuration matches your expectations." – Matts Sep 26 '19 at 06:23
  • Your expectations should include "a Makefile was created" like it says in the comments in the `configure` script itself. If it didn't do that, that's the part you need to troubleshoot. – tripleee Sep 26 '19 at 06:24
  • 1
    Possible duplicate of [make \*\*\* no targets specified and no makefile found. stop](https://stackoverflow.com/questions/14412919/make-no-targets-specified-and-no-makefile-found-stop) – tripleee Sep 26 '19 at 06:26
  • This is the output of creating makefile from config "config.status: creating Makefile", "config.status: creating magick.sh", "config.status: creating PerlMagick/check.sh", "config.status: creating PerlMagick/default/Magick.pm", "config.status: creating PerlMagick/Makefile.PL", – Matts Sep 26 '19 at 06:27
  • thanks, I've been reading through those answers. There's no Makefile, so it might be due to some unmet dependency. The config file has some output like this - "checking for library containing socket... none required". I'm guessing this means it's not finding it, but it's required. – Matts Sep 26 '19 at 06:36
  • You really need to [edit] the question to provide the actual output from `configure`, probably pared down to a useful subset. The answer to the `make` part is already provided in the proposed duplicate. I'm afraid there is no simple way to tell you exactly what to look for in the `configure` output. – tripleee Sep 26 '19 at 06:40
  • The usual, simple solution to "how do I install ImageMagick" is "use your distro's package manager" unless you specifically require to build from source because you want to make changes to the sources before buidling. – tripleee Sep 26 '19 at 06:41
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/199995/discussion-between-matts-and-tripleee). – Matts Sep 26 '19 at 06:47

2 Answers2

1

Your other targets use chdir to switch to another directory, but you're not doing that for configure, so its output lands somewhere else. You need to run configure and make in the same directory.

Option 1: add chdir: to the configure recipe, too.

Option 2: remove chdir: from the other recipes.

Option 3: collapse configure and make to run in the same recipe, and chdir: or not as you wish.

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • Thanks, I used option 1, and edited question with command that worked. – Matts Sep 26 '19 at 07:27
  • Your question should generally remain strictly a question; feel free to post an answer of your own, and even accept that if you prefer. – tripleee Sep 26 '19 at 07:36
0

The solution is to change the command to include chdir:

- name: configure imagemagick make
  command: ./configure
  args:
    chdir: "{{ dir_path.stdout }}"
Matts
  • 1,301
  • 11
  • 30