# Compiling fails with USE\_INTEL\_JITEVENTS, USE\_OPROFILE\_JITEVENTS and USE\_PERF\_JITEVENTS = 1

**URL:** <https://discourse.julialang.org/t/compiling-fails-with-use-intel-jitevents-use-oprofile-jitevents-and-use-perf-jitevents-1/51274>\
**Category:** Tooling\
**Tags:** profiling\
**Created:** [December 4, 2020, 8:59pm UTC](https://discourse.julialang.org/t/compiling-fails-with-use-intel-jitevents-use-oprofile-jitevents-and-use-perf-jitevents-1/51274 "2020-12-04T20:59:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tippit](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@Tippit](https://discourse.julialang.org/u/Tippit)\
**Post date:** [December 4, 2020, 8:59pm UTC](https://discourse.julialang.org/t/compiling-fails-with-use-intel-jitevents-use-oprofile-jitevents-and-use-perf-jitevents-1/51274/1 "2020-12-04T20:59:43Z")

</div>

First time posting here: I’m building Julia from source to enable external profiling for all three tools

The build fails with:

```julia
/home/tippit/julia/src/init.c: In function ‘_julia_init’:
/home/tippit/julia/src/init.c:697:17: error: redefinition of ‘jit_profiling’
  697 | const char *jit_profiling = getenv("ENABLE_JITPROFILING");
      | ^ ~~~~~~~~~~~~
/home/tippit/julia/src/init.c:683:17: note: previous definition of ‘jit_profiling’ was here
  683 | const char *jit_profiling = getenv("ENABLE_JITPROFILING");

```

Make.user looks like this:

```julia
USE_BINARYBUILDER=0
USE_BINARYBUILDER_LLVM=0
USE_INTEL_JITEVENTS=1
USE_PROFILE_JITEVENTS=1
USE_PERF_JITEVENTS=1

```

My temporary fix to compile was to comment out lines 690 and 697 in src/init.c to avoid the redefinition, but I’ve since rebuilt successfully with init.c lines 682-710 like this:

```julia
#if defined(JL_USE_INTEL_JITEVENTS)
#if !defined(JIT_PROFILING_ENABLED)
#define JIT_PROFILING_ENABLED
    const char *jit_profiling = getenv("ENABLE_JITPROFILING");
#endif
    if (jit_profiling && atoi(jit_profiling)) {
        jl_using_intel_jitevents = 1;
    }
#endif

#if defined(JL_USE_OPROFILE_JITEVENTS)
#if !defined(JIT_PROFILING_ENABLED)
#define JIT_PROFILING_ENABLED
    const char *jit_profiling = getenv("ENABLE_JITPROFILING");
#endif
    if (jit_profiling && atoi(jit_profiling)) {
        jl_using_oprofile_jitevents = 1;
    }
#endif

#if defined(JL_USE_PERF_JITEVENTS)
#if !defined(JIT_PROFILING_ENABLED)
#define JIT_PROFILING_ENABLED
    const char *jit_profiling = getenv("ENABLE_JITPROFILING");
#endif
    if (jit_profiling && atoi(jit_profiling)) {
        jl_using_perf_jitevents= 1;
    }
#endif

```

Is this worth opening an issue? Is that a clean solution to the problem?

Thank you!

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [December 6, 2020, 7:02pm UTC](https://discourse.julialang.org/t/compiling-fails-with-use-intel-jitevents-use-oprofile-jitevents-and-use-perf-jitevents-1/51274/2 "2020-12-06T19:02:37Z")

</div>

Please do open a PR! Normally we only assume that you enable one integration, but if there is a good use-case for wanting multiple integrations I don’t see the harm in allowing more. Although I would hoist the `const char *jit_profiling = getenv("ENABLE_JITPROFILING");` into it’s own pre-processor statment instead of doing the:

```julia
#if !defined(JIT_PROFILING_ENABLED)
#define JIT_PROFILING_ENABLED

```

---

<div class="post-metadata">

**Author:** ![Tippit](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@Tippit](https://discourse.julialang.org/u/Tippit)\
**Post date:** [December 6, 2020, 8:02pm UTC](https://discourse.julialang.org/t/compiling-fails-with-use-intel-jitevents-use-oprofile-jitevents-and-use-perf-jitevents-1/51274/3 "2020-12-06T20:02:32Z")

</div>

Thanks for the response! You’ll have to forgive me - it’s been a bit since I’ve used C. Are you saying instead do something like:

```julia
#if \
    defined(JL_USE_INTEL_JITEVENTS) || \
    defined(JL_USE_OPROFILE_JITEVENTS) || \
    defined(JL_USE_PERF_JITEVENTS)
    const char *jit_profiling = getenv("ENABLE_JITPROFILING");
#endif

```

Above the other statements?

---

<div class="post-metadata">

**Author:** ![ParadaCarleton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradacarleton/32/20005_2.png) [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Post date:** [April 24, 2021, 3:17am UTC](https://discourse.julialang.org/t/compiling-fails-with-use-intel-jitevents-use-oprofile-jitevents-and-use-perf-jitevents-1/51274/4 "2021-04-24T03:17:56Z")

</div>

I’d like to say I got the same bug and this should probably be fixed in the next minor update (not sure why it wasn’t already).
