# Starting to Help with Erlang Source Code, compile issues

**URL:** <https://erlangforums.com/t/starting-to-help-with-erlang-source-code-compile-issues/1486>\
**Category:** Questions / Help\
**Tags:** compile\
**Created:** [May 27, 2022, 9:00pm UTC](https://erlangforums.com/t/starting-to-help-with-erlang-source-code-compile-issues/1486 "2022-05-27T21:00:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MessageMap](https://erlangforums.com/user_avatar/erlangforums.com/messagemap/32/1473_2.png) [@MessageMap](https://erlangforums.com/u/MessageMap)\
**Post date:** [May 27, 2022, 9:00pm UTC](https://erlangforums.com/t/starting-to-help-with-erlang-source-code-compile-issues/1486/1 "2022-05-27T21:00:24Z")

</div>

I’m starting to look at helping with source code updated, I started looking at issue:

> <https://github.com/erlang/otp/issues/5719>
>
> Hi!
> 
> We noticed that Common Test does not preserve stacktraces for throws, but… it does for errors. This can complicate debugging.
> Some occurrences where this happens:
> 
> https://github.com/erlang/otp/blob/master/lib/common\_test/src/test\_server.erl#L1581-L1585
> https://github.com/erlang/otp/blob/master/lib/common\_test/src/test\_server.erl#L1649-L1652
> https://github.com/erlang/otp/blob/master/lib/common\_test/src/test\_server.erl#L1792-L1793
> 
> For example, the following happens if I add a \`error(foo)\` in the \`init\_per\_testcase/2\`:
> 
> \`\`\`
> % rebar3 ct --suite apps/els\_lsp/test/els\_rename\_SUITE.erl --case rename\_module
> ===\> Verifying dependencies...
> ===\> Analyzing applications...
> ===\> Compiling els\_core
> ===\> Compiling els\_dap
> ===\> Compiling els\_lsp
> ===\> Running Common Test suites...
> %%% els\_rename\_SUITE:
> %%% els\_rename\_SUITE ==\> rename\_module: SKIPPED
> %%% els\_rename\_SUITE ==\> {tc\_auto\_skip,
> {failed,
> {els\_rename\_SUITE,init\_per\_testcase,
> {foo,
> \[{els\_rename\_SUITE,init\_per\_testcase,2,
> \[{file,
> "/Users/robertoaloi/git/github/erlang-ls/erlang\_ls/apps/els\_lsp/test/els\_rename\_SUITE.erl"},
> {line,61}\]},
> {test\_server,do\_init\_per\_testcase,2,
> \[{file,"test\_server.erl"},{line,1553}\]},
> {test\_server,run\_test\_case\_eval1,6,
> \[{file,"test\_server.erl"},{line,1254}\]},
> {test\_server,run\_test\_case\_eval,9,
> \[{file,"test\_server.erl"},{line,1224}\]}\]}}}}
> \`\`\`
> 
> While this happens if I use \`throw(foo)\`:
> 
> \`\`\`
> % rebar3 ct --suite apps/els\_lsp/test/els\_rename\_SUITE.erl --case rename\_module
> ===\> Verifying dependencies...
> ===\> Analyzing applications...
> ===\> Compiling els\_core
> ===\> Compiling els\_dap
> ===\> Compiling els\_lsp
> ===\> Running Common Test suites...
> %%% els\_rename\_SUITE:
> %%% els\_rename\_SUITE ==\> rename\_module: SKIPPED
> %%% els\_rename\_SUITE ==\> {tc\_auto\_skip,{failed,{els\_rename\_SUITE,init\_per\_testcase,foo}}}
> \`\`\`
> 
> We were wondering if there's any specific reason behind this behaviour.

So I pulled down a forked version of code and looking to do an initial build,  
My git log from may branch

```erlang
commit 873912bf8ab4def4a23dedb55389a374381422b8 (HEAD -> 5719_CommonTest_eating_stacktraces, origin/maint, maint)
Merge: c1409c3a9e e7a44a7447
Author: Sverker Eriksson <sverker@erlang.org>
Date: Wed May 25 21:12:52 2022 +0200

    Merge PR-5987 from sverker/25/hopeful-in-fun-env/OTP-18093
    
    Accept incorrectly encoded fun containing export fun or bitstring

```

My steps for compiling are using default options:

```erlang
 ./configure --prefix=/tmp/local_erl

```

But when I run make I get:

```erlang
 LD	/home/src/otp/bin/x86_64-pc-linux-gnu/beam.jit
obj/x86_64-pc-linux-gnu/opt/jit/erl_db.o: In function `erts_rwmtx_size':
/home/src/otp/erts/emulator/beam/erl_threads.h:1889: undefined reference to `ethr_rwmutex_size'
/home/src/otp/erts/emulator/beam/erl_threads.h:1889: undefined reference to `ethr_rwmutex_size'
obj/x86_64-pc-linux-gnu/opt/jit/erl_db_hash.o: In function `erts_rwmtx_size':
/home/src/otp/erts/emulator/beam/erl_threads.h:1889: undefined reference to `ethr_rwmutex_size'
/home/src/otp/erts/emulator/beam/erl_threads.h:1889: undefined reference to `ethr_rwmutex_size'
/home/src/otp/erts/emulator/beam/erl_threads.h:1889: undefined reference to `ethr_rwmutex_size'
obj/x86_64-pc-linux-gnu/opt/jit/erl_db_hash.o:/home/src/otp/erts/emulator/beam/erl_threads.h:1889: more undefined references to `ethr_rwmutex_size' follow
collect2: error: ld returned 1 exit status
make[4]: *** [x86_64-pc-linux-gnu/Makefile:1254: /home/src/otp/bin/x86_64-pc-linux-gnu/beam.jit] Error 1
make[4]: Leaving directory '/home/src/otp/erts/emulator'
make[3]: *** [/home/src/otp/make/run_make.mk:35: opt] Error 2
make[3]: Leaving directory '/home/src/otp/erts/emulator'
make[2]: *** [Makefile:45: opt] Error 2
make[2]: Leaving directory '/home/src/otp/erts'
make[1]: *** [Makefile:60: jit] Error 2
make[1]: Leaving directory '/home/src/otp/erts'
make: *** [Makefile:496: emulator] Error 2

```

Wondering what I’m missing to do a pre-code change compile and install, Note: I get the same thing from master.

Also c++ files have not been updated since Feb 15.

Thanks for the help and getting going.

---

<div class="post-metadata">

**Author:** ![max-au](https://erlangforums.com/user_avatar/erlangforums.com/max-au/32/1627_2.png) [@max-au](https://erlangforums.com/u/max-au)\
**Post date:** [May 28, 2022, 7:47pm UTC](https://erlangforums.com/t/starting-to-help-with-erlang-source-code-compile-issues/1486/2 "2022-05-28T19:47:11Z")

</div>

Ensure you have environment variable exported to the root of your erl tree:

```erlang
ERL_TOP=`pwd`

```

It appears to point at `/home/src/otp`, which makes me think you have a Linux user named `src`.

---

<div class="post-metadata">

**Author:** ![MessageMap](https://erlangforums.com/user_avatar/erlangforums.com/messagemap/32/1473_2.png) [@MessageMap](https://erlangforums.com/u/MessageMap)\
**Post date:** [May 29, 2022, 1:09pm UTC](https://erlangforums.com/t/starting-to-help-with-erlang-source-code-compile-issues/1486/3 "2022-05-29T13:09:24Z")

</div>

I check and still was not working, so I changed to Ubuntu and followed required install stuff from the dockerfile run: [otp/Dockerfile.ubuntu-base at maint · erlang/otp · GitHub](https://github.com/erlang/otp/blob/maint/.github/dockerfiles/Dockerfile.ubuntu-base)

that is working fine.

Last question is when I compile to test the code. my io:format calls from the compiled erl engine look to be removed or something.

is there away to compile erlang in a “DEBUG” format so you get more verbose logging on run?

Thanks for the help, Just onboarding into coding on the erlang engine.

---

<div class="post-metadata">

**Author:** ![garazdawi](https://erlangforums.com/user_avatar/erlangforums.com/garazdawi/32/175_2.png) [@garazdawi](https://erlangforums.com/u/garazdawi)\
**Post date:** [May 29, 2022, 6:23pm UTC](https://erlangforums.com/t/starting-to-help-with-erlang-source-code-compile-issues/1486/4 "2022-05-29T18:23:12Z")

</div>

> [@MessageMap](#):
>
> Last question is when I compile to test the code. my io:format calls from the compiled erl engine look to be removed or something.

Common Test (the test framework used to test Erlang/OTP) captures all `io:format` calls and places them in the html log for that testcase. So I think that is where you want to look for the missing `io:formats`.

---

<div class="post-metadata">

**Author:** ![MessageMap](https://erlangforums.com/user_avatar/erlangforums.com/messagemap/32/1473_2.png) [@MessageMap](https://erlangforums.com/u/MessageMap)\
**Post date:** [May 29, 2022, 6:24pm UTC](https://erlangforums.com/t/starting-to-help-with-erlang-source-code-compile-issues/1486/5 "2022-05-29T18:24:58Z")

</div>

Thanks Garazdawi, I found that when doing some more digging on the html files. Thanks for all the help.

But I was able to get my first PR out to erlang to fix an issue though

> <https://github.com/erlang/otp/pull/6029>
>
> this commit fixes #5719 
> New Stacktrace with thrown is:
> \`\`\`
> ===\> Running Comm…on Test suites...
> %%% db\_data\_type\_SUITE: 
> %%% db\_data\_type\_SUITE ==\> init\_per\_suite: FAILED
> %%% db\_data\_type\_SUITE ==\> {thrown,
> {foo,
> \[{db\_data\_type\_SUITE,init\_per\_suite,1,
> \[{file,
> "/home/adamsbd/src/infratracks/common\_tests/db\_data\_type\_SUITE.erl"},
> {line,44}\]},
> {test\_server,ts\_tc,3,\[{file,"test\_server.erl"},{line,1782}\]},
> {test\_server,run\_test\_case\_eval1,6,
> \[{file,"test\_server.erl"},{line,1379}\]},
> {test\_server,run\_test\_case\_eval,9,
> \[{file,"test\_server.erl"},{line,1223}\]}\]}}
> \`\`\`
> 
> no change to without Thrown and Normal Error:
> \`\`\`
> ===\> Running Common Test suites...                                                                                                          
> %%% db\_data\_type\_SUITE:                                               
> %%% db\_data\_type\_SUITE ==\> init\_per\_suite: FAILED
> %%% db\_data\_type\_SUITE ==\> {undef,\[{db,connect,\["DSN=sqlserver;UID=alladin;PWD=sesame",\[\]\],\[\]},
> {db\_data\_type\_SUITE,init\_per\_suite,1,
> \[{file,"/home/adamsbd/src/infratracks/common\_tests/db\_data\_type\_SUITE.erl"},
> {line,43}\]},
> {test\_server,ts\_tc,3,\[{file,"test\_server.erl"},{line,1782}\]},
> {test\_server,run\_test\_case\_eval1,6,
> \[{file,"test\_server.erl"},{line,1379}\]},
> {test\_server,run\_test\_case\_eval,9,
> \[{file,"test\_server.erl"},{line,1223}\]}\]}

😀 “small change but steps in learning the process”

---

<div class="post-metadata">

**Author:** ![MessageMap](https://erlangforums.com/user_avatar/erlangforums.com/messagemap/32/1473_2.png) [@MessageMap](https://erlangforums.com/u/MessageMap)\
**Post date:** [May 29, 2022, 8:06pm UTC](https://erlangforums.com/t/starting-to-help-with-erlang-source-code-compile-issues/1486/6 "2022-05-29T20:06:19Z")

</div>

Moved my listing of comments related to PR and Issue to the github issue. since compiling source code is good to go now.

Thanks again
