Why do I get the following when running ocaml interactively under tuareg 2.05?
OCaml version 4.01.0
Cannot find file topfind.
Unknown directive `camlp4o'.
I'm using OSX 10.9.
Iain
It looks like you have a .ocamlinit that tries to load topfind, which is failing because you do not have the right directory in the search path.
If I had to hazard a guess, I'd say that you've put some configuration junk (maybe something like eval `opam config env`) in a configuration file such as ~/.bashrc that arranges for this to work in the shell, but emacs doesn't get to see it because .bashrc is not consulted by the desktop environment in which you start emacs. Does running ocaml under bash in the same directory work and successfully load topfind? If so, find which configuration files your environment does consult and move the relevant code into one of those. ~/.profile, maybe.
Related
I have a cmake project that successfully builds locally but errors with
include could not find load file:
CmakeDependentOption
when trying to build on a CI platform or in Docker. Note that CMakeDependentOption.cmake is a script that comes with cmake itself. So it should just be available. On CI to install cmake, I wget the relevant cmake release from their downloads page, unzip it and add the bin directory to the PATH environment variable. Then I use the cmake command to build my library. The result is the above error.
I suspect this means that a CMake variable (such as "CMAKE_MODULE_PATH" but not, since this variable seems to be empty at the start of the cmake script) is messed up or not set somehow. The path to the correct file to include is
<cmake_root>/share/cmake-3.18/Modules/CMakeDependentOption.cmake
And I have verified that it exists manually. My question: is there a way to locate this directory from within cmake? Perhaps a cmake --config or cmake --libs mode (a bit like pkg-config?)
Failing that, does anybody have any suggestions as to why this is happening and how to get around it.
You can locally because most likely you don't use a linux based platform, like windows or mac. This is because linux filesystem are case sensitive. Which means CmakeDependentOption is different from CMakeDependentOption.
Docker runs containers in linux, so filenames are gonna be case sensitive, and the include is going to fail if the cases are different.
We're using QtCreator 3.2.1 to analyse core dumps on Linux (Debian Jessie). Currently we load it up manually via the menu and "Load Core File" dialog, which allows us to specify a GDB startup script which we use to set up the source code search paths. The paths, and hence the startup script, depend on the specific build being debugged, and so need to be specified along with the executable and core file.
It would be convenient to be able to launch this from the command line via a small Bash helper script. Unfortunately, while QtCreator has command-line options to specify the core file and executable, it doesn't appear to have one to specify the debugger startup script.
Is there some alternative?
Just a crazy idea:
Create a wrapper $HOME/mygdb/gdb:
#!/bin/bash
gdb -command="${$HOME}/mygdb/.gdbinit" "$#"
Then invoke QtCreator like this:
PATH=$HOME/mygdb:$PATH qtcreator -debug myexecutable,core=mycorefile
Inspired by #DBedrenko's initial comment, we configured the GDB Debugger with an Additional Startup Command of source startup.gdb.
The bash helper script simply cd's to a directory containing the appropriate startup.gdb file, and invokes qtcreator -debug <exe>,core=<core>.
Works nicely.
I'm trying to get an OCaml environment set up for the Real World OCaml book.
I need OCaml, OPAM, Utop and the Core library. I've been able to install OCaml, OPAM and Utop but I have problems setting up the Core library.
I'm in OS X and I've already installed Core by:
opam install core
opam install async
opam install core_extended
Now I should add some lines to my .ocamlinit file. The problem is, I'm kind of a noob and I don't know where this file is located exactly or how I can access it. The file should be in my home directory but I can't seem to find it and I'm not sure I know what this means exactly.
I've also tried to setup an OCaml environment on a virtual machine running ubuntu, but I run into the same problem.
Sorry for the low level question.
The file is located in your home directory. It is your current directory when you open your terminal.
You don't see this file because it starts with a ".", this it's hidden and finder can't see it. In your terminal you can see all hidden files by
ls -a
I recommend you use emacs to edit this file, by
emacs .ocamlinit
This will open the .ocamlinit file with the emacs editor.
Then just paste your text into it and do ctrl+x ctrl+s to save and ctrl+x ctrl+c to quit and you're done!
just create it. Also, you may find interesting the user-setup package, installable with opam install user-setup.
The toplevel/utop will search for .ocamlinit in the current directory and if not found there, in the home directory. It sounds like you want the home directory.
If the file you want doesn't exist already, just create it with a text editor. It's a good idea to start with something like
print_string "test\n";;
so you can see whether the init file is taking effect. If you start utop and don't see test, it didn't work.
I am trying to use GDB to debug a C++ program, but my system is not recognizing gdb as a command. I installed it, along with many other tools, via MinGW. I have not had any problem with the other features I have used (gcc, g++), so the issue doesn't seem to be with my general set up. I have added the MinGW\bin directory to my PATH. The gdb.exe is in that folder. But it will not run when invoked from my project directory, it simply errors: "'gdb' is not recognized as an internal or external command, operable program, or batch file." Is there some step in setup or invocation that I missed for using GDB?
EDIT: Alright, I think I found the problem: there are two MinGW directories in my PATH, one at C:\MinGW, and another in folder that got installed with some Haskell compilers I used a while ago. It appears to be defaulting to the Haskell folder, perhaps because this directory is listed first. However, this folder contains gcc and g++, but NOT gdb. I was able to get the gdb command working by creating the fstab file in the msys directory, a step I apparently forgot when setting up MinGW. I added my C:\MinGW directory to it, and now the gdb command is working properly! Out of curiosity, what does this file do?
Also, ideally I would like it to look in the C:\MinGW directory first, since this is the folder I plan to keep updated, and the one that contains ALL of the various applications. However, the Haskell directory is specified via the system PATH variable, which I've read it's not a good idea to touch. Would switching the order that they appear even fix my problem?
EDIT 2: Not 100% sure what happened, but the gdb command appears to be working now. I have always been using the Windows cmd prompt to run these tools, so per the answer below (that I should not need to mess with msys) I deleted the fstab file, and lo, it still works! However, my second question above still stands: What is the best way to get the compilers to run out of C:\MinGW\bin instead of C:\Program Files (x86)\Haskell Platform\2013.2.0.0\bin? Is moving the Haskell location out of the system PATH and to the end of the user PATH a viable option?
I had to run pacman -S mingw-w64-x86_64-gdb separately and then gdb showed up in the bin.
You do not have to run gdb (or gcc and all other MinGW tools for that matter) within msys - it is not like Cygwin in that respect. Had you run it from the Windows cmd console, it should work.
The msys shell is useful for running configure scripts generated by Autoconf used by many Linux originated open source projects, but its environment is independent of the Windows environment.
I have a problem using libclang:
I built libclang locally. It resides somewhere like clang-llvm/…/libclang.3.4.dylib.
Then I developed a foundation tool using that dylib. (exactly: I copied a version to my project folder and linked against this.) The foundation tool works fine. But, of course, at load time it uses the dylib in my local build folder. This is unacceptable, because the user of the tool has to install clang to use my tool.
So I copied libclang.3.4.dylib to a location inside /usr/…/libclang.3.4.dylib and changed the installation path to that location using install_name_path -id /usr/…/libclang.3.4.dylib /usr/…/libclang.3.4.dylib.
After that my tool finds the dylib there but does not work since the parser cannot find stdarg.h any more in the file, that is parsed by my tool.
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:12:10: fatal error: 'stdarg.h' file not found
How can I set the installation path of libclang.3.4.dylib to something public?
Amin, my good friend.
<sarcasm>
From what you wrote it should be OBVIOUS to EVERYONE that you have to create a release build of your tool and NOT a debug build. Xcode should have told you that in the form of CLEAR and EASY to understand error messages.
</sarcasm>
Solution: Use a release build of your tool instead of a debug build.
:)