COMPILING THE GEDA TOOLS ON MAC OS X 10.7.1

详解安装emac-25.3过程及问题解决 本人安装环境为centos7,其他linux版本也大同小异,可参考操作。 1. 下载emacs-25.3.tar.gz到centos,用tar –vxzf 命令解压; 2. 进入解压后的目录,命令:cd emacs-25.3/ 3. 使用./configure命令进行配置(可以设定路径); 由于我安装的是带图形界面的,在进行这一步时,报如下错误: configure: error: 阅读详情

http://web.me.com/aschweiz/Website/Blog/Entries/2011/10/6_Compiling_the_gEDA_Tools_on_Mac_OS_X_10.7.1.html

For a small private project which started about 4 years ago and which I then put aside, I needed to finalize a schematic diagram and PCB layout. However, I wasn’t very careful and had a quick finger when Mac OS X Lion came out, so several software packages stopped working then, and the gEDA tools were among them. So, I decided once again to re-build the tools and their dependencies from the source packages.

I know about MacPorts and fink, but prefer to configure and make the open source packages myself so that I have more control over what stuff is in which directories and what happens during the build. Hopefully, the information on this page will be useful for others and save them some time :-)


The OS and GCC version that I use:


% uname -a

Darwin Andreas-Schweizers-MacBook-Pro.local 11.1.0 Darwin Kernel Version 11.1.0: Tue Jul 26 16:07:11 PDT 2011; root:xnu-1699.22.81~1/RELEASE_X86_64 x86_64


% gcc --version

i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)


If you have a different environment (or even if you have the same), this may work or may not. From top to bottom, it should take about two to three hours. If it doesn’t work, leave a comment and I’ll try to help :-)


I’ll first give a list of all packages with links to where you can download them. To avoid issues when Apple update stuff in /usr/lib, I try to depend on as few things in /usr/lib as possible and provide all dependencies, so the list is very long. Click on each entry to get more information and download the package.


  1. 1.libtool-2.4 - shared libraries support script

  2. 2.zlib-1.2.5 - compression library

  3. 3.expat-2.0.1 - xml parser

  4. 4.libiconv-1.14 - character encoding conversion, unicode support

  5. 5.libxml2-2.7.8 - XML parser and toolkit

  6. 6.libunistring-0.9.3 - manipulating unicode strings

  7. 7.ncurses-5.9 - API for writing text user interfaces

  8. 8.gettext-0.18.1.1 - tools for multilingual messages

  9. 9.intltool-0.41.1 - string translations

  10. 10. libpng-1.5.4 - handling PNG images

  11. 11. gc-7.2alpha6 - garbage collector for C and C++

  12. 12. libffi-3.0.9 - foreign function interface library

  13. 13. readline-6.2 - command-line editing in applications

  14. 14. gmp-5.0.2 - multiple precision arithmetic library

  15. 15. dbus-1.4.14 - message bus system for interprocess communication

  16. 16. pkg-config-0.25 - metadata database for installed libraries

  17. 17. glib-2.29.18 - extensions for C

  18. 18. shared-mime-info-0.90 - common MIME types

  19. 19. desktop-file-utils-0.18 - desktop entries

  20. 20. fontconfig-2.8.0 - configuring and customizing font access

  21. 21. guile-1.8.8 - extension language

  22. 22. pixman-0.22.2 - pixel manipulation library

  23. 23. cairo-1.11.2 - 2D graphics library

  24. 24. freetype-2.4.6 - portable font engine

  25. 25. pango-1.29.3 - text layout and rendering

  26. 26. atk-2.1.91 - accessibility toolkit

  27. 27. jpeg-8c - JPEG image compression library

  28. 28. tiff-3.8.2 - TIFF image library and utilities

  29. 29. gdk-pixbuf-2.24.0 - GIMP drawing kit

  30. 30. gtk+-2.24.6 - GIMP toolkit for graphical user interfaces

  31. 31. gd-2.0.33 - graphics library for dynamic image generation

  32. 32. gtkglext-1.2.0 - OpenGL extension for GTK

  33. 33. gerbv-2.4.0 - ... :-)

  34. 34. pcb-20110918 - ... :-)

  35. 35. geda-gaf-1.7.1 - ... :-)


I like to have all these packages in /usr/local/geda, so I’ve first added /usr/local/geda/bin to the PATH variable in my .bash_profile, created a src subdirectory, downloaded and extracted all packages into /usr/local/geda/src.

Of course, one could put these anywhere (preferrably not into /usr ;-).


