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

Just question about compile ocaml in termux #1

Closed
wants to merge 1 commit into from

Conversation

salc2
Copy link

@salc2 salc2 commented Jun 28, 2018

Hi ygrek,
Sorry for bother you, please ignore this PR I just wanted a way to ask you about this tutorial: http://ygrek.org.ua/p/ocaml-termux.html
I just gave it a try to the second way (True way) and did not have any luck.
I tried a couple of time and got the same error:

$ make world.opt install
make -C byterun  all
make[1]: Entering directory '/data/data/com.termux/files/home/ocaml/byterun'
gcc -O2 -fno-strict-aliasing -fwrapv -Wall  -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE  -Wl,-E -Wl,-E -o ocamlrun prims.o libcamlrun.a -lm  -lcurses -lpthread
libcamlrun.a(signals.o): In function `caml_try_leave_blocking_section_default':
/data/data/com.termux/files/home/ocaml/byterun/signals.c:101: undefined reference to `__atomic_exchange_4'
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile:181: ocamlrun] Error 1
make[1]: Leaving directory '/data/data/com.termux/files/home/ocaml/byterun'
make: *** [Makefile:384: coldstart] Error 2

I would like to install opam to be able to install Bucklescript later.
What do you think is happening if you don't mind... thank you very much in advance for shared this article with the community.
Some details:
termux 0.63

uname -a
Linux localhost 3.18.31-perf-g2830021-00101-g31fe6a0 #1 SMP PREEMPT Thu Mar 29 04:06:50 CDT 2018 armv7l Android

branch

  • termux-4.06.1

ld -v
GNU ld (GNU Binutils) 2.30

Cheers.

Hi ygrek,
Sorry for bother you, please ignore this PR I just wanted a way to ask you about this tutorial: http://ygrek.org.ua/p/ocaml-termux.html
I just gave it a try to the second way (True way) and did not have any luck.
I tried a couple of time and got the same error: 
```
$ make world.opt install
make -C byterun  all
make[1]: Entering directory '/data/data/com.termux/files/home/ocaml/byterun'
gcc -O2 -fno-strict-aliasing -fwrapv -Wall  -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE  -Wl,-E -Wl,-E -o ocamlrun prims.o libcamlrun.a -lm  -lcurses -lpthread
libcamlrun.a(signals.o): In function `caml_try_leave_blocking_section_default':
/data/data/com.termux/files/home/ocaml/byterun/signals.c:101: undefined reference to `__atomic_exchange_4'
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile:181: ocamlrun] Error 1
make[1]: Leaving directory '/data/data/com.termux/files/home/ocaml/byterun'
make: *** [Makefile:384: coldstart] Error 2
```
I would like to install opam to be able to install Bucklescript later.
What do you think is happening if you don't mind... thank you very much in advance for shared this article with the community.
Some details:
termux 0.63

uname -a
Linux localhost 3.18.31-perf-g2830021-00101-g31fe6a0 ygrek#1 SMP PREEMPT Thu Mar 29 04:06:50 CDT 2018 armv7l Android

branch
* termux-4.06.1

ld -v                                               
GNU ld (GNU Binutils) 2.30

Cheers.
@ygrek
Copy link
Owner

ygrek commented Jul 2, 2018

I don't know much about arm platform, but here are some ideas to try :

  1. Try "easy way" using pre-compiled opam for armv7l : https://github.com/ocaml/opam/releases/tag/2.0.0-beta3 - idk if it will or will not work because of paths
  2. Issues with autoconf & libtool android/ndk#37 suggests to add -latomic to link flags, I imagine adding -libs -latomic to ./configure invocation when building OCaml should work

Please let me know how it goes so that I can update the guide

@salc2
Copy link
Author

salc2 commented Jul 3, 2018

@ygrek Thank you for take the time to answear.
I've tried both ways and as you said 1st (precompiled for armv7l) did not work because the path I assume.
However 2nd way adding -libs -latomic to the .configure and following your True Way guide almost worked because ocaml and ocamlc.bytegot compiled and works perfect I guess, but others command like ocamlc, ocamlc.opt and others .opt and .byte are giving me this error:

$ ocamlc.opt
CANNOT LINK EXECUTABLE "ocamlc.opt": /data/data/com.termux/files/usr/bin/ocamlc.opt: has text relocations
Aborted

And configure and compile again just as
I keep trying so I will let you know any progress.
Thank you again.

@ygrek
Copy link
Owner

ygrek commented Jul 7, 2018

So if I understand correctly you are saying that bytecode works, but native compilation doesn't? This can be if your hardware is not fully supported in OCaml sources currently, but it should be enough to build things and play around with ocaml/reasonml.

@salc2
Copy link
Author

salc2 commented Jul 16, 2018

Sorry for the late response. I did not try again. Actually that is exactly what I wanted, be able to play around with ReasonML from my phone but I guess it needs native batch compiler for that. I tried making symbolic link and alias faking the native compiler with the bytecode one but not luck.

@ygrek
Copy link
Owner

ygrek commented Jul 16, 2018

you should raise this issue with reasonml, there shouldn't be technical reason that would prevent compiling reasonml tools and bsb compiler in bytecode. Most probably nobody needed it before so it was never tried and some assumptions crept in which can be easily removed.

@salc2
Copy link
Author

salc2 commented Jul 17, 2018

mmm it could make sense, let me investigate a bit more then.
Thank you very much mate.
Cheers.

@ygrek
Copy link
Owner

ygrek commented Feb 27, 2019

feel free to open new issue if needed

@ygrek ygrek closed this Feb 27, 2019
ygrek pushed a commit that referenced this pull request Dec 30, 2020
This job did actually do two different things:

1. Check that the compiler can be built without the world.opt target

2. Run sanitizers

This commit thus splits the extra-checks job into two separate
ones that are defined as Jenkins pipeline jobs named sanitizers and
step-by-step-build.
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.

2 participants