Bitcoin Forum
December 04, 2016, 08:17:12 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: [PATCH] build without UPNP  (Read 2557 times)
Tril
Full Member
***
Offline Offline

Activity: 212


View Profile
May 01, 2011, 05:55:54 AM
 #1

Building without UPNP didn't work (on Linux), so I made the below changes.
Two new #ifdef's, and you definitely can't define something :=0 and expect it to
act as if undefined (GNU make).

I can make this into a github pull request later if need be.

Index: net.cpp
===================================================================
--- net.cpp     (revision 251)
+++ net.cpp     (working copy)
@@ -887,6 +887,7 @@
     printf("ThreadMapPort exiting\n");
 }
 
+#ifdef USE_UPNP
 void ThreadMapPort2(void* parg)
 {
     printf("ThreadMapPort started\n");
@@ -947,6 +948,7 @@
         }
     }
 }
+#endif
 
 void MapPort(bool fMapPort)
 {
Index: makefile.unix
===================================================================
--- makefile.unix       (revision 251)
+++ makefile.unix       (working copy)
@@ -8,7 +8,7 @@
 
 WXLIBS=$(shell wx-config --libs)
 
-USE_UPNP:=0
+#USE_UPNP:=1
 
 DEFS=-DNOPCH -DFOURWAYSSE2 -DUSE_SSL
 
Index: db.cpp
===================================================================
--- db.cpp      (revision 251)
+++ db.cpp      (working copy)
@@ -807,8 +807,10 @@
     printf("fMinimizeOnClose = %d\n", fMinimizeOnClose);
     printf("fUseProxy = %d\n", fUseProxy);
     printf("addrProxy = %s\n", addrProxy.ToString().c_str());
+#ifdef USE_UPNP
     if (fHaveUPnP)
         printf("fUseUPnP = %d\n", fUseUPnP);
+#endif
 
 
     // Upgrade
1480839432
Hero Member
*
Offline Offline

Posts: 1480839432

View Profile Personal Message (Offline)

Ignore
1480839432
Reply with quote  #2

1480839432
Report to moderator
1480839432
Hero Member
*
Offline Offline

Posts: 1480839432

View Profile Personal Message (Offline)

Ignore
1480839432
Reply with quote  #2

1480839432
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480839432
Hero Member
*
Offline Offline

Posts: 1480839432

View Profile Personal Message (Offline)

Ignore
1480839432
Reply with quote  #2

1480839432
Report to moderator
kseistrup
Hero Member
*****
Offline Offline

Activity: 565


Unselfish actions pay back better


View Profile WWW
May 01, 2011, 06:49:29 AM
 #2

Building without UPNP didn't work (on Linux)

All I did was commenting out the USE_UPNP stanzas in the makefile and then adding a -UUSE_UPNP to the DEFS variable:

Code:

--- makefile.unix 2011-05-01 08:46:17.405173473 +0200
+++ makefile.linux 2011-05-01 08:47:22.833923365 +0200
@@ -8,9 +8,9 @@
 
 WXLIBS=$(shell wx-config --libs)
 
-USE_UPNP:=0
+#USE_UPNP:=0
 
-DEFS=-DNOPCH -DFOURWAYSSE2 -DUSE_SSL
+DEFS=-DNOPCH -DFOURWAYSSE2 -DUSE_SSL -UUSE_UPNP
 
 # for boost 1.37, add -mt to the boost libraries
 LIBS= \
@@ -23,10 +23,10 @@
    -l ssl \
    -l crypto
 
-ifdef USE_UPNP
- LIBS += -l miniupnpc
- DEFS += -DUSE_UPNP=$(USE_UPNP)
-endif
+#ifdef USE_UPNP
+# LIBS += -l miniupnpc
+# DEFS += -DUSE_UPNP=$(USE_UPNP)
+#endif
 
 LIBS+= \
  -Wl,-Bdynamic \

Cheers,

Klaus Alexander Seistrup
http://about.me/kseistrup
trentzb
Sr. Member
****
Offline Offline

Activity: 406


View Profile
May 01, 2011, 07:08:54 AM
 #3

Yea that bit me too. I had also thought that USE_UPNP in the Makefile was compile time not run time option. To build without just comment it in the Makefile. I would have thought that a compile time def would not be used for a run time option. But I am not a programmer so...
Matt Corallo
Hero Member
*****
expert
Offline Offline

Activity: 751


View Profile
May 01, 2011, 09:25:13 AM
 #4

Building without UPNP didn't work (on Linux), so I made the below changes.
Two new #ifdef's, and you definitely can't define something :=0 and expect it to
act as if undefined (GNU make).
Actually you can.  The intended way to build bitcoin without UPnP support is make -f makefile.unix USE_UPNP=
That will successfully build bitcoin without UPnP support and without miniupnpc installed.

Bitcoin Ubuntu PPA maintainer - donate to me personally: 1JBMattRztKDF2KRS3vhjJXA7h47NEsn2c
http://bitcoinrelaynetwork.org maintainer
PGP ID: 07DF 3E57 A548 CCFB 7530  7091 89BB B866 3E2E65CE
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!