Next, I’ve set LDFLAGS=”-L/usr/local/geda/lib” and CPPFLAGS=”-I/usr/local/geda/include” so that the compiler and linker can find the header files and libraries.


For every package, I’ve created a build directory in src, for example build-libtool-2.4, and then done the configure / make / make install steps. For the configure step, I’ve always included the --prefix=/usr/local/geda:


% mkdir build-libtool-2.4

% cd build-libtool-2.4/

% ../libtool-2.4/configure --prefix=/usr/local/geda

## ----------------------- ##

## Configuring libtool 2.4 ##

## ----------------------- ##

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... ../libtool-2.4/libltdl/config/install-sh -c -d

checking for gawk... no

checking for mawk... no

...


This should work fine for most packages. With one exception (dbus), I’ve never run “make install” as root user because I have full access to /usr/local/geda. All packages will be compiled to x86_64 by default, which worked just fine for me. The following list contains information about those packages which need some “special treatment”.


  1. 2.zlib-1.2.5

Building zlib in a separate directory doesn’t word for me. Simply cd into zlib-1.2.5 and run ./configure --prefix=/usr/local/geda.


7. ncurses-5.9

This library needs the --with-shared configure switch, otherwise it will only generate static library files.


  1. 8.gettext-0.18.1.1

Generates a compiler error:

../../../gettext-0.18.1.1/gettext-tools/gnulib-lib/stpncpy.c:34: error: expected declaration specifiers or ‘...’ before numeric constant

To fix it, remove or comment-out the following three lines of preprocessor code in stpncpy.c (lines 27 to 29):

#ifndef weak_alias

# define __stpncpy stpncpy

#endif

Then the compilation will succeed.


  1. 11.gc-7.2alpha6

Fails with a compilation error:

../gc-7.2alpha6/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86_64.h:111: error: unsupported inline asm: input constraint with a matching output constraint of incompatible type!

Modify the x86_64.h at line 113, i.e. this statement:

  __asm__ __volatile__("xchgb %0, %1"

           : "=q"(oldval), "=m"(*addr)

           : "0"(0xff), "m"(*addr) : "memory");

Insert a typecast on the third line, like this:

           : "0"((unsigned int)0xff), "m"(*addr) : "memory");

Then it should compile correctly.

Credits to Jeremy Huddleston!

http://permalink.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/4590


  1. 13.readline-6.2

Has not been updated for Mac OS X 10.7 (darwin11), so open the support/shobj-conf and change darwin10 to darwin11 in the two places where it appears.


  1. 14.gmp-5.0.2

Has a small issue in acinclude.m4 which causes the test (which you should run with make check after building!) to hang indefinitely. Search for 1,2,3 in acinclude.m4 (should be on line 1944 in version 5.0.2) and change two lines of code:

extern const int foo[]; 

const int foo[] = {1,2,3};

Duplicate the brackets so that the code reads like this:

extern const int foo[[]]; 

const int foo[[]] = {1,2,3};

You need to do this before the configure step. The same in configure, but there, you put single brackets at line 26450 like this:

extern const int foo[];

const int foo[] = {1,2,3};

Credit to Jack Howarth for this one!

http://gmplib.org/list-archives/gmp-bugs/2011-July/002308.html


  1. 15.dbus-1.4.14

Wants to install something into /Library/LaunchAgents for which it needs extended permissions, so you need to run “make install” as root or with sudo. Don’t forget to do a sudo chown -R aschweiz /usr/local/geda afterwards to fix the ownership of the installed files. (Replace aschweiz with your user name.)


17. glib-2.29.18

Gives an error during configuration. Open a new Terminal window and run again the “export LDFLAGS=...” and “export CPPFLAGS=...” as described above.

configure: error: 

*** You must have either have gettext support in your C library, or use the

*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html)

In addition, comment-out or remove the lines 64 to 66 in glib/gconvert.c:

#if !defined(USE_LIBICONV_GNU) && defined (_LIBICONV_H)

#error GNU libiconv not in use but included iconv.h is from libiconv

#endif

Then it will fail a little bit later during “make”

../../glib-2.29.18/gio/gunixmounts.c: In function '_g_get_unix_mounts':

../../glib-2.29.18/gio/gunixmounts.c:608: warning: passing argument 1 of 'getmntinfo' from incompatible pointer type

../../glib-2.29.18/gio/gunixmounts.c:617: error: 'struct statvfs' has no member named 'f_mntonname'

Comment-out the statements in gio/gunixmounts.c starting at line 596 as illustrated here:

static GList *

_g_get_unix_mounts (void)

