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

This fixes issue #239 related to building Ruby on FreeBSD systems #266

Closed
wants to merge 2 commits into from

Conversation

kaspergrubbe
Copy link

This relates to issue #239 that caused Ruby-build to fail when building Ruby on FreeBSD systems.

I tracked down the error, and it was caused by running make with the make -j 2-parameter.

Why it failed I don't know, but it would seem that using -j is disabling backwards compatibility, from the make man-page:

-B:
Try to be backwards compatible by executing a single shell per
command and by executing the commands to make the sources of a
dependency line in sequence. This is turned on by default unless
-j is used.

-j max_jobs
Specify the maximum number of jobs that make may have running at
any one time. Turns compatibility mode off, unless the -B flag
is also specified.

Before my change, running rbenv install 1.9.3-p327 ran make -j 2 would cause the compiling to fail:

installing default wait_for_single_fd libraries
compiling wait_for_single_fd.c
linking shared-object -test-/wait_for_single_fd/wait_for_single_fd.so
make: don't know how to make ../../.ext/common/bigdecimal. Stop
*** [ext/bigdecimal/all] Error code 2
1 error
*** [build-ext] Error code 2

After my change, the build would complete with make -B -j 2.

I don't know if my solution is the "prettiest", but maybe we should consider just adding the -B argument on other non-freebsd systems as well.

Thoughts about this?

Signed-off-by: Kasper 'kapöw' Grubbe <kawsper@gmail.com>
@fabiankrack
Copy link
Contributor

Alternatively you can use GNU make which most other system use as 'make'.

@kaspergrubbe
Copy link
Author

Yep, that could be a nice solution, and wouldn't cripple other systems.

Some troubles between versions:

On FreeBSD:

[ben2@pregl ~]$ make --version
make: illegal option -- -
usage: make [-BPSXeiknpqrstv] [-C directory] [-D variable]
    [-d flags] [-E variable] [-f makefile] [-I directory]
    [-j max_jobs] [-m directory] [-V variable]
    [variable=value] [target ...]
[ben2@pregl ~]$ make -V MAKE_VERSION
5200408120

On OSX:

[~]=> make --version
GNU Make 3.81
[~]=> make -V MAKE_VERSION
make: invalid option -- V

It could be nice to rely on output from --version, but we have to be more sneaky. We could rely on the status code from each command and guess the proper version from the output, but I don't know how many different make-systems that we should support.

@kaspergrubbe
Copy link
Author

I've made it available to guess which version is available based on argument detection. It is the following that is happening:

make --version       &>/dev/null ; PROBE_GCC_MAKE=$?
make -V MAKE_VERSION &>/dev/null ; PROBE_BSD_MAKE=$?

if [ $PROBE_GCC_MAKE -eq 0 ]; then
    echo "you have gcc make"
elif [ $PROBE_BSD_MAKE -eq 0 ]; then
    echo "you have bsd make"
fi

On my FreeBSD server:

[ben2@pregl ~]$ bash te.sh
you have bsd make

On my OSX Machine (it is the same on my Linux server):

[~]=> bash te.sh
you have gcc make

@sferik
Copy link
Contributor

sferik commented Feb 22, 2013

I believe this is problem is resolved by #272. If not, please reopen it.

@sferik sferik closed this Feb 22, 2013
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

Successfully merging this pull request may close these issues.

4 participants