Good evening
I apologize beforehand, I am French. It has been several days since I look for solutions concerning NASM and mAC bone, but I find only the English forums..
I am thus on mac bone and I would like to compile a program assembler
For exemple :
In class, to I was told that to compile under Linux, it was necessary to make:
And have librairies : iut.int , libIUT.a
So , when i do
in terminal , it's said :
So , i try to compile :
Can you help me ? Thanxs you so much ..
I apologize beforehand, I am French. It has been several days since I look for solutions concerning NASM and mAC bone, but I find only the English forums..
I am thus on mac bone and I would like to compile a program assembler
For exemple :
Code:
%include "iut.inc"
segment .text
global start
start:
mov eax, msg_Accueil
call write_string
mov eax,msg_Nombre
call write_string
call read_int
mov ebx,eax
mov eax,msg_Base
call write_string
call read_int
mov ecx,eax
call SousProg ;APPEL DU SOUS PROGRAMME
mov edx,eax
mov eax, msgResultat
call write_string
mov eax, ebx
call write_int
mov eax, msgResultat1
call write_string
mov eax, ecx
call write_int
mov eax, msgResultat2
call write_string
mov eax, edx
call write_int
ret
SousProg:
;EMPILEMENT DES REGISTRES UTILISES
push ebx
push ecx
;TRAITEMENT
mov ebx,1312
mov ecx,5476
mov eax,45
;FIN DU TRAITEMENT
;J'AI MODIFIE LA VALEUR DE ebx ET DE ecx POUR LES BESOINS DU TRAITEMENT
;RESTAURATION DES REGISTRES UTILISES
pop ecx
pop ebx
ret
segment .data
msg_Accueil: db "Convertion d'un nombre en base b en decimal",10,0
msg_Nombre: db "Saissez le nombre a convertir",10,0
msg_Base: db "Saissez la base du nombre",10,0
msgResultat: db 10,"le resultat de la convertion du nombre ",0
msgResultat1 db " en base ",0
msgResultat2 db " en decimal est ",0
In class, to I was told that to compile under Linux, it was necessary to make:
Code:
nasm f elf exemple.asm
gcc o exemple exemple.o L. lIUT -lncurses -lpanel
And have librairies : iut.int , libIUT.a
So , when i do
Code:
nasm -v
Code:
NASM version 0.98.40 (Apple Computer, Inc. build 11) compiled on Aug 4 2012
So , i try to compile :
Code:
MacBook-Pro-de-Rebouh:Assembleur rebouhaymen$ nasm -f elf Ex_SousP_Pile.asm
MacBook-Pro-de-Rebouh:Assembleur rebouhaymen$ gcc -o Ex_SousP_Pile Ex_SousP_Pile.o -L. -lIUT -lncurses -lpanel
ld: warning: ld: warning: ignoring file ./libIUT.a, file was built for archive which is not the architecture being linked (x86_64): ./libIUT.aignoring file Ex_SousP_Pile.o, file was built for unsupported file format ( 0x7f 0x45 0x4c 0x46 0x 1 0x 1 0x 1 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 ) which is not the architecture being linked (x86_64): Ex_SousP_Pile.o
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
MacBook-Pro-de-Rebouh:Assembleur rebouhaymen$
Can you help me ? Thanxs you so much ..