{

//#if defined(USE_STATFS)

  struct statfs *mntent = NULL;

//#elif defined(USE_STATVFS)

//  struct statvfs *mntent = NULL;

//#else

//  #error statfs juggling failed

//#endif

  int num_mounts, i;

And some more at line 620:

//#if defined(USE_STATFS)

      if (mntent[i].f_flags & MNT_RDONLY)

//#elif defined(USE_STATVFS)

//      if (mntent[i].f_flag & MNT_RDONLY)

//#endif

Then it should compile fine.


  1. 21.guile-1.8.8

This one took a while to figure out. Instructions are on my older blog entry:

Detecting_the_direction_of_stack_growth_in_C

I was lazy when trying all steps again and just replaced the two occurrences of the find_stack_direction function with my dirty version with the dummy local parameters. Anyway, this time, it worked perfectly fine!

Update (21.11.2011): 

gsch2pcb doesn’t work like this; I got the following error when running gnetlist (gsch2pcb hides the error): 

/srfi/srfi-1.scm:223:1: file:

"libguile-srfi-srfi-1-v-3", message: "file not found"

As a hotfix, I’ve modified the srfi-1.scm on line 223 to include the full path of the libguile-srfi-srfi-1-v-3, but I need to check this in more detail.


  1. 22.pixman-0.22.2 (added on 30.11.2011)

The configure script is no longer included in the downloadable .tar.gz and there are some issues to generate it (see the comments below), so I’ve attached the version which I had used as a temporary solution. Luckily I still found it on my harddisk.


  1. 25.pango-1.29.3

See my older blog entry: CoreText_vs._FontConfig

In short, you can download the patch file at the right side into /usr/local/geda/src, then cd into pango-1.29.3 and run the following command:

% patch -p1 -i ../pango-1.29.3-coretext.patch 

This fixes a caching issue in Pango which would lead to messed-up font sizes in gschem later.


  1. 32.gtkglext-1.2.0

I get an error about missing X development libraries:

configure: error: X development libraries not found

To fix it, export CPPFLAGS="-I/usr/local/geda/include -I/usr/X11/include" and export LDFLAGS="-L/usr/local/geda/lib -dylib_file/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib -L/usr/x11/lib".

Then, there would later be runtime errors about missing 

dyld: lazy symbol binding failed: Symbol not found: _GTK_WIDGET_NO_WINDOW

  Referenced from: /usr/local/geda/lib/libgtkglext-x11-1.0.0.dylib

  Expected in: flat namespace

To avoid these upfront, modify gtk/gtkglwidget.c:

  1. -replace all GTK_WIDGET_REALIZED with gtk_widget_get_realized (8 occurrences: lines 130, 157, 177, 197, 254, 435, 477, 504)

  2. -replace GTK_WIDGET_TOPLEVEL with gtk_widget_is_toplevel (a single occurrence, line 177)

  3. -replace !GTK_WIDGET_NO_WINDOW with gtk_widget_get_has_window (note the ! which you need to remove because the semantic of the new method is inverted! - there’s a single occurrence on line 254)


  1. 33.gerbv-2.4.0

It was worth the effort - the GUI is fantastic!



  1. 34.pcb-20110918

The CPPFLAGS and LDFLAGS need to be set as written above, in 32. In addition, add the following declaration in src/hid/common/hidgl.c for example at line 69:

typedef GLvoid (*_GLUfuncptr)(GLvoid);

Then it should work:



  1. 35.geda-gaf-1.7.1

Thanks to the Pango fix, there are no surprises here :-)

Well, it didn’t find my symbols, but that should be easy to fix:



As a final step, I backed up the entire /usr/local/geda on my file server and then removed /usr/local/geda/src to save some space on the SSD. The disk space usage:

  1. -bin - 8.2 MB

  2. -etc - 81 kB

  3. -include - 8.3 MB

  4. -lib - 75.9 MB

  5. -libexec - 484 kB

  6. -man - 630 kB

  7. -share - 88.7 MB

  8. -var - 936 kB

(Ah yes, and src is 1.13 GB...)


Leave me a comment if you have ideas for improvement or other feedback!

 

使用 MinGW 编译含 glut 的 opengl 程序 默认 mingw 不包含 glut 相关的头文件。下面一步步进行添加。 (1) 下载 glut 库。 http://www.xmission.com/~nate/glut.html (2) 将 glut.h 添加到 /path/to/mingw/include/GL/ 目录下。 这里使用 mingw 自带的 libglut32.a,所以只需要添加头文件就可以了。 (3) 设 阅读详情

相关推荐

小米手机Magisk解锁与Root完整指南:从Bootloader到模块管理

