# Buggy code
def ccode(expr, assign_to=None, **settings):
    r"""Converts an expr to a string of c code

    Parameters
    ==========

    expr : sympy.core.Expr
        a sympy expression to be converted
    assign_to : optional
        When given, the argument is used as the name of the
        variable to which the Fortran expression is assigned.
        (This is helpful in case of line-wrapping.)
    precision : optional
        the precision for numbers such as pi [default=15]
    user_functions : optional
        A dictionary where keys are FunctionClass instances and values
        are their string representations.  Alternatively, the
        dictionary value can be a list of tuples i.e. [(argument_test,
        cfunction_string)].  See below for examples.
    human : optional
        If True, the result is a single string that may contain some
        constant declarations for the number symbols. If False, the
        same information is returned in a more programmer-friendly
        data structure.
    contract: optional
        If True, `Indexed` instances are assumed to obey
        tensor contraction rules and the corresponding nested
        loops over indices are generated. Setting contract = False
        will not generate loops, instead the user is responsible
        to provide values for the indices in the code. [default=True]


    Examples
    ========

    >>> from sympy import ccode, symbols, Rational, sin, ceiling, Abs
    >>> x, tau = symbols(["x", "tau"])
    >>> ccode((2*tau)**Rational(7,2))
    '8*sqrt(2)*pow(tau, 7.0L/2.0L)'
    >>> ccode(sin(x), assign_to="s")
    's = sin(x);'
    >>> custom_functions = {
    ...   "ceiling": "CEIL",
    ...   "Abs": [(lambda x: not x.is_integer, "fabs"),
    ...           (lambda x: x.is_integer, "ABS")]
    ... }
    >>> ccode(Abs(x) + ceiling(x), user_functions=custom_functions)
    'fabs(x) + CEIL(x)'
    >>> from sympy import Eq, IndexedBase, Idx
    >>> len_y = 5
    >>> y = IndexedBase('y', shape=(len_y,))
    >>> t = IndexedBase('t', shape=(len_y,))
    >>> Dy = IndexedBase('Dy', shape=(len_y-1,))
    >>> i = Idx('i', len_y-1)
    >>> e=Eq(Dy[i], (y[i+1]-y[i])/(t[i+1]-t[i]))
    >>> ccode(e.rhs, assign_to=e.lhs, contract=False)
    'Dy[i] = (y[i + 1] - y[i])/(t[i + 1] - t[i]);'

    """
    return CCodePrinter(settings).doprint(expr, assign_to)


# Traceback (CodeWrapError)
ufuncify(x, x*log(10)) produces the following exception


---------------------------------------------------------------------------
CodeWrapError                             Traceback (most recent call last)
<ipython-input-12-f6cc06919001> in <module>()
----> 1 ufuncify(x, x*log(10))

/home/thomas/gitrepos/sympy/sympy/utilities/autowrap.py in ufuncify(args, expr, **kwargs)
479     # first argument accepts an array
480     args[0] = x[i]
--> 481     return autowrap(C.Equality(y[i], f(*args)), **kwargs)

/home/thomas/gitrepos/sympy/sympy/utilities/autowrap.py in autowrap(expr, language, backend, tempdir, args, flags, verbose, helpers)
404         helps.append(Routine(name, expr, args))
405
--> 406     return code_wrapper.wrap_code(routine, helpers=helps)
407
408

/home/thomas/gitrepos/sympy/sympy/utilities/autowrap.py in wrap_code(self, routine, helpers)
133             self._generate_code(routine, helpers)
134             self._prepare_files(routine)
--> 135             self._process_files(routine)
136             mod = __import__(self.module_name)
137         finally:

/home/thomas/gitrepos/sympy/sympy/utilities/autowrap.py in _process_files(self, routine)
158         if retcode:
159             raise CodeWrapError(
--> 160                 "Error while executing command: %s" % " ".join(command))
161
162

CodeWrapError: Error while executing command: f2py -m wrapper_module_6 -c wrapped_code_6.f90

If I replace log(2) by its numerical value ufuncify works as expected.

