Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  SVN::S4
  Voneline
  WFH
General Info
  Papers

Issue #1486

Issue Linking on Mac OS

Added by Joseph Shaker 19 days ago. Updated 12 days ago.

Status:
NoFixNeeded
Priority:
Normal
Assignee:
-
Category:
-
% Done:

0%


Description

Hi all, I;ve used verilator for a while on Linux and have had no problems, however I wanted to start running it on my mac and have been struggling. I am currently trying to compile and test a module I've written. Verilator compiles to C++ fine, then when I run make -f Vaudio_test.mk, and then make all, g++ complains
 ld: warning: ignoring file Vaudio_test__ALL.a, file was built for archive which is not the architecture being linked (x86_64): Vaudio_test__ALL.a 
Please find attached the Makefile I generated, the ones that verilator generated, and the archive file generated

Makefile (225 Bytes) Joseph Shaker, 08/01/2019 02:25 PM

Vaudio_test_classes.mk (1.29 KB) Joseph Shaker, 08/01/2019 02:25 PM

Vaudio_test__ALL.a (38.2 KB) Joseph Shaker, 08/01/2019 02:25 PM

Vaudio_test.mk (1.45 KB) Joseph Shaker, 08/01/2019 02:26 PM

History

#1 Updated by Wilson Snyder 18 days ago

  • Status changed from New to AskedReporter

Looks like you used a GCC or set of GCC -march flags to make the .a (this might have come vis the GCC you used to configure verilator), and a different set of flags for your larger program.

#2 Updated by Wilson Snyder 18 days ago

BTW it might help to rely on Verilator to do it all....

verilator {all-flags-used-previously} --exe audio_test.cpp

then make will also build and link your CPP file.

#3 Updated by Joseph Shaker 18 days ago

Wilson Snyder wrote:

Looks like you used a GCC or set of GCC -march flags to make the .a (this might have come vis the GCC you used to configure verilator), and a different set of flags for your larger program.

I installed verilator using "brew" which is a macos package manager. Do you think that compiling verilator from scratch oon my machine would help keep the configurations consistent?

Verilator made the .mk file that made the .a file so I am not exactly sure how verilator picks the archetecture to build for. There were a few flags in the man page that were highlighted as deprecated, such as "VM_SC_TARGET_ARCH". When I generated the .mk file it originally was said to "linux", and I manually changed it to darwin but that did not help

#4 Updated by Wilson Snyder 18 days ago

You're not using SystemC so VM_SC_* won't matter.

Look at what commands make prints when you build the archive then your application. See if the path to GCC is the same and the compiler flags are the same, if not try running the commands yourself using the same gcc/flags.

#5 Updated by Joseph Shaker 18 days ago

Wilson Snyder wrote:

You're not using SystemC so VM_SC_* won't matter.

Look at what commands make prints when you build the archive then your application. See if the path to GCC is the same and the compiler flags are the same, if not try running the commands yourself using the same gcc/flags.

I noticed that my makefile is by default using clang++. I reran the commands that script was running manually using g++, and then tried linking and still had problems. I also tried building the default way and then compiling my final program with clang++ All gave the same final error

#6 Updated by Joseph Shaker 18 days ago

Joseph Shaker wrote:

Wilson Snyder wrote:

You're not using SystemC so VM_SC_* won't matter.

Look at what commands make prints when you build the archive then your application. See if the path to GCC is the same and the compiler flags are the same, if not try running the commands yourself using the same gcc/flags.

I noticed that my makefile is by default using clang++. I reran the commands that script was running manually using g++, and then tried linking and still had problems. I also tried building the default way and then compiling my final program with clang++ All gave the same final error

Using the verilator command with --exe in the end and then invoking the auto generated makefile led to the same errors

#7 Updated by Joseph Shaker 18 days ago

Here are the files in my directory. All the intermediate object files seem to be built for the correct archetecture ...

https://pastebin.com/95ufpM15

#8 Updated by Wilson Snyder 17 days ago

Maybe your "ar" is broken somehow? Try making a single "g++" command, where the file you specify has an #include of every .cpp file that needs to be compiled.

Verilator has a tool to help

verilator_includer  audio_test.cpp Vaudio_test.cpp Vaudio_test__ALLcls.cpp Vaudio_test__ALLsup.cpp Vaudio_test__Syms.cpp Vaudio_test__Trace.cpp Vaudio_test__Trace__Slow.cpp   > all.cpp
g++ {flags} all.cpp -o all

#9 Updated by Joseph Shaker 13 days ago

Wilson Snyder wrote:

Maybe your "ar" is broken somehow? Try making a single "g++" command, where the file you specify has an #include of every .cpp file that needs to be compiled.

Verilator has a tool to help

verilator_includer audio_test.cpp Vaudio_test.cpp Vaudio_test__ALLcls.cpp Vaudio_test__ALLsup.cpp Vaudio_test__Syms.cpp Vaudio_test__Trace.cpp Vaudio_test__Trace__Slow.cpp > all.cpp g++ {flags} all.cpp -o all

Hi, Sorry for the delay!

Neither my linux box nor my mac have
 verilog includer 
Nonethess, I tried to compile everything manually
 g++ audio_test.cpp Vaudio_test.cpp Vaudio_test__ALLcls.cpp Vaudio_test__ALLsup.cpp Vaudio_test__Syms.cpp Vaudio_test__Trace.cpp  -I$VINC $VINC/verilated.cpp $VINC/verilated_vcd_c.cpp 

with VINC set correctly.

I got tons of ld errors for duplicate symbols, which I guess is better than my ar problem but still not ideal.


duplicate symbol __ZN17Vaudio_test__SymsC2EP11Vaudio_testPKc in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLsup-124ac0.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__Syms-f4f05e.o
duplicate symbol __ZN17Vaudio_test__SymsC1EP11Vaudio_testPKc in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLsup-124ac0.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__Syms-f4f05e.o
duplicate symbol __ZN11Vaudio_test15_ctor_var_resetEv in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_test4evalEv in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_test5finalEv in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_testD2Ev in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_testD1Ev in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_test15_change_requestEP17Vaudio_test__Syms in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_test18_eval_initial_loopEP17Vaudio_test__Syms in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_test5_evalEP17Vaudio_test__Syms in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_test13_eval_initialEP17Vaudio_test__Syms in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_test12_eval_settleEP17Vaudio_test__Syms in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_test16_initial__TOP__4EP17Vaudio_test__Syms in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_test16_sequent__TOP__3EP17Vaudio_test__Syms in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_test15_settle__TOP__2EP17Vaudio_test__Syms in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_test14_combo__TOP__1EP17Vaudio_test__Syms in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_testC2EPKc in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_testC1EPKc in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_test12__VconfigureEP17Vaudio_test__Symsb in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test-fda4d1.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLcls-fbfbce.o
duplicate symbol __ZN11Vaudio_test8traceChgEP12VerilatedVcdPvj in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLsup-124ac0.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__Trace-c0b37c.o
duplicate symbol __ZN11Vaudio_test12traceChgThisEP17Vaudio_test__SymsP12VerilatedVcdj in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLsup-124ac0.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__Trace-c0b37c.o
duplicate symbol __ZN11Vaudio_test15traceChgThis__4EP17Vaudio_test__SymsP12VerilatedVcdj in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLsup-124ac0.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__Trace-c0b37c.o
duplicate symbol __ZN11Vaudio_test15traceChgThis__3EP17Vaudio_test__SymsP12VerilatedVcdj in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLsup-124ac0.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__Trace-c0b37c.o
duplicate symbol __ZN11Vaudio_test15traceChgThis__2EP17Vaudio_test__SymsP12VerilatedVcdj in:
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__ALLsup-124ac0.o
    /var/folders/wz/97l6sb4x54jd3tsvy3y08qd00000gp/T/Vaudio_test__Trace-c0b37c.o
ld: 24 duplicate symbols for architecture x86_64

#10 Updated by Wilson Snyder 12 days ago

The _All files include some of the other files you already have listed, look at the contents to determine which to include and/or diagnose the error messages.

#11 Updated by Joseph Shaker 12 days ago

Wilson Snyder wrote:

The _All files include some of the other files you already have listed, look at the contents to determine which to include and/or diagnose the error messages.

Ok, so I finally got this command to work!

g++ audio_test.cpp Vaudio_test__ALLcls.cpp Vaudio_test__ALLsup.cpp  -I$VINC $VINC/verilated.cpp $VINC/verilated_vcd_c.cpp

I also solved the problem with ar

I used brew to install binutils, which put the gnu version of a in

/usr/local/bin/ar
. The MACOS default ar lives in
/usr/bin/ar
.

When I invoke the mac version explicitly the archive works correctly, so this is possible an error in brew's packaging of gnu binutils.

Would there be a way for now for me to point verilator to a specific version or ar, or make the mac one take precedence?

I appreciate the help!

#12 Updated by Wilson Snyder 12 days ago

  • Status changed from AskedReporter to NoFixNeeded

Glad you solved it.

Verilator uses the make-standard AR variable, so "make AR=foo ..."

Also available in: Atom