Android系统Root权限获取是设备深度定制的核心技术之一,其核心原理在于通过修改系统启动流程获取超级用户权限。Systemless Root技术通过动态挂载修改,在不触碰系统分区的前提下实现功能注入,既保证了系统完整性,又能绕过完整性检测。这一技术为设备带来了极高的可定制性,用户可以通过模块化方式增强系统功能、修改UI界面或启用隐藏特性。在小米手机生态中,由于官方提供了完整的Bootloader解锁通道,结合Magisk的无系统修改Root方案,使得安全可控的深度定制成为可能。本文聚焦于Bootloa

weixin_29164185的博客 335

在Ubuntu下编译Openoffice (2)

一些配置过程中需要做的事情,我遇到的呃,你不一定会遇到:注:(1)【FIX】是指解决的办法。【NOT FIX】是指对我没用的方法,但可能对你们有效1 安装PAMhttp://www.linuxfromscratch.org/blfs/view/svn/postlfs/linux-

爱技术爱生活—TAO 8744

electron windows设置镜像地址环境变量报错npm error `ELECTRON_MIRROR` is not a valid npm option

如果你是在使用某个特定的脚本或配置文件,请检查该文件中是否有不正确的配置项,并进行相应的修正。确保你遵循electron的官方安装指南,并且没有包含不必要的或错误的配置选项。如果问题依然存在,可以查看npm的官方文档或者相关社区获取更多帮助。

qq_36158551的博客 3325

Wine 编译安装「转载」

无

VT——csj 946

Comsol超声空化气泡仿真:从基础理论到工业应用实践

本文详细介绍了Comsol超声空化气泡仿真的基础理论及工业应用实践。通过解析超声空化现象、Comsol模型搭建流程及求解器优化技巧,帮助工程师掌握气泡仿真技术,提升超声波清洗和乳液制备等工业应用的效率与质量。

weixin_27966471的博客 253

Rockchip MPP解码H264实战:从文件到YUV的完整流程解析

本文详细解析了在Rockchip平台上使用MPP(Media Process Platform)硬件解码H264视频文件并输出YUV数据的完整流程。通过实战代码示例,深入讲解了MPP解码器的初始化、数据包投递、非阻塞模式下的双循环控制以及YUV帧的提取与保存等核心步骤,并提供了环境搭建、编译运行和常见问题排查指南,帮助开发者高效利用硬件加速进行视频处理。

life6的博客 479

facebook open platform的libfbml库在redhat下编译问题汇总