# Fixed code
def ccode(expr, assign_to=None, **settings):
    """Converts an expr to a string of c code

    Parameters
    ==========

    expr : Expr
        A sympy expression to be converted.
    assign_to : optional
        When given, the argument is used as the name of the variable to which
        the expression is assigned. Can be a string, ``Symbol``,
        ``MatrixSymbol``, or ``Indexed`` type. This is helpful in case of
        line-wrapping, or for expressions that generate multi-line statements.
    precision : integer, optional
        The precision for numbers such as pi [default=15].
    user_functions : dict, optional
        A dictionary where keys are ``FunctionClass`` instances and values are
        their string representations. Alternatively, the dictionary value can
        be a list of tuples i.e. [(argument_test, cfunction_string)]. See below
        for examples.
    human : bool, optional
        If True, the result is a single string that may contain some constant
        declarations for the number symbols. If False, the same information is
        returned in a tuple of (symbols_to_declare, not_supported_functions,
        code_text). [default=True].
    contract: bool, optional
        If True, ``Indexed`` instances are assumed to obey tensor contraction
        rules and the corresponding nested loops over indices are generated.
        Setting contract=False will not generate loops, instead the user is
        responsible to provide values for the indices in the code.
        [default=True].

    Examples
    ========

    >>> from sympy import ccode, symbols, Rational, sin, ceiling, Abs
    >>> x, tau = symbols("x, tau")
    >>> ccode((2*tau)**Rational(7, 2))
    '8*sqrt(2)*pow(tau, 7.0L/2.0L)'
    >>> ccode(sin(x), assign_to="s")
    's = sin(x);'

    Custom printing can be defined for certain types by passing a dictionary of
    "type" : "function" to the ``user_functions`` kwarg. Alternatively, the
    dictionary value can be a list of tuples i.e. [(argument_test,
    cfunction_string)].

    >>> custom_functions = {
    ...   "ceiling": "CEIL",
    ...   "Abs": [(lambda x: not x.is_integer, "fabs"),
    ...           (lambda x: x.is_integer, "ABS")]
    ... }
    >>> ccode(Abs(x) + ceiling(x), user_functions=custom_functions)
    'fabs(x) + CEIL(x)'

    ``Piecewise`` expressions are converted into conditionals. If an
    ``assign_to`` variable is provided an if statement is created, otherwise
    the ternary operator is used. Note that if the ``Piecewise`` lacks a
    default term, represented by ``(expr, True)`` then an error will be thrown.
    This is to prevent generating an expression that may not evaluate to
    anything.

    >>> from sympy import Piecewise
    >>> expr = Piecewise((x + 1, x > 0), (x, True))
    >>> print(ccode(expr, tau))
    if (x > 0) {
    tau = x + 1;
    }
    else {
    tau = x;
    }

    Support for loops is provided through ``Indexed`` types. With
    ``contract=True`` these expressions will be turned into loops, whereas
    ``contract=False`` will just print the assignment expression that should be
    looped over:

    >>> from sympy import Eq, IndexedBase, Idx
    >>> len_y = 5
    >>> y = IndexedBase('y', shape=(len_y,))
    >>> t = IndexedBase('t', shape=(len_y,))
    >>> Dy = IndexedBase('Dy', shape=(len_y-1,))
    >>> i = Idx('i', len_y-1)
    >>> e=Eq(Dy[i], (y[i+1]-y[i])/(t[i+1]-t[i]))
    >>> ccode(e.rhs, assign_to=e.lhs, contract=False)
    'Dy[i] = (y[i + 1] - y[i])/(t[i + 1] - t[i]);'

    Matrices are also supported, but a ``MatrixSymbol`` of the same dimensions
    must be provided to ``assign_to``. Note that any expression that can be
    generated normally can also exist inside a Matrix:

    >>> from sympy import Matrix, MatrixSymbol
    >>> mat = Matrix([x**2, Piecewise((x + 1, x > 0), (x, True)), sin(x)])
    >>> A = MatrixSymbol('A', 3, 1)
    >>> print(ccode(mat, A))
    A[0][0] = pow(x, 2);
    if (x > 0) {
       A[1][0] = x + 1;
    }
    else {
       A[1][0] = x;
    }
    A[2][0] = sin(x);
    """

    return CCodePrinter(settings).doprint(expr, assign_to)