Bitcoin Forum
May 04, 2024, 02:53:10 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [PATCH] build without UPNP  (Read 2947 times)
Tril (OP)
Full Member
***
Offline Offline

Activity: 213
Merit: 100


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
1714834390
Hero Member
*
Offline Offline

Posts: 1714834390

View Profile Personal Message (Offline)

Ignore
1714834390
Reply with quote  #2

1714834390
Report to moderator
1714834390
Hero Member
*
Offline Offline

Posts: 1714834390

View Profile Personal Message (Offline)

Ignore
1714834390
Reply with quote  #2

1714834390
Report to moderator
"There should not be any signed int. If you've found a signed int somewhere, please tell me (within the next 25 years please) and I'll change it to unsigned int." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714834390
Hero Member
*
Offline Offline

Posts: 1714834390

View Profile Personal Message (Offline)

Ignore
1714834390
Reply with quote  #2

1714834390
Report to moderator
1714834390
Hero Member
*
Offline Offline

Posts: 1714834390

View Profile Personal Message (Offline)

Ignore
1714834390
Reply with quote  #2

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

Activity: 566
Merit: 500


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
trentzb
Sr. Member
****
Offline Offline

Activity: 406
Merit: 251


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: 755
Merit: 515


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 Core, rust-lightning, http://bitcoinfibre.org etc.
PGP ID: 07DF 3E57 A548 CCFB 7530  7091 89BB B866 3E2E65CE
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!