Comments (7)
You are right, on Windows you have to build LLVM from source. I do not know if it will work with LLVM 9, as I currently am still using LLVM 7 for my development work. On Windows, I am building with x86, but I build 64-bit on Linux and it works there, so presumably x64 should work on Windows as well, I have just never tried.
conec is the compiler. conestd is just a tiny library in case you want some print functions that can be called by Cone programs.
Good luck and let me know if you need more help.
from cone.
I haven't gotten around to building LLVM just yet (will comment again when I do), but, as a side-note, are the examples of extern
functions in the Cone Home repository still valid? I assume I just write those out and then link to the .lib
in question?
from cone.
yes. extern
exists so that Cone may access functions / global variables implemented in some other C-ABI compatible library. I have not done much with these for the time-being, I use the print
ones for the Cone playground (conesite repo) examples, just for testing purposes. And the samples in the conehome use extern to interface to SDL2/OpenGL and JS/WebGL functions. All right now for testing purposes as I fill out the base language first. Once it stabilizes, I will definitely begin filling out a more robust collection of libraries.
from cone.
Okay, I built LLVM 7.0.1 from source using the default settings because I wasn't sure what to use. I couldn't get it to build in Visual Studio because it refused to find the LLVM include
folder, even when the LLVMDIR
environment variable was set. I then attempted to build using CMake. It also failed with the following error:
LINK : fatal error LNK1181: cannot open input file 'LLVMAVRAsmParser.lib' [D:\Code\GitHub\cone\build\conec.vcxproj]
Any idea how I should proceed? Are there any flags I was supposed to set for the LLVM build?
EDIT: I also tried building with CMake in Mingw64 and LLVM 9.0.1 (the version provided by the MSYS2 package manager). I got the following error:
D:/Applications/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lLLVMAVRAsmParser
D:/Applications/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lLLVMAVRInfo
D:/Applications/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lLLVMAVRDesc
D:/Applications/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lLLVMAVRCodeGen
collect2.exe: error: ld returned 1 exit status
EDIT2: I tried again with Visual Studio - the issues were two-fold. First, the include directory isn't based on $(LLVMDIR)
in the current Cone.vcxproj
. It's set to E:\
-something by default. Second, the lib directory is reliant A) on the libs being in Debug/Release folders and B) a trailing slash. I thought I was supposed to set it to my Release folder.
It does not work with LLVM 9.0.1. After I figured out what I was doing wrong with the Visual Studio project, I attempted to build it with LLVM 9.0.1. conec depends on LLVMX86AsmPrinter.lib
, which LLVM 9.0.1 does not seem to have, as neither my MSYS2 version or the version I built from source has it.
However, I thought, based on the instructions, that building with WebAssembly support was optional, but that doesn't seem to be the case. I am currently not able to build it because I am missing LLVMWebAssemblyDesc.lib
. I guess I'll rebuild LLVM 7.0.1 and try again.
from cone.
Sorry for the slow turnaround time, we are in different time zones (Australia here). Possibly we can have a faster turnaround time with Discord: https://discord.gg/8jArPHv
You are right that I had an extraneous include file in the Release side of the project file pointing to my E: folder. Thanks for spotting it. I removed it.
The Linker/Input/Additional Dependencies list is indeed set up to point to Release (or Debug). It does that, because that is where the LLVM build automatically sticks the relevant .lib files that are a dependency for Cone's use of LLVM. I am not sure why you would want to put them somewhere else. I don't see a trailing backslash here, though, so maybe you are not referring to this.
I don't believe LLVM 7 automatically builds the WebAssembly target (though later releases do). So when you build LLVM 7, you will have to configure CMake via an option to ask for the WebAssembly target to be generated (LLVM_EXPERIMENTAL_TARGETS_TO_BUILD set to WebAssembly).
LLVM on Windows is a royal pain, because it requires that you specifically name all the .libs you want to link in. And if your compiler supports all its targets (as Cone does), you have to have them all listed in the Project file, and all correct, and of course this list changes from one LLVM release to another. LLVMAVRAsmParser.lib
is one such for the AVR target. LLVMX86AsmPrinter.lib
is another for the x86 target, which likely you will need. You will also find .lib for WebAssembly (e.g., LLVMWebAssemblyInfo.lib
. Again, LLVM changes this list from release to release, necessitating changes to the project file on Windows. So feel free to adjust this list of .libs to match what you end up building with LLVM. Even the LLVM devs have to do this with the Kaleidoscope example.
Again, good luck!
from cone.
Okay, I forgot to build LLVM in Release mode, so I was unable to build a Release build, but I think I have a working Debug build (it says that it compiled the two files in test
successfully). It does not seem that LLVM copied all of the headers into the build folder, so I had to manually add the original source's header folder to get it to build because it couldn't find llvm-c/Core.h
otherwise.
Building for x64 seems to have worked. I just had to add a Release target and let Visual Studio generate the details.
EDIT: Got a Release build built and it also seems to work.
I am not sure why you would want to put them somewhere else. I don't see a trailing backslash here, though, so maybe you are not referring to this.
Based on different instructions, the structure of my LLVM 9.0.1 build folder is completely different. It's closer to that of a binary release's folder, with everything in one folder.
I don't see a trailing backslash here, though, so maybe you are not referring to this.
The LLVMDIR
environment variable requires a trailing backslash, which I wasn't aware of originally.
So feel free to adjust this list of .libs to match what you end up building with LLVM.
I may try that in the future.
from cone.
Congratulations. I am glad to hear you were successful in getting it to build and run.
Wrt the missing llvm-c/Core.h
, the way I discovered to fix that is to perform not just the BUILD_ALL on LLVM, but also to run/build INSTALL. That copies over the needed include files etc.
Good luck playing with the compiler.
from cone.
Related Issues (20)
- Compiler reporting of time is sometimes obviously overestimated HOT 2
- Anonymous function output passed to print HOT 1
- Array declaration fails in global scope HOT 1
- Can't access global variable, as if not seen, but in fact it is seen HOT 2
- Doc for `extern` misses (curly braces) xor (colons) HOT 1
- Fails to print u32 HOT 4
- `typedef` fails HOT 6
- Add support for typed array size HOT 1
- Automatic cast of index when using each HOT 1
- Multidim array type compiles but not usable HOT 2
- Problem with multiple return values HOT 4
- Global arrays are not accessible if not initialized HOT 1
- Literals with underscores not recognized by print and returns HOT 3
- + operator called as a method in backticks does not work or is not implemented HOT 1
- Adding elements to a collection with <- doesn't work HOT 1
- Gist creation broken on the playground
- Grammar railroad diagram HOT 5
- SSL certificate on website invalid since Mar 15, 2022 HOT 2
- Unaccounted for line counting when tokenizing strings HOT 1
- Using C from Cone: calling fopen() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cone.