Modelsim, Fatal: (vsim-3828) Could not link 'vsim_auto_compile.so on Manjaro Linux - gcc

I'm trying to compile a uvm project on my machine and I keep getting the following error message. I'm on Manajaro, I have multilib enabled on my system and I have followed the instructions on this page All the required dependencies are Installed.
I can start modelsim from commandline without any issues, but when I call this makefile, it always fails at the below line. Which makes me believe I might be missing something related to gcc, but I'm not sure what that is and googling this particular issue has yielded no results.
Compiling /tmp/cyberbemon#cyberbemon-x570aorusmaster_dpi_77438/linux_gcc-5.3.0/exportwrapper.c
# ** Fatal: ** Fatal: (vsim-3828) Could not link 'vsim_auto_compile.so': cmd = '/opt/modeltech/gcc-5.3.0-linux/bin/g++ -shared -fPIC -m32 -o "/tmp/cyberbemon#cyberbemon-x570aorusmaster_dpi_77438/linux_gcc-5.3.0/vsim_auto_compile.so" /home/cyberbemon/Development/uvm/final/tb_build/sub_system_tbs/pss_tb/sim/work/_dpi/auto_compile#/linux_gcc-5.3.0/*.o "/tmp/cyberbemon#cyberbemon-x570aorusmaster_dpi_77438/linux_gcc-5.3.0/exportwrapper.o" -Wl,-Bsymbolic '
# (vsim-50) A call to system(/opt/modeltech/gcc-5.3.0-linux/bin/g++ -shared -fPIC -m32 -o "/tmp/cyberbemon#cyberbemon-x570aorusmaster_dpi_77438/linux_gcc-5.3.0/vsim_auto_compile.so" /home/cyberbemon/Development/uvm/final/tb_build/sub_system_tbs/pss_tb/sim/work/_dpi/auto_compile#/linux_gcc-5.3.0/*.o "/tmp/cyberbemon#cyberbemon-x570aorusmaster_dpi_77438/linux_gcc-5.3.0/exportwrapper.o" -Wl,-Bsymbolic >'/tmp/questatmp.AFzKOV' 2>&1) returned error code '1'.
# The logfile contains the following messages:
# /lib/crti.o: file not recognized: File format not recognized
# collect2: error: ld returned 1 exit status

This issues was caused by Modelsim using a different gcc version, manually deleting all the gcc-..*-linux folders from modelsim directory forced it to use my system GCC and that has solved the issue.
This solution was suggested here
Instead of manually deleting it, you can re-run the installer and choose to remove the GCC components. You will get the same result.

Related

gcc compiler giving error because missing files for flags

I am trying to compile code for a course. I want to use the -Wall -pedantic and -std=c99 tag since those are used to check the code by the teachers. In a previous course where I had to do this I ran the code on a linux virtual boot provided by the teachers where everything was preinstalled to run the code. But since then I switched over my PC to linux from windows so I do not have those things installed. when running the following command in my terminal
gcc −std=c99 −Wall −pedantic myprogram.c
I get the following errors roughly translated to english.
gcc: error: -std=cgg: File or directory does not exist
gcc: error: -Wall: File or directory does not exist
gcc: error: -pedantic: File or directory does not exist
what do I have to install and how to make this working?

Sysroot is incorrect in Ninja when trying to build library

I'm trying to build Google's Skia library on Mac, but when I try running
ninja -C out/Static/
in order to build the library, it gives me this error (after many, many similar errors):
[14/1073] compile ../../src/gpu/GrBackendTextureImageGenerator.cpp
FAILED: obj/src/gpu/gpu.GrBackendTextureImageGenerator.o
c++ -MD -MF obj/src/gpu/gpu.GrBackendTextureImageGenerator.o.d -DNDEBUG -DSK_ASSUME_GL=1 -DSK_ENABLE_API_AVAILABLE -DSK_GAMMA_APPLY_TO_A8 -DSKIA_IMPLEMENTATION=1 -DSK_GL -I../.. -Wno-attributes -fstrict-aliasing -fPIC -fvisibility=hidden -isysroot b\'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk\\n\' -O3 -Wno-sign-conversion -Wno-unused-parameter -std=c++17 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -c ../../src/gpu/GrBackendTextureImageGenerator.cpp -o obj/src/gpu/gpu.GrBackendTextureImageGenerator.o
clang: warning: no such sysroot directory: 'b'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk\n'' [-Wmissing-sysroot]
In file included from ../../src/gpu/GrBackendTextureImageGenerator.cpp:8:
In file included from ../../include/gpu/GrContext.h:11:
In file included from ../../include/core/SkMatrix.h:11:
In file included from ../../include/core/SkRect.h:11:
In file included from ../../include/core/SkPoint.h:11:
In file included from ../../include/core/SkMath.h:11:
../../include/core/SkTypes.h:26:18: fatal error: 'TargetConditionals.h' file not found
#include "TargetConditionals.h"
^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
It seems like the sysroot directory b'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk\n' is wrong, however "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk" does exist and "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/" has the file TargetConditionals.h.
I haven't used ninja before, but I tried looking in toolchain.ninja but could find no way to change the sysroot variable. I also reinstalled Xcode and Xcode command line tools, to no avail. Any help would be greatly appreciated!
I too struggled a lot. The solutions that I tried:
xcode-select --install for installing command line tools. But it used to say that command line tools are already installed.
Tried re-installing xcode to fix some linkage issue.
Tried a could of other solutions found on web.
Finally, what worked for me is by switching to python2. I had python2 and python3 installed. My path environment variable in .zshrc was giving precedence to python3. So, all internal scripts generated by ninja had python3 in precedence.
I temporarily removed python3, you can keep both but its precedence should be changed. Then regenerate build directory using gn. Then use ninja to build.
Note:
clang: warning: no such sysroot directory: 'b'/Applications/ : Here 'b' use to represent that string literal should be treated as byte literal in python3. So that could be the cause.