本文着重解决在编译libfbml中遇到的一些具体问题,所以具体的安装步骤一概省略。 我使用的linux环境是: Red Hat Enterprise Linux AS release 4 (Nahant Update 4) Linux version 2.6.9-42.0.10.ELsmp (brewbuilder@ls20-bc1-14.build.redhat.com) (gcc versi...

freeway2000 350

STM32 cubeMX配置串口重定向

这篇文章主要讲解什么是串口重定向,为什么要串口串口重定向。使用printf函数和上位机通信是非常的方便的。希望大家都能够掌握。

m0_49476241的博客 4573

Wine 安装使用问题集锦

安装wine出现的问题与解决 1、安装wine出错了(缺少文件) 安装wine 的 RPM包时候出现如下错误。 # rpm -ivh wine-xim-20030408-1.i386.rpm error: Failed dependencies: libsane.so.1 is needed by wine-xim-20030408-1 libXv.s...

weixin_34342578的博客 1885

Windows 下 OpenClaw(小龙虾) 安装全记录:从零到一的保姆级图文教程(持续更新中)

本文主要介绍了Windows 下 OpenClaw 安装全记录:从零到一的保姆级图文教程,希望能对学习使用OpenClaw 的同学们有所帮助。 文章目录 1. 背景 2. 实战教程 2.1 步骤一 安装Node.js 2.2 步骤二:安装并配置OpenClaw 2.3 步骤三:配置模型 2.4 步骤四:对话 3. 后续使用步骤

weixin_43178406的博客 16万+

向华为学习——解读158页 华为敏捷园区网技术解决方案【附全文阅读】

华为敏捷园区网解决方案通过策略随行和体验随身技术,满足移动办公场景下的网络需求。该方案采用敏捷交换机和防火墙自动执行策略配置,实现用户身份认证与业务策略的无缝衔接,且策略配置与IP地址解耦,简化了管理流程。相比传统技术,该方案有效解决了用户分级、QoS保障、无线接入等关键问题,确保用户在移动过程中获得一致的网络体验。

cdfunlove的博客 381

"library not found for - "解决办法

在我们编译的时候有时候会报这个错误 "library not found for - " 由于是我们在项目中使用了一些第三方的库,就比如在使用百度的静态库文件的时候,报出的这个错误。 当xcode在编译的时候却找不到这个库,从而导致如此。 所以我们要让xcode知道这个库文件在哪里,从而在编译的时候轻松的找到它。   解决办法: 获取 库文件所在的那个文件夹 路径,添加到 T

Leemin_ios的博客 1万+

【电源专题】案例:对比不同电池在不同电流下的电池放电曲线

无

一点硬件 2842

openssl unsupported inline asm 出错处理方法

md4_dgst.c: In function ‘md4_block_data_order’: md4_dgst.c:117: error: unsupported inline asm: input constraint with a matching output constraint of incompatible type! md4_dgst.c:118: error: unsuppo

ssihc0的专栏 3337

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

openGL另一个版本学习笔记

注:这次所有的学习来源于这个网站。http://nehe.gamedev.net/tutorial/creating_an_opengl_window_(win32)/13001/ 这个网站的站长是一个很值得尊敬的人!这里的笔记全是写上“转载”标签(尽管很多时候会提出自己的疑问,我不会完全照搬他的文字,因为这是我学习这个的笔记。) 我承诺:在我把这个学习完成之后,一定总结整理出一份完整的笔记,

liujingjun的专栏 1105

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

问题是缺失libgtkglext-x11-1.

我只是在liunx上运行下面两行代码。sudo apt-get autoremovesudo apt-get -f install结果再次运行,cpp写的有关于opencv 的代码。******************************错误如下:sr/bin/ld: warning: libgtkglext-x11-1.0.so.0, needed by /usr/local/lib/lib...

teleger的博客 5324

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Linux下./configure错误详解

说明: sudo apt-get install  package-name   更新你指定的软件包 sudo apt-get update                           获取更新列表 sudo apt-get dist-upgrade                  开始更新 ./configure的问题 错误: C compiler cannot cre...

weixin_33897722的博客 3841

安装emacs出现到依赖问题及解决方案

ubuntu软件中心emacs的版本是23,自己在网上下了最新版24.3,通过编译安装到时候遇到来很多依赖问题,下面将这些问题整理了出来: 1.执行./configure命令出现如下错误: configure: error: You seem to be running X, but no X development libraries were found.  You should i

给偶一针青霉素 3465

Wine编译安装问题?

1、./configure时出现Cannot build a 32-bit program, you need to install 32-bit development libraries. 解决:sudo apt-get install gcc-multilib g++-multilib 2、error: X 32-bit development files not found. Wine...

qq_26056015的博客 1万+

CentOS下使用rpm 几个常用命令

先看总结 安装软件的命令格式: rpm -ivh filename.rpm  升级软件的命令格式:  rpm -Uvh filename.rpm  卸载软件的命令格式:  rpm -e filename.rpm  查询软件描述信息的命令格式:  rpm -qpi filename.rpm  列出软件文件信息的命令格式:  rpm -qpl filename.rpm  查询文件属于哪个 RPM 的命...

RAYFUXK的专栏 1232

解决X-code 编译错误:library not found for -lcrt1.3.1.o

发现编译错误,报错信息是library not found for -lcrt1.3.1.o,注意,这篇文章就是针对解决-lcrt1.3.1.o库的,如果是library not found for - 其他的库,请点击这里 完美解决"library not found for - X"。如果是lcrt1.3.1.o库出错,那么你试一试在iOS 10以上的设备上运行一下,你会发现,我的天啊,竟然没有

liujia216的博客 8380

deepin安装wine64出现错误: X 64-bit development files not found.

错误信息如下: configure: error: X 64-bit development files not found. Wine will be built without X support, which probably isn't what you want. You will need to install 64-bit development packages of Xlib...

Yong.Sunshine 6414

ubuntu 常见安装软件错误

from:http://blog.chinaunix.net/u2/70443/showart_716317.html1、错误: Cant find X includes. Please check your installation and add the correct paths!原因:没有X的包含文件解决:安装xlibs-dev即可2、错误: Qt (>= Qt 3.0) (

xiliuhu的专栏 877

GCC Inline ASM

GCC Inline ASM GCC has an extremely powerful feature where it allows inline assembly within C (or C++) code. Other assemblers allow verbatim assembly constructs to be inserted into object code. The a

samssm的专栏 4033
上一篇: 采用wxWidgets做GUI的程序在MacOSX下生成APP
lamboy
博客等级 码龄20年 3粉丝 4原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值