compilation

RISC-V disassembler doesn't match with spike running results?

百般思念 提交于 2019-12-06 04:57:55
I've set up a hello world program just for testing my riscv32-unknown-elf toolchain, spike , pk etc. Though I managed to get the hello world printed using spike --isa=RV32 pk hello.elf , I found out that if I added the -d flag for debugging, I was given following instructions (a section of the whole): core 0: 0x0000000000001000 (0x7ffff297) auipc t0, 0x7ffff : core 0: 0x0000000000001004 (0x00028067) jr t0 : core 0: 0xffffffff80000000 (0x1b00006f) j pc + 0x1b0 : core 0: 0xffffffff800001b0 (0x00000093) li ra, 0 : core 0: 0xffffffff800001b4 (0x00000113) li sp, 0 : core 0: 0xffffffff800001b8

Unable to get method SyntaxTree.ParseFile in new nuget of Roslyn?

感情迁移 提交于 2019-12-06 04:51:50
问题 I have installed nuget for Roslyn with Install-Package Microsoft.CodeAnalysis -Pre but i'm still unable to get the method SyntaxTree.ParseFile as I want to pass code in a .cs file Any clue about why is it so ? How can I pass file here? 回答1: The API simply changed a little bit, one way to do it is : var path = @"C:\...\SomeFile.cs"; using(var stream = File.OpenRead(path)) { var syntaxTree = CSharpSyntaxTree.ParseText(SourceText.From(stream), path: path); } 来源: https://stackoverflow.com

Compiling c code programatically in linux terminal gcc

杀马特。学长 韩版系。学妹 提交于 2019-12-06 04:38:06
I'm writing a c program on Linux that writes text into a file. I'm having trouble where i'M trying to use system("gcc fileName.c") to compile the new document i created into an executable. The file is getting the following input: char Msg[100] = {"#include <stdio.h>\nint main();\n\nint main()\n{\n\n\treturn 0;\n}"}; clearly it has a main() function and yet it still gives me the following wall of error: /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info):

check if nvcc is available in makefile

我怕爱的太早我们不能终老 提交于 2019-12-06 04:30:42
I have two versions of a function in an application, one implemented in CUDA and the other in standard C. They're in separate files, let's say cudafunc.h and func.h (the implementations are in cudafunc.cu and func.c ). I'd like to offer two options when compiling the application. If the person has nvcc installed, it'll compile the cudafunc.h . Otherwise, it'll compile func.h . Is there anyway to check if a machine has nvcc installed in the makefile and thus adjust the compiler accordingly? Thanks a bunch, This should work, included in your Makefile: NVCC_RESULT := $(shell which nvcc 2> NULL)

Why does including -fPIC to compile a static library cause a segmentation fault at run time?

不想你离开。 提交于 2019-12-06 04:19:27
I'm compiling C++ static library with g++ and using the -fPIC option. I must use the -fPIC option because eventually this library will be linked with other static libraries to form a dynamic library. When I test the static library locally, it works completely fine when I don't include the -fPIC option. But as soon as I compile the library with -fPIC, I receive a segmentation fault error at run-time when calling one of the functions. What reasons could including -fPIC to compile a static library cause a segementation fault at run-time? A dynamic library is supposed to be loaded at run-time and

Linking partially static and partially dynamic in GCC

给你一囗甜甜゛ 提交于 2019-12-06 04:03:08
I'm trying to compile a very simple (as simple as hello world) C program using both dynamic and static linking with GCC. I want to know how to do this in general, so my minimal test example is simply trying to link libc as static and libm dynamically. I've come across at least the following other questions regarding the same topic: GCC: static linking only some libraries Static link of shared library function in gcc Some of the answers therein suggest things such as using -Wl,-Bstatic and -Wl,-Bdynamic to specify which libraries are respectively static and dynamic. Also suggested is among

How can I safely compile a Perl 5.12 module for Perl 5.8.9?

做~自己de王妃 提交于 2019-12-06 03:56:32
I want to install File::Fetch, which is a core module in Perl 5.12, in my Perl 5.8.9. In general, I want to compile and install future-dated modules in my back-dated Perl because I cannot upgrade my Perl. So I downloaded the module and also its dependencies. It's quite painful following the dependency tree but I'm more concerned about the fact that some of them are core modules. If I install these, my Perl 5.8.9 core will have patches from 5.12. My question is how I can know whether I can safely install the future-dated modules, especially the core modules. Is there a tutorial for this purpose

Compile PHP Error with freetype

荒凉一梦 提交于 2019-12-06 03:04:34
问题 I configured PHP myself, included all of the libraries I needed... but then realized I forgot the freetype library. So I went back to my php-5.3.2 directory and ran ./configure '--with-free-type=/usr/local/lib' PHP did the configure fine, no errors. But when I run make: collect2: ld returned 1 exit status make: *** [sapi/cgi/php-cgi] Error 1 Something that comes up frequently: /php-5.3.2/ext/libxml/libxml.c:336: undefined reference to `ts_resource_ex' /php-5.3.2/ext/sqlite3/sqlite3.c:663:

pipeline echo to gcc?

社会主义新天地 提交于 2019-12-06 02:59:56
问题 To call printf("Hello!"); in C from terminal I use echo '#include<stdio.h> void main() { printf("Hello!"); }' > foo.c and then call gcc foo.c to make the output. Unfortunately, the pipelining echo '#include<stdio.h> void main() { printf("Hello!"); }' | gcc fails complaining for no input file. Ultimately, I want to have a script where I can compile a C command from terminal with ./script [command] . Any suggestion would be appreciated. 回答1: Yes, but you have to specify the language using the

Does #import <UIKit/UIKit.h> on pch slow down the compile time?

那年仲夏 提交于 2019-12-06 02:56:05
问题 I was reading this post about imports and I had one question. Does the #import that comes in the prefix.pch file by default slow down the compile time? Should I remove it and import only when necessary? #ifdef __OBJC__ #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #endif 回答1: No. It actually improves the compilation speed. This is a nice tutorial that actually clears all the confusion over use of #import statements and .PCH files. Also it tells you in detail about something new