Is there a way to point to the correct gcc version?

First time post at Stackoverflow so thank you in advance. I am trying to install the r package called sm or any package that needs to be compiled. I truly would appreciate any guidance possible as this is preventing me from compiling r packages and RMarkdown files as well.
I receive an error message that appears to point to the incorrect version of gcc on my machine. I read a different post that said I needed to add the path to gcc to my .bash_profile so I amended it as so:
export PATH=/usr/local/bin:$PATH
PATH="$PATH:/usr/local/Cellar/gcc/9.1.0/:/usr/local/bin/"
export PATH
I receive this error message:
installing source package ‘sm’ ...
** package ‘sm’ successfully unpacked and MD5 sums checked
/usr/local/Cellar/gcc/8.2.0/bin/gcc-7 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c fgamma.c -o fgamma.o
** libs
/bin/sh: /usr/local/Cellar/gcc/8.2.0/bin/gcc-7: No such file or directory
make: *** [fgamma.o] Error 127
ERROR: compilation failed for package ‘sm’

Linking assembly .s with gcc errors

Hi i am getting several errors while linking my ".s" file together.
First of all, i compile the file via "gcc -S -m32 search.c" to
get my 32-bit assembler code.
Secondly i want to link the program back together by using "gcc -o
search search.s"
If i do this i get the following error: "Error: invalid instruction suffix for `push." I tried to use google to solve the problem and found a solution by using the --32 option flag. But this did not work either. The following error shows up as an result:
usr/bin/ld: i386 architecture of input file is incompatible with i386:x86-64 output. The third option by adding .code32 to the .s file, gcc let me compile it. Though by executing the console immediately says "core dumped".
So i really do not know what to do now. Anyone has an idea how i get things working?
Cheers
Assemble with --32, and link with -m32.
gcc -m32 -o search search.s
Without -m32, the output is going to be a 64-bit executable. The error message is due to the input object being a 32-bit object; you can't produce a 64-bit executable from 32-bit objects.

Error compiling x264 on Mac OS X

I'm trying to compile and install the x264 H.264/AVC encoder.
I've got gcc installed. But I get the 'No working C compiler found' error when I run:
./configure --enable-shared --enable-static
What can I do?
The config log said:
/bin/gcc conftest.c -Wall -I. -I$(SRCPATH) -falign-loops=16 -mdynamic-no-pic -o conftest
clang: error: unknown argument: '-falign-loops=16' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
I encountered the same error and found a simple solution here:
http://www.xin.at/x264/x264-guide-macosx-en.htm
Before actually being able to start the build we will however need to remove a GCC compiler flag from the configure script, that the newer LLVM+CLANG compiler will not be able to handle. For that, please open the file configure in your favorite text editor and look for the following spot:
darwin*)
SYS="MACOSX"
CFLAGS="$CFLAGS -falign-loops=16"
Replace that with the following, effectively removing the -falign-loops=16 option:
darwin*)
SYS="MACOSX"
CFLAGS="$CFLAGS"
After doing the above, libx264 builds just fine :)
The configure script is trying to set a compiler option -falign-loops=16 that the clang compiler (masquerading as gcc) declines to accept.
Either get (compile) your own real GCC and use that (I've done the compilation and installation; it's not very hard, though neither is it trivial), or work out how to stop the configure script from failing simply because it assumes that the -falign-loops=16 option must be supported by all versions of GCC. That is the sort of thing the configure script should be checking so that you don't run into that sort of failure. Ultimately, this is a bug in the configuration for this code.

Resources