Re: [edk2] UnixPkg build problem on ubuntu/Maverick

Subject: Re: [edk2] UnixPkg build problem on ubuntu/Maverick

From: Andrew Fish <afish@apple.com>

To: edk2-devel@lists.sourceforge.net

Date: 2011-03-05 03:45:16

Forgot to mention....

For X64 the SEC is a POSIX app with the Unix ABI and all the other modules are EFI ABI. There is gasket code that switches back and forth between the calling convention. To make all this possible the SEC overrides the compiler flags to build a native OS application. 

If I had to guess your issue is in :
https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/UnixPkg/Sec/SecMain.inf

[BuildOptions]
   ...
   GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/SecMain -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/crt1.o /usr/lib/crti.o -L/usr/X11R6/lib -lXext -lX11 /usr/lib/crtn.o
   GCC:*_*_X64_CC_FLAGS == -m64 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
   GCC:*_*_X64_PP_FLAGS == -m64 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
   GCC:*_*_X64_ASM_FLAGS == -m64 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h

If your problem is linking the SEC this is where to look.  

Note on Xcode I ended up moving over to using gcc to link as some of the frame work stuff moved about from OS release to OS release and gcc, being a wrapper for the real compiler know where it was. 

For a quick fix you can probably do a gcc -v and make sure the *_*_X64_DLINK_FLAGS  match.

Andrew Fish





On Mar 4, 2011, at 7:33 PM, Andrew Fish wrote:

John,

Sorry about that. I did my testing on Mac OS X.  I did not realize at the time, but the network driver is using BSD specific network abstractions. We usually fix this by adding  #ifdef __APPLE__ around the non Linux bits.  We can probably do that in this case. We can probably stub out the networking driver the same way. 

Conceptually some one could port the network driver to Linux and BSD Packet Filter is a good example to start with.

I'm not a Linux gcc expert, but I've ported the edk2 code to lots of compilers if you can post the linker errors I may be able to give you some advice on what the issue is and how to fix it.

Andrew Fish

PS I don't have time to check in the fixes tonight, but I'll see if I can do that in the next few days. I would appreciate it you would test it for me. 


On Mar 4, 2011, at 7:02 PM, John Kearney wrote:

I'm sorry if this is the incorrect mailing list for this problem.

I recently updated to the latest trunk of the edk2 sources.
However the build now fails with the following error.

/home/dethrophes/src/edk2/UnixPkg/Include/Common/UnixInclude.h:65: fatal error: net/if_dl.h: No such file or directory
compilation terminated.

doing a quick check shows that these headers were added by andrewfish. 

11106 andrewfish #include <net/if.h>
 11106 andrewfish #include <net/if_dl.h>
 11106 andrewfish #include <ifaddrs.h>
 11106 andrewfish #include <net/bpf.h>
11106 andrewfish #include <net/if.h> 
11106 andrewfish #include <net/if_dl.h>
 
11106 andrewfish #include <ifaddrs.h>
 
11106 andrewfish #include <net/bpf.h>
 

 However if_dh.h is actually a BSD header. So I'm wondering what is the prescribed approach for linux/Ubuntu/Maverick.
 
my current workaround is to remove reference to UnixSnpDxe.inf in the UnixPkg.dsc, UnixPkg.fdf, UnixPkgX64.dsc, UnixPkgX64.fdf
and commenting out  
 
//#include <net/if_dl.h> 
//#include <net/bpf.h>
in  UnixInclude.h

which lets me build on a 32bit system, however I still have weird link errors on a X64 build system using the native gcc compiler.


 
  

NEU: FreePhone - kostenlos mobil telefonieren und surfen!    
Jetzt informieren: http://produkte.web.de/go/webdefreephone
------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel