HAL Driver. Undefined reference to hal_export_func
- AndrewHsasku
 - Offline
 - Junior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 23
 - Thank you received: 0
 
			
	
						05 Dec 2017 22:43		 -  05 Dec 2017 22:43		#102708
		by AndrewHsasku
	
	
		
			
	
	
			 		
													
	
				HAL Driver. Undefined reference to hal_export_func was created by AndrewHsasku			
			
				I would compile this example code: github.com/LinuxCNC/linuxcnc/blob/master...ivers/hal_skeleton.c
All my attempts finishes with error: In function 'rtapi_app_main' Undefined reference to hal_export_func
No idea whats is a reason. Cant find another example code or valid makefile example. No idea what is this error caused by.
					All my attempts finishes with error: In function 'rtapi_app_main' Undefined reference to hal_export_func
No idea whats is a reason. Cant find another example code or valid makefile example. No idea what is this error caused by.
		Last edit: 05 Dec 2017 22:43  by AndrewHsasku.			
			Please Log in or Create an account to join the conversation.
- rodw
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						06 Dec 2017 00:28				#102713
		by rodw
	
	
		
			
	
			
			 		
													
	
				Replied by rodw on topic HAL Driver. Undefined reference to hal_export_func			
			
				The error appears to be coming from line 177.
At a guess, I would say there is a missing header file (.h) or the library containing the function is not being linked in.
Sorry, I have not dug into the Linuxcnc internals to that level to be of real help.
					At a guess, I would say there is a missing header file (.h) or the library containing the function is not being linked in.
Sorry, I have not dug into the Linuxcnc internals to that level to be of real help.
Please Log in or Create an account to join the conversation.
- ozzyrob
 - 
				
											 - Visitor
 - 
				
			 
			
	
						06 Dec 2017 02:42				#102716
		by ozzyrob
	
	
		
			
	
			
			 		
													
	
				Replied by ozzyrob on topic HAL Driver. Undefined reference to hal_export_func			
			
				How are you compiling this ? What process are you using ?			
					Please Log in or Create an account to join the conversation.
- AndrewHsasku
 - Offline
 - Junior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 23
 - Thank you received: 0
 
			
	
						06 Dec 2017 12:20				#102717
		by AndrewHsasku
	
	
		
			
							
					
	
			
			 		
													
	
				Replied by AndrewHsasku on topic HAL Driver. Undefined reference to hal_export_func			
			gcc -Os -g -I. -I/usr/realtime-3.4-9-rtai-686-pae/include -I. -I/usr/realtime-3.4-9-rtai-686-pae/include -I/usr/include/i386-linux-gnu -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fno-math-errno -funsafe-math-optimizations -fno-rounding-math -fno-signaling-nans -fcx-limited-range -mhard-float -DRTAI=3 -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/usr/include/linuxcnc -Wframe-larger-than=2560 -URTAPI -U__MODULE__ -DULAPI -Os -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include     -c -o driver.o driver.cgcc -o driver driver.o -Wl,-rpath,/lib -L/lib -llinuxcnchal -lglib-2.0Please Log in or Create an account to join the conversation.
- rodw
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						06 Dec 2017 12:47				#102718
		by rodw
	
	
		
			
	
			
			 		
													
	
				Replied by rodw on topic HAL Driver. Undefined reference to hal_export_func			
			
				So what file is this procedure in?
Are you compiling it?
Are you linking it?
					hal_export_funcAre you compiling it?
Are you linking it?
Please Log in or Create an account to join the conversation.
- andypugh
 - 
				
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 19678
 - Thank you received: 4559
 
			
	
						06 Dec 2017 13:57				#102719
		by andypugh
	
	
		
			
	
			
			 		
													
	
				Replied by andypugh on topic HAL Driver. Undefined reference to hal_export_func			
			
				The function is defined in hal.h
github.com/LinuxCNC/linuxcnc/blob/2.7/src/hal/hal.h#L592
And is wrapped in an #ifdef RTAPI.
So, I suspect that you might not be running a realtime kernel, or that the environment is not correctly configured.
Can you compile the module with "halcompile" ?
					github.com/LinuxCNC/linuxcnc/blob/2.7/src/hal/hal.h#L592
And is wrapped in an #ifdef RTAPI.
So, I suspect that you might not be running a realtime kernel, or that the environment is not correctly configured.
Can you compile the module with "halcompile" ?
Please Log in or Create an account to join the conversation.
- AndrewHsasku
 - Offline
 - Junior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 23
 - Thank you received: 0
 
			
	
						06 Dec 2017 19:59		 -  10 Dec 2017 02:17		#102730
		by AndrewHsasku
	
	
		
			
	
	
			 		
													
	
				Replied by AndrewHsasku on topic HAL Driver. Undefined reference to hal_export_func			
			
				You got a point: RTAPI is not defined (#ifndef RTAPI executes).
Working on o pure copy of linuxcnc-2.7-wheezy (linuxcnc-dev is installed) installed on VirtualBoxVM.
No idea how to use halcompile:prints some trivial errors like stdlib.h: No such file or directory
EDIT:
After long tries, I just stopped using anything that caused errors and succeeded in compiling with halcompile.
More info and problems in next topics.
					Working on o pure copy of linuxcnc-2.7-wheezy (linuxcnc-dev is installed) installed on VirtualBoxVM.
a@debian:~/Desktop/driver$ uname -a
Linux debian 3.4-9-rtai-686-pae #1 SMP PREEMPT Debian 3.4.55-4linuxcnc i686 GNU/LinuxNo idea how to use halcompile:
halcompile --compile driver.cEDIT:
After long tries, I just stopped using anything that caused errors and succeeded in compiling with halcompile.
More info and problems in next topics.
		Last edit: 10 Dec 2017 02:17  by AndrewHsasku.			
			Please Log in or Create an account to join the conversation.
		Time to create page: 0.374